]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1164 in SNORT/snort3 from dbg_cleanup2 to master
authorTom Peters (thopeter) <thopeter@cisco.com>
Mon, 26 Mar 2018 17:57:06 +0000 (13:57 -0400)
committerTom Peters (thopeter) <thopeter@cisco.com>
Mon, 26 Mar 2018 17:57:06 +0000 (13:57 -0400)
Squashed commit of the following:

commit e256a082394c1977bb24f33d843c5993539efb44
Author: snorty <mdagon@cisco.com>
Date:   Tue Mar 20 10:38:42 2018 -0400

    service inspectors: debug cleanup

17 files changed:
src/main/snort_debug.h
src/service_inspectors/back_orifice/back_orifice.cc
src/service_inspectors/dns/dns.cc
src/service_inspectors/ftp_telnet/ftp.cc
src/service_inspectors/ftp_telnet/ftp_data.cc
src/service_inspectors/ftp_telnet/pp_ftp.cc
src/service_inspectors/ftp_telnet/pp_telnet.cc
src/service_inspectors/gtp/gtp.cc
src/service_inspectors/gtp/gtp_module.cc
src/service_inspectors/gtp/gtp_module.h
src/service_inspectors/gtp/gtp_parser.cc
src/service_inspectors/sip/sip.cc
src/service_inspectors/sip/sip_config.cc
src/service_inspectors/sip/sip_dialog.cc
src/service_inspectors/sip/sip_parser.cc
src/service_inspectors/smtp/smtp.cc
src/service_inspectors/smtp/smtp_paf.cc

index 774314c3e029c1520f549c404150498d07a2888b..8d9b706a15bceefbf03a9e70a864d34bf1c0f946 100644 (file)
 #define DEBUG_STREAM_STATE    0x0000000400000000LL
 #define DEBUG_STREAM_PAF      0x0000000800000000LL
 #define DEBUG_ASN1            0x0000002000000000LL
-#define DEBUG_DNS             0x0000004000000000LL
-#define DEBUG_FTPTELNET       0x0000008000000000LL
-#define DEBUG_GTP             0x0000010000000000LL
 #define DEBUG_SIP             0x0000100000000000LL
-#define DEBUG_SMTP            0x0000400000000000LL
 #define DEBUG_REPUTATION      0x0000800000000000LL
 
 #define DEBUG_CODEC           0x0001000000000000LL
index 456c4a6bd40398bea80d878ff2a905c5fc13047d..41c965a0263d07d394db1993a6d6a853879e3e88 100644 (file)
@@ -350,9 +350,6 @@ static int BoGetDirection(Packet* p, const char* pkt_data)
         pkt_data++;
     }
 
-    DebugFormat(DEBUG_INSPECTOR, "Data length = %u\n", len);
-    DebugFormat(DEBUG_INSPECTOR, "ID = %u\n", id);
-
     /* Do more len checking */
 
     if ( len >= BO_BUF_ATTACK_SIZE )
@@ -388,20 +385,9 @@ static int BoGetDirection(Packet* p, const char* pkt_data)
         return BO_FROM_UNKNOWN;
     }
 
-    if ( type & 0x80 )
-    {
-        DebugMessage(DEBUG_INSPECTOR, "Partial packet\n");
-    }
-    if ( type & 0x40 )
-    {
-        DebugMessage(DEBUG_INSPECTOR, "Continued packet\n");
-    }
-
     /* Extract type of BO packet */
     type = type & 0x3F;
 
-    DebugFormat(DEBUG_INSPECTOR, "Type = 0x%x\n", type);
-
     /* Only examine data if this is a ping request or response */
     if ( type == BO_TYPE_PING )
     {
@@ -500,37 +486,18 @@ void BackOrifice::eval(Packet* p)
                 char plaintext = *pkt_data ^ BoRand();
 
                 if ( *magic_data != plaintext )
-                {
-                    DebugFormat(DEBUG_INSPECTOR,
-                        "Failed check one on 0x%X : 0x%X\n",
-                        *magic_data, plaintext);
-
                     return;
-                }
 
                 ++magic_data;
                 ++pkt_data;
             }
 
             // if we fall thru there's a detect
-            DebugMessage(DEBUG_INSPECTOR,
-                "Detected Back Orifice Data!\n");
-                DebugFormat(DEBUG_INSPECTOR, "hash value: %d\n", key);
-
             int bo_direction = BoGetDirection(p, pkt_data);
-
             if ( bo_direction == BO_FROM_CLIENT )
-            {
                 DetectionEngine::queue_event(GID_BO, BO_CLIENT_TRAFFIC_DETECT);
-                DebugMessage(DEBUG_INSPECTOR, "Client packet\n");
-            }
-
             else if ( bo_direction == BO_FROM_SERVER )
-            {
                 DetectionEngine::queue_event(GID_BO, BO_SERVER_TRAFFIC_DETECT);
-                DebugMessage(DEBUG_INSPECTOR, "Server packet\n");
-            }
-
             else
                 DetectionEngine::queue_event(GID_BO, BO_TRAFFIC_DETECT);
         }
index b5656d9079fcba6d54ecd05d8f52406352029279..3603ee928f8b7fb8f9a43b7ab801f9a69b230926 100644 (file)
@@ -734,20 +734,6 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
             dnsSessionData->curr_rec = 0;
         }
 
-        /* Print out the header (but only once -- when we're ready to parse the Questions */
-        if ((dnsSessionData->curr_rec_state == DNS_RESP_STATE_Q_NAME) &&
-            (dnsSessionData->curr_rec == 0))
-        {
-            DebugFormat(DEBUG_DNS,
-                "DNS Header: length %d, id 0x%x, flags 0x%x, "
-                "questions %d, answers %d, authorities %d, additionals %d\n",
-                dnsSessionData->length, dnsSessionData->hdr.id,
-                dnsSessionData->hdr.flags, dnsSessionData->hdr.questions,
-                dnsSessionData->hdr.answers,
-                dnsSessionData->hdr.authorities,
-                dnsSessionData->hdr.additionals);
-        }
-
         if (!(dnsSessionData->hdr.flags & DNS_HDR_FLAG_RESPONSE))
         {
             /* Not a response */
@@ -764,11 +750,6 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
 
                 if (dnsSessionData->curr_rec_state == DNS_RESP_STATE_Q_COMPLETE)
                 {
-                    DebugFormat(DEBUG_DNS,
-                        "DNS Question %d: type %d, class %d\n",
-                        i, dnsSessionData->curr_q.type,
-                        dnsSessionData->curr_q.dns_class);
-
                     dnsSessionData->curr_rec_state = DNS_RESP_STATE_Q_NAME;
                     dnsSessionData->curr_rec++;
                 }
@@ -804,14 +785,6 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
                 switch (dnsSessionData->curr_rec_state)
                 {
                 case DNS_RESP_STATE_RR_RDATA_START:
-                    DebugFormat(DEBUG_DNS,
-                        "DNS ANSWER RR %d: type %hu, class %hu, "
-                        "ttl %u rdlength %hu\n", i,
-                        dnsSessionData->curr_rr.type,
-                        dnsSessionData->curr_rr.dns_class,
-                        dnsSessionData->curr_rr.ttl,
-                        dnsSessionData->curr_rr.length);
-
                     dnsSessionData->bytes_seen_curr_rec = 0;
                     dnsSessionData->curr_rec_state = DNS_RESP_STATE_RR_RDATA_MID;
                 /* Fall through */
@@ -857,14 +830,6 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
                 switch (dnsSessionData->curr_rec_state)
                 {
                 case DNS_RESP_STATE_RR_RDATA_START:
-                    DebugFormat(DEBUG_DNS,
-                        "DNS AUTH RR %d: type %hu, class %hu, "
-                        "ttl %u rdlength %hu\n", i,
-                        dnsSessionData->curr_rr.type,
-                        dnsSessionData->curr_rr.dns_class,
-                        dnsSessionData->curr_rr.ttl,
-                        dnsSessionData->curr_rr.length);
-
                     dnsSessionData->bytes_seen_curr_rec = 0;
                     dnsSessionData->curr_rec_state = DNS_RESP_STATE_RR_RDATA_MID;
                 /* Fall through */
@@ -910,14 +875,6 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
                 switch (dnsSessionData->curr_rec_state)
                 {
                 case DNS_RESP_STATE_RR_RDATA_START:
-                    DebugFormat(DEBUG_DNS,
-                        "DNS ADDITIONAL RR %d: type %hu, class %hu, "
-                        "ttl %u rdlength %hu\n", i,
-                        dnsSessionData->curr_rr.type,
-                        dnsSessionData->curr_rr.dns_class,
-                        dnsSessionData->curr_rr.ttl,
-                        dnsSessionData->curr_rr.length);
-
                     dnsSessionData->bytes_seen_curr_rec = 0;
                     dnsSessionData->curr_rec_state = DNS_RESP_STATE_RR_RDATA_MID;
                 /* Fall through */
index 04c26746bb48d4977c265b1731189ed6ddf47a06..1ca6abeef01f820c2e5c640d0301fa785f883002 100644 (file)
@@ -82,29 +82,12 @@ static int SnortFTP(
 
     if (iInspectMode == FTPP_SI_SERVER_MODE)
     {
-        DebugFormat(DEBUG_FTPTELNET,
-            "Server packet: %.*s\n", p->dsize, p->data);
-
         // FIXIT-L breaks target-based non-standard ports
         //if ( !ScPafEnabled() )
         Stream::flush_client(p);
     }
-    else
-    {
-        if ( !InspectClientPacket(p) )
-        {
-            DebugMessage(DEBUG_FTPTELNET,
-                "Client packet will be reassembled\n");
-            return FTPP_SUCCESS;
-        }
-        else
-        {
-            DebugFormat(DEBUG_FTPTELNET,
-                "Client packet: rebuilt %s: %.*s\n",
-                (p->packet_flags & PKT_REBUILT_STREAM) ? "yes" : "no",
-                p->dsize, p->data);
-        }
-    }
+    else if ( !InspectClientPacket(p) )
+        return FTPP_SUCCESS;
 
     int ret = initialize_ftp(FTPsession, p, iInspectMode);
     if ( ret )
index 6b25860760b621d8fdbbf88fda2b644bc09981e2..8d1659062960660d7cc801efa2e5bdc2546d5a89 100644 (file)
@@ -134,13 +134,9 @@ static int SnortFTPData(Packet* p)
 
         if (!PROTO_IS_FTP(ftp_ssn))
         {
-            DebugMessage(DEBUG_FTPTELNET,
-                "FTP-DATA Invalid FTP_SESSION retrieved during lookup\n");
-
             if (data_ssn->data_chan)
                 p->flow->set_ignore_direction(SSN_DIR_BOTH);
 
-
             return -2;
         }
 
index 463634c1bd70852c95c2451321bab32373101f18..8a2068cd4ff99120668a13ff97b42a6a0c2e5e6b 100644 (file)
@@ -1241,7 +1241,6 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
                 /* Could check that response msg includes "TLS" */
                 session->encr_state = AUTH_TLS_ENCRYPTED;
                 DetectionEngine::queue_event(GID_FTP, FTP_ENCRYPTED);
-                DebugMessage(DEBUG_FTPTELNET, "FTP stream is now TLS encrypted\n");
             }
             break;
         case AUTH_SSL_CMD_ISSUED:
@@ -1250,7 +1249,6 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
                 /* Could check that response msg includes "SSL" */
                 session->encr_state = AUTH_SSL_ENCRYPTED;
                 DetectionEngine::queue_event(GID_FTP, FTP_ENCRYPTED);
-                DebugMessage(DEBUG_FTPTELNET, "FTP stream is now SSL encrypted\n");
             }
             break;
         case AUTH_UNKNOWN_CMD_ISSUED:
@@ -1258,7 +1256,6 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
             {
                 session->encr_state = AUTH_UNKNOWN_ENCRYPTED;
                 DetectionEngine::queue_event(GID_FTP, FTP_ENCRYPTED);
-                DebugMessage(DEBUG_FTPTELNET, "FTP stream is now encrypted\n");
             }
             break;
         }
@@ -1419,8 +1416,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                         /* Mark this session & packet as one to ignore */
                         Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                     }
-                    DebugMessage(DEBUG_FTPTELNET,
-                        "FTP client stream is now encrypted\n");
                 }
                 break;
             }
@@ -1498,8 +1493,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                         /* Mark this session & packet as one to ignore */
                         Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                     }
-                    DebugMessage(DEBUG_FTPTELNET,
-                        "FTP server stream is now encrypted\n");
                 }
                 break;
             }
@@ -1579,8 +1572,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                     }
                     else
                     {
-                        DebugMessage(DEBUG_FTPTELNET,
-                            "invalid FTP response code.");
                         ftpssn->server.response.state = FTP_RESPONSE_INV;
                     }
                 }
@@ -1608,12 +1599,7 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                 req->param_begin = nullptr;
                 req->param_end = nullptr;
             }
-            else if (!space && ftpssn->server.response.state == 0)
-            {
-                DebugMessage(DEBUG_FTPTELNET,
-                    "Missing LF from end of FTP command\n");
-            }
-            else
+            else if (space || ftpssn->server.response.state != 0)
             {
                 /* Now grab the command parameters/response message
                  * read_ptr < end already checked */
@@ -1630,14 +1616,7 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                      * the pipeline.
                      */
                     if (*read_ptr == LF)
-                    {
                         read_ptr++;
-                    }
-                    else
-                    {
-                        DebugMessage(DEBUG_FTPTELNET,
-                            "Missing LF from end of FTP command with params\n");
-                    }
                 }
             }
         }
@@ -1646,8 +1625,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
             /* Nothing left --> no parameters/message.  Not even an LF */
             req->param_begin = nullptr;
             req->param_end = nullptr;
-            DebugMessage(DEBUG_FTPTELNET,
-                "Missing LF from end of FTP command sans params\n");
         }
 
         /* Set the pointer for the next request/response
@@ -1661,16 +1638,9 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
         switch (state)
         {
         case FTP_CMD_INV:
-            DebugFormat(DEBUG_FTPTELNET,
-                "Illegal FTP command found: %.*s\n",
-                req->cmd_size, req->cmd_begin);
             iRet = FTPP_ALERT;
             break;
         case FTP_RESPONSE: /* Response */
-            DebugFormat(DEBUG_FTPTELNET,
-                "FTP response: code: %.*s : M len %u : M %.*s\n",
-                req->cmd_size, req->cmd_begin, req->param_size,
-                req->param_size, req->param_begin);
             if ((ftpssn->client_conf->max_resp_len > 0) &&
                 (req->param_size > ftpssn->client_conf->max_resp_len))
             {
@@ -1686,10 +1656,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
             }
             break;
         case FTP_RESPONSE_CONT: /* Response continued */
-            DebugFormat(DEBUG_FTPTELNET,
-                "FTP response: continuation of code: %d : M len %u : M %.*s\n",
-                ftpssn->server.response.state, req->param_size,
-                req->param_size, req->param_begin);
             if ((ftpssn->client_conf->max_resp_len > 0) &&
                 (req->param_size > ftpssn->client_conf->max_resp_len))
             {
@@ -1699,10 +1665,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
             }
             break;
         case FTP_RESPONSE_ENDCONT: /* Continued response end */
-            DebugFormat(DEBUG_FTPTELNET,
-                "FTP response: final continue of code: %.*s : M len %u : "
-                "M %.*s\n", req->cmd_size, req->cmd_begin,
-                req->param_size, req->param_size, req->param_begin);
             if ((ftpssn->client_conf->max_resp_len > 0) &&
                 (req->param_size > ftpssn->client_conf->max_resp_len))
             {
@@ -1712,9 +1674,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
             }
             break;
         default:
-            DebugFormat(DEBUG_FTPTELNET, "FTP command: CMD: %.*s : "
-                "P len %u : P %.*s\n", req->cmd_size, req->cmd_begin,
-                req->param_size, req->param_size, req->param_begin);
             if (CmdConf)
             {
                 unsigned max = CmdConf->max_param_len;
@@ -1725,9 +1684,6 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                 {
                     /* Alert on param length overrun */
                     DetectionEngine::queue_event(GID_FTP, FTP_PARAMETER_LENGTH_OVERFLOW);
-                    DebugFormat(DEBUG_FTPTELNET, "FTP command: %.*s"
-                        "parameter length overrun %u > %u \n",
-                        req->cmd_size, req->cmd_begin, req->param_size, max);
                     iRet = FTPP_ALERT;
                 }
 
index 66d833b1bb7a3a4ce4296edb6d41b43fc9447bcf..d59030fffe0339967df7a76e423593e11f09e89d 100644 (file)
@@ -169,7 +169,6 @@ int normalize_telnet(
 
     if (!normalization_required)
     {
-        DebugMessage(DEBUG_FTPTELNET, "Nothing to process!\n");
         if (tnssn && iMode == FTPP_SI_CLIENT_MODE)
             tnssn->consec_ayt = 0;
         return FTPP_SUCCESS;
@@ -407,11 +406,6 @@ int normalize_telnet(
         }
         else
         {
-            DebugFormat(DEBUG_FTPTELNET,
-                "overwriting %2X(%c) with %2X(%c)\n",
-                (unsigned char)(*write_ptr&0xFF), *write_ptr,
-                (unsigned char)(*read_ptr & 0xFF), *read_ptr);
-
             /* overwrite the negotiation bytes with the follow-on bytes */
             switch (*((const unsigned char*)(read_ptr)))
             {
index 0612ca0398b70b9314b6ce8e40e6a850b3a8c4b8..ba57aa0c1e9836f0ab7f75a1c52ad6c33a69c367 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "gtp.h"
 
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 
 #include "gtp_inspect.h"
@@ -62,9 +61,6 @@ static inline int GTP_Process(const GTPConfig& config, Packet* p, GTP_Roptions*
     pRopts->gtp_header = gtpMsg.gtp_header;
     pRopts->msg_id = gtpMsg.msg_id;
 
-    DEBUG_WRAP(DebugFormat(DEBUG_GTP, "GTP message version: %d\n", gtpMsg.version));
-    DEBUG_WRAP(DebugFormat(DEBUG_GTP, "GTP message type: %d\n", gtpMsg.msg_type));
-
     return status;
 }
 
@@ -91,11 +87,7 @@ void GTPmain(const GTPConfig& config, Packet* packetp)
         pRopts = GTPGetNewSession(packetp);
 
         if ( !pRopts )
-        {
-            /* Could not get/create the session data for this packet. */
-            DEBUG_WRAP(DebugMessage(DEBUG_GTP, "Create session error - not inspecting.\n"));
             return;
-        }
     }
 
     GTP_Process(config, packetp, pRopts);
index 8056864efb4bd48f560a2ab5b53cf8ce56a6a5a3..0861d51c5b8cd71802447057140d95ffba36198a 100644 (file)
@@ -32,6 +32,7 @@
 
 using namespace snort;
 
+Trace TRACE_NAME(gtp_inspect);
 THREAD_LOCAL ProfileStats gtp_inspect_prof;
 
 #define GTP_EVENT_BAD_MSG_LEN_STR        "message length is invalid"
@@ -121,10 +122,10 @@ static const Parameter gtp_params[] =
 };
 
 GtpInspectModule::GtpInspectModule() :
-    Module(GTP_NAME, GTP_HELP, gtp_params, true)
+    Module(GTP_NAME, GTP_HELP, gtp_params, true, &TRACE_NAME(gtp_inspect))
 { }
 
-bool GtpInspectModule::set(const char*, Value& v, SnortConfig*)
+bool GtpInspectModule::set(const char* fqn, Value& v, SnortConfig* c)
 {
     if ( v.is("version") )
         stuff.version = v.get_long();
@@ -139,7 +140,7 @@ bool GtpInspectModule::set(const char*, Value& v, SnortConfig*)
         stuff.name = v.get_string();
 
     else
-        return false;
+        return Module::set(fqn, v, c);
 
     return true;
 }
index 45a9058ce617bed9783559afc00c5d60dc390a98..eaba41b402f544d0ac3727b8333226d77ac7f0fd 100644 (file)
@@ -22,6 +22,7 @@
 #define GTP_MODULE_H
 
 #include "framework/module.h"
+#include "main/snort_debug.h"
 
 #define GID_GTP 143
 
@@ -33,6 +34,7 @@
 #define GTP_HELP "gtp control channel inspection"
 
 extern THREAD_LOCAL snort::ProfileStats gtp_inspect_prof;
+extern Trace TRACE_NAME(gtp_inspect);
 
 struct GtpStuff
 {
index 639a61da2f73611736656e7620b876576597c947..f1476a4f49070f12e16cb0f61de5b84669d3d207 100644 (file)
@@ -116,7 +116,7 @@ static void printInfoElements(GTP_IEData* info_elements, GTPMsg* msg)
             char buf[STD_BUF];
             convertToHex( (char*)buf, sizeof(buf),
                 msg->gtp_header + info_elements[i].shift, info_elements[i].length);
-            DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Info type: %.3d, content: %s\n", i, buf); );
+            trace_logf(gtp_inspect, "Info type: %.3d, content: %s\n", i, buf);
         }
     }
 }
@@ -129,8 +129,6 @@ static int gtp_processInfoElements(
     uint8_t previous_type = (uint8_t)*start;
     int32_t unprocessed_len = len;
 
-    DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Information elements: length: %d\n", len); );
-
     while ( unprocessed_len > 0)
     {
         uint8_t type = *start;
@@ -143,7 +141,6 @@ static int gtp_processInfoElements(
 
         if ( nullptr == ie )
         {
-            DEBUG_WRAP(DebugMessage(DEBUG_GTP, "Unsupported Information elements!\n"); );
             gtp_stats.unknownIEs++;
             return false;
         }
@@ -195,13 +192,13 @@ static int gtp_processInfoElements(
             msg->info_elements[type].msg_id = msg->msg_id;
         }
 
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "GTP information element: %s(%d), length: %d\n",
-            ie->name.c_str(), type, length));
         start += length;
         unprocessed_len -= length;
         previous_type = type;
     }
-    DEBUG_WRAP(printInfoElements(msg->info_elements, msg); );
+#ifdef DEBUG_MSGS
+    printInfoElements(msg->info_elements, msg);
+#endif
     return true;
 }
 
@@ -237,17 +234,12 @@ static int gtp_parse_v0(GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
 {
     const GTP_C_Hdr* hdr;
 
-    DEBUG_WRAP(DebugMessage(DEBUG_GTP, "This is a GTP v0 packet.\n"); );
-
     hdr = (const GTP_C_Hdr*)buff;
-
     msg->header_len = GTP_HEADER_LEN_V0;
 
     /*Check the length field. */
     if (gtp_len != ((unsigned int)ntohs(hdr->length) + GTP_LENGTH_OFFSET_V0))
     {
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Calculated length %d != %d in header.\n",
-            gtp_len - GTP_LENGTH_OFFSET_V0, ntohs(hdr->length)); );
         alert(GTP_EVENT_BAD_MSG_LEN);
         return false;
     }
@@ -287,8 +279,6 @@ static int gtp_parse_v1(GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
 {
     const GTP_C_Hdr* hdr;
 
-    DEBUG_WRAP(DebugMessage(DEBUG_GTP, "This ia a GTP v1 packet.\n"); );
-
     hdr = (const GTP_C_Hdr*)buff;
 
     /*Check the length based on optional fields and extension header*/
@@ -342,8 +332,6 @@ static int gtp_parse_v1(GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
     /*Check the length field. */
     if (gtp_len != ((unsigned int)ntohs(hdr->length) + GTP_LENGTH_OFFSET_V1))
     {
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Calculated length %d != %d in header.\n",
-            gtp_len - GTP_LENGTH_OFFSET_V1, ntohs(hdr->length)); );
         alert(GTP_EVENT_BAD_MSG_LEN);
         return false;
     }
@@ -379,8 +367,6 @@ static int gtp_parse_v2(GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
 {
     const GTP_C_Hdr* hdr;
 
-    DEBUG_WRAP(DebugMessage(DEBUG_GTP, "This ia a GTP v2 packet.\n"); );
-
     hdr = (const GTP_C_Hdr*)buff;
 
     if (hdr->flag & 0x8)
@@ -391,8 +377,6 @@ static int gtp_parse_v2(GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
     /*Check the length field. */
     if (gtp_len != ((unsigned int)ntohs(hdr->length) + GTP_LENGTH_OFFSET_V2))
     {
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Calculated length %d != %d in header.\n",
-            gtp_len - GTP_LENGTH_OFFSET_V2, ntohs(hdr->length)); );
         alert(GTP_EVENT_BAD_MSG_LEN);
         return false;
     }
@@ -416,10 +400,7 @@ static int gtp_parse_v2(GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
  ********************************************************************/
 int gtp_parse(const GTPConfig& config, GTPMsg* msg, const uint8_t* buff, uint16_t gtp_len)
 {
-    DEBUG_WRAP(DebugMessage(DEBUG_GTP, "Start parsing...\n"));
-
     /*Check the length*/
-    DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Basic header length: %d\n", GTP_MIN_HEADER_LEN));
     if (gtp_len < GTP_MIN_HEADER_LEN)
         return false;
 
@@ -430,30 +411,19 @@ int gtp_parse(const GTPConfig& config, GTPMsg* msg, const uint8_t* buff, uint16_
     msg->gtp_header = buff;
 
     if (msg->version > MAX_GTP_VERSION_CODE)
-    {
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Unsupported GTP version: %d!\n",msg->version); );
         return false;
-    }
+    
     /*Check whether this is GTP or GTP', Exit if GTP'*/
     if (!(hdr->flag & 0x10))
-    {
-        DEBUG_WRAP(DebugMessage(DEBUG_GTP, "Unsupported GTP'!\n"); );
         return false;
-    }
 
     const GTP_MsgType* msgType = &config.msgv[msg->version][msg->msg_type];
 
     if ( nullptr == msgType )
     {
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "Unsupported GTP message type: %d!\n",msg->msg_type); );
         gtp_stats.unknownTypes++;
         return false;
     }
-    else
-    {
-        DEBUG_WRAP(DebugFormat(DEBUG_GTP, "GTP version: %d, message type: %s(%d)\n",
-            msg->version, msgType->name.c_str(), msg->msg_type));
-    }
 
     // FIXIT-L need to implement stats retrieval from module
     //gtp_stats.messages[msg->version][msg->msg_type]++;
@@ -479,7 +449,6 @@ int gtp_parse(const GTPConfig& config, GTPMsg* msg, const uint8_t* buff, uint16_
         break;
 
     default:
-        DEBUG_WRAP(DebugMessage(DEBUG_GTP, "Unknown protocol version.\n"); );
         return false;
     }
 
index 218f8953ed0e13e018ef661bcc5e12614e361c3a..0a6c510d6940a3507324c736e48a7fa338ec56af 100644 (file)
@@ -194,17 +194,6 @@ static inline int SIP_Process(Packet* p, SIPData* sessp, SIP_PROTO_CONF* config)
     pRopts->body_data = sipMsg.body_data;
     pRopts->status_code = sipMsg.status_code;
 
-    DebugFormat(DEBUG_SIP, "SIP message header length: %d\n",
-        sipMsg.headerLen);
-    DebugFormat(DEBUG_SIP, "Parsed method: %.*s, Flag: 0x%x\n",
-        sipMsg.methodLen, sipMsg.method, sipMsg.methodFlag);
-    DebugFormat(DEBUG_SIP, "Parsed status code:  %d\n",
-        sipMsg.status_code);
-    DebugFormat(DEBUG_SIP, "Parsed header address: %p.\n",
-        sipMsg.header);
-    DebugFormat(DEBUG_SIP, "Parsed body address: %p.\n",
-        sipMsg.body_data);
-
     sip_freeMsg(&sipMsg);
     return status;
 }
index 631897079a4d5c76036ce154df252eac6c4f2931..9d536c2b08d45b5d720b6b37af126fcab54ceab2 100644 (file)
@@ -116,7 +116,6 @@ void SIP_ParseMethods(const char* cur_tokenp, uint32_t* methodsConfig, SIPMethod
     /* If the user specified methods, remove default methods for now since
      * it now needs to be set explicitly. */
     *methodsConfig =  SIP_METHOD_NULL;
-    DebugFormat(DEBUG_SIP, "Method token: %s\n",cur_tokenp);
     // Check whether this is a standard method
 
     i_method = SIP_findMethod(cur_tokenp, StandardMethods);
index 67785dc32acc98ae981081d5f3d4c31d62277c37..7082be9c8691d54911c8dedf6f7fb79a13b5f313 100644 (file)
@@ -28,7 +28,6 @@
 #include "detection/detection_engine.h"
 #include "events/event_queue.h"
 #include "framework/data_bus.h"
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 #include "protocols/vlan.h"
 #include "pub_sub/sip_events.h"
@@ -51,10 +50,6 @@ static int SIP_ignoreChannels(SIP_DialogData*, Packet* p, SIP_PROTO_CONF*);
 static SIP_DialogData* SIP_addDialog(SIPMsg*, SIP_DialogData*, SIP_DialogList*);
 static int SIP_deleteDialog(SIP_DialogData*, SIP_DialogList*);
 
-#ifdef DEBUG_MSGS
-static void SIP_displayMedias(SIP_MediaList* dList);
-#endif
-
 /********************************************************************
  * Function: SIP_processRequest()
  *
@@ -149,15 +144,10 @@ static int SIP_processInvite(SIPMsg* sipMsg, SIP_DialogData* dialog, SIP_DialogL
     if (nullptr == dialog)
         return false;
 
-    DebugFormat(DEBUG_SIP, "Processing invite, dialog state %d \n", dialog->state);
-
     /*Check for the invite replay attack: authenticated invite without challenge*/
     // check whether this invite has authorization information
     if ((SIP_DLG_AUTHENCATING != dialog->state) && (nullptr != sipMsg->authorization))
     {
-        DebugFormat(DEBUG_SIP, "Dialog state code: %hu\n",
-            dialog->status_code);
-
         DetectionEngine::queue_event(GID_SIP, SIP_EVENT_AUTH_INVITE_REPLAY_ATTACK);
         return false;
     }
@@ -250,8 +240,6 @@ static int SIP_processResponse(SIPMsg* sipMsg, SIP_DialogData* dialog, SIP_Dialo
     if (nullptr == dialog)
         return false;
 
-    DebugFormat(DEBUG_SIP, "Processing response, dialog state %d \n", dialog->state);
-
     if (sipMsg->status_code > 0)
         dialog->status_code = sipMsg->status_code;
 
@@ -354,18 +342,12 @@ static bool SIP_checkMediaChange(SIPMsg* sipMsg, SIP_DialogData* dialog)
     if (nullptr == medias)
     {
         // Can't find the media session by ID, SDP has been changed.
-        DebugFormat(DEBUG_SIP, "Can't find the media data, ID: %u\n",
-            sipMsg->mediaSession->sessionID);
-
         return false;
     }
     // The media content has been changed
     if (0 != SIP_compareMedias(medias->medias, sipMsg->mediaSession->medias))
-    {
-        // Can't find the media session by ID, SDP has been changed.
-        DebugMessage(DEBUG_SIP, "The media data is different!\n");
         return false;
-    }
+
     return true;
 }
 
@@ -391,8 +373,6 @@ static int SIP_ignoreChannels(SIP_DialogData* dialog, Packet* p, SIP_PROTO_CONF*
     if (0 == config->ignoreChannel)
         return false;
 
-    DebugFormat(DEBUG_SIP, "Ignoring the media data in Dialog: %u\n",
-        dialog->dlgID.callIdHash);
     // check the first media session
     if (nullptr == dialog->mediaSessions)
         return false;
@@ -400,18 +380,12 @@ static int SIP_ignoreChannels(SIP_DialogData* dialog, Packet* p, SIP_PROTO_CONF*
     if (nullptr == dialog->mediaSessions->nextS)
         return false;
 
-    DebugFormat(DEBUG_SIP, "Ignoring the media sessions ID: %u and %u\n",
-        dialog->mediaSessions->sessionID, dialog->mediaSessions->nextS->sessionID);
     mdataA = dialog->mediaSessions->medias;
     mdataB = dialog->mediaSessions->nextS->medias;
     sip_stats.ignoreSessions++;
     while ((nullptr != mdataA)&&(nullptr != mdataB))
     {
         //void *ssn;
-        DebugFormat(DEBUG_SIP, "Ignoring channels Source IP: %s Port: %hu\n",
-            mdataA->maddress.ntoa(), mdataA->mport);
-        DebugFormat(DEBUG_SIP, "Ignoring channels Destine IP: %s Port: %hu\n",
-            mdataB->maddress.ntoa(), mdataB->mport);
 
         /* Call into Streams to mark data channel as something to ignore. */
         Flow* ssn = Stream::get_flow(
@@ -457,7 +431,6 @@ static int SIP_compareMedias(SIP_MediaDataList mlistA, SIP_MediaDataList mlistB)
     SIP_MediaData* mdataA,* mdataB;
     mdataA = mlistA;
     mdataB = mlistB;
-    DebugMessage(DEBUG_SIP, "Compare the media data \n");
     while ((nullptr != mdataA) && (nullptr != mdataB))
     {
         if (mdataA->maddress.compare(mdataB->maddress) != SFIP_EQUAL)
@@ -492,21 +465,15 @@ static void SIP_updateMedias(SIP_MediaSession* mSession, SIP_MediaList* dList)
 
     if (nullptr == mSession)
         return;
-    DebugFormat(DEBUG_SIP, "Updating session id: %u\n",
-        mSession->sessionID);
+  
     mSession->savedFlag = SIP_SESSION_SAVED;
     // Find out the media session based on session id
     currSession = *dList;
     while (nullptr != currSession)
     {
-        DebugFormat(DEBUG_SIP, "Session id: %u\n",
-            currSession->sessionID);
         if (currSession->sessionID == mSession->sessionID)
-        {
-            DebugFormat(DEBUG_SIP, "Found Session id: %u\n",
-                currSession->sessionID);
             break;
-        }
+        
         preSession = currSession;
         currSession = currSession->nextS;
     }
@@ -515,12 +482,10 @@ static void SIP_updateMedias(SIP_MediaSession* mSession, SIP_MediaList* dList)
     {
         mSession->nextS = *dList;
         *dList = mSession;
-        DEBUG_WRAP(DebugFormat(DEBUG_SIP, "Add Session id: %u\n", mSession->sessionID));
     }
     else
     {
         // if this session needs to be updated
-        DebugFormat(DEBUG_SIP, "Insert Session id: %u\n", mSession->sessionID);
         mSession->nextS = currSession->nextS;
         // if this is the header, update the new header
         if (nullptr == preSession)
@@ -532,36 +497,8 @@ static void SIP_updateMedias(SIP_MediaSession* mSession, SIP_MediaList* dList)
         currSession->nextS = nullptr;
         sip_freeMediaSession(currSession);
     }
-
-    // Display the final media session
-#ifdef DEBUG_MSGS
-    SIP_displayMedias(dList);
-#endif
 }
 
-#ifdef DEBUG_MSGS
-void SIP_displayMedias(SIP_MediaList* dList)
-{
-    SIP_MediaSession* currSession;
-    DebugMessage(DEBUG_SIP, "Updated Session information------------\n");
-    currSession = *dList;
-    while (nullptr != currSession)
-    {
-        SIP_MediaData* mdata;
-        DebugFormat(DEBUG_SIP, "Session id: %u\n", currSession->sessionID);
-        mdata =  currSession->medias;
-        while (nullptr != mdata)
-        {
-            DebugFormat(DEBUG_SIP, "Media IP: %s, port: %hu, number of ports %hhu\n",
-                mdata->maddress.ntoa(), mdata->mport, mdata->numPort);
-            mdata = mdata->nextM;
-        }
-        currSession = currSession->nextS;
-    }
-    DebugMessage(DEBUG_SIP, "End  of Session information------------\n");
-}
-
-#endif
 /********************************************************************
  * Function: SIP_addDialog
  *
@@ -581,10 +518,6 @@ static SIP_DialogData* SIP_addDialog(SIPMsg* sipMsg, SIP_DialogData* currDialog,
 {
     SIP_DialogData* dialog;
 
-    DebugFormat(DEBUG_SIP, "Add Dialog id: %u, From: %u, To: %u, status code: %hu\n",
-        sipMsg->dlgID.callIdHash,sipMsg->dlgID.fromTagHash,sipMsg->dlgID.toTagHash,
-        sipMsg->status_code);
-
     sip_stats.dialogs++;
     dialog = (SIP_DialogData*)snort_calloc(sizeof(SIP_DialogData));
 
@@ -631,8 +564,6 @@ static int SIP_deleteDialog(SIP_DialogData* currDialog, SIP_DialogList* dList)
     if ((nullptr == currDialog)||(nullptr == dList))
         return false;
 
-    DebugFormat(DEBUG_SIP, "Delete Dialog id: %u, From: %u, To: %u \n",
-        currDialog->dlgID.callIdHash,currDialog->dlgID.fromTagHash,currDialog->dlgID.toTagHash);
     // If this is the header
     if (nullptr ==  currDialog->prevD)
     {
@@ -683,23 +614,15 @@ int SIP_updateDialog(SIPMsg* sipMsg, SIP_DialogList* dList, Packet* p, SIP_PROTO
     if ((nullptr == sipMsg)||(0 == sipMsg->dlgID.callIdHash))
         return false;
 
-    DebugFormat(DEBUG_SIP, "Updating Dialog id: %u, From: %u, To: %u\n",
-        sipMsg->dlgID.callIdHash,sipMsg->dlgID.fromTagHash,sipMsg->dlgID.toTagHash);
-
     dialog = dList->head;
 
     /*Find out the dialog in the dialog list*/
 
     while (nullptr != dialog)
     {
-        DebugFormat(DEBUG_SIP, "Dialog id: %u, From: %u, To: %u\n",
-            dialog->dlgID.callIdHash,dialog->dlgID.fromTagHash,dialog->dlgID.toTagHash);
         if (sipMsg->dlgID.callIdHash == dialog->dlgID.callIdHash)
-        {
-            DebugFormat(DEBUG_SIP, "Found Dialog id: %u, From: %u, To: %u\n",
-                dialog->dlgID.callIdHash,dialog->dlgID.fromTagHash,dialog->dlgID.toTagHash);
             break;
-        }
+        
         oldDialog = dialog;
         dialog = dialog->nextD;
     }
@@ -749,10 +672,6 @@ void sip_freeDialogs(SIP_DialogList* list)
 
     while (nullptr != curNode)
     {
-        DebugFormat(DEBUG_SIP,
-            "*Clean Dialog creator: 0x%x, id: %u, From: %u, To: %u, State: %d\n",
-            curNode->creator, curNode->dlgID.callIdHash,curNode->dlgID.fromTagHash,
-            curNode->dlgID.toTagHash,curNode->state);
         nextNode = curNode->nextD;
         sip_freeMediaList(curNode->mediaSessions);
         snort_free(curNode);
index 8830a43210a6a96e77a1473dc30ec85f2a96807a..e78b93aefca476ac59aa25480501b22081745d53 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "detection/detection_engine.h"
 #include "events/event_queue.h"
-#include "main/snort_debug.h"
 #include "utils/util.h"
 #include "utils/util_cstring.h"
 
@@ -147,7 +146,6 @@ static int sip_process_headField(SIPMsg* msg, const char* start, const char* end
     char* colonIndex;
     const char* newStart, * newEnd;
     char newLength;
-    DebugFormat(DEBUG_SIP, "process line: %.*s\n", length, start);
 
     // If this is folding
     if ((' ' == start[0]) || ('\t' == start[0]))
@@ -329,20 +327,15 @@ static bool sip_startline_parse(SIPMsg* msg, const char* buff, const char* end,
     if (numOfLineBreaks < 1)
     {
         /*No CRLF */
-        DebugMessage(DEBUG_SIP, "No CRLF, check failed\n");
         return false;
     }
 
     /*Exclude CRLF from start line*/
     length =  next - start - numOfLineBreaks;
 
-    DebugFormat(DEBUG_SIP, "Start line: %.*s \n", length, start);
-    DebugMessage(DEBUG_SIP, "End of Start line \n");
-
     /*Should at least have SIP/2.0 */
     if (length < SIP_MIN_MSG_LEN)
     {
-        DebugMessage(DEBUG_SIP, "Message too short, check failed\n");
         return false;
     }
 
@@ -374,7 +367,6 @@ static bool sip_startline_parse(SIPMsg* msg, const char* buff, const char* end,
         }
         else
             msg->status_code =  (uint16_t)statusCode;
-        DebugFormat(DEBUG_SIP, "Status code: %d \n", msg->status_code);
     }
     else  /* This might be a request*/
     {
@@ -391,14 +383,11 @@ static bool sip_startline_parse(SIPMsg* msg, const char* buff, const char* end,
             return false;
         msg->method = buff;
         msg->methodLen = space - buff;
-        DebugFormat(DEBUG_SIP, "method: %.*s\n", msg->methodLen, msg->method);
 
         method = SIP_FindMethod (config->methods, msg->method, msg->methodLen);
         if (method)
         {
             msg->methodFlag = method->methodFlag;
-            DebugFormat(DEBUG_SIP, "Found the method: %s, Flag: 0x%x\n",
-                method->methodName, method->methodFlag);
         }
 
         // parse the uri
@@ -409,8 +398,7 @@ static bool sip_startline_parse(SIPMsg* msg, const char* buff, const char* end,
         if (space == nullptr)
             return false;
         msg->uriLen = space - msg->uri;
-        DebugFormat(DEBUG_SIP, "uri: %.*s, length: %hu\n", msg->uriLen, msg->uri,
-            msg->uriLen);
+
         if (0 == msg->uriLen)
             DetectionEngine::queue_event(GID_SIP, SIP_EVENT_EMPTY_REQUEST_URI);
         else if (config->maxUriLen && (msg->uriLen > config->maxUriLen))
@@ -469,7 +457,6 @@ static bool sip_headers_parse(
         /*Processing this line*/
         int length =  next - start - numOfLineBreaks;
 
-        DebugFormat(DEBUG_SIP, "Header line: %.*s\n", length, start);
         /*Process headers*/
         sip_process_headField(msg, start, start + length, &lastFieldIndex, config);
 
@@ -508,21 +495,13 @@ static bool sip_headers_parse(
  ********************************************************************/
 static bool sip_body_parse(SIPMsg* msg, const char* buff, const char* end, const char** bodyEnd)
 {
-#ifdef DEBUG_MSGS
-    {
-        int length = end - buff;
-        DebugFormat(DEBUG_SIP, "Body length: %d\n", length);
-        DebugFormat(DEBUG_SIP, "Body line: %.*s\n", length, buff);
-    }
-#endif
-
     // Initialize it
     *bodyEnd = end;
 
     if (buff == end)
         return true;
 
-    msg->body_data = (const uint8_t*) buff;
+    msg->body_data = (const uint8_t*)buff;
     msg->bodyLen = end - buff;
 
     // Create a media session
@@ -540,7 +519,6 @@ static bool sip_body_parse(SIPMsg* msg, const char* buff, const char* end, const
         /*Processing this line*/
         int length = next - start - numOfLineBreaks;
 
-        DebugFormat(DEBUG_SIP, "Body line: %.*s\n", length, start);
         /*Process body fields*/
         sip_process_bodyField(msg, start, start + length);
 
@@ -624,8 +602,6 @@ static bool sip_check_headers(SIPMsg* msg, SIP_PROTO_CONF* config)
         ret = false;
     }
 
-    DebugFormat(DEBUG_SIP, "Method flag: %d\n", msg->methodFlag);
-
     // Contact is required for invite message
     if ((0 == msg->contactLen)&&(msg->methodFlag == SIP_METHOD_INVITE)&&(0 == msg->status_code))
     {
@@ -664,9 +640,7 @@ static bool sip_check_headers(SIPMsg* msg, SIP_PROTO_CONF* config)
 static int sip_parse_via(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
     int length = end -start;
-    DebugFormat(DEBUG_SIP, "Via value: %.*s\n", length, start);
     msg->viaLen = msg->viaLen + length;
-    DebugFormat(DEBUG_SIP, "Via length: %d\n", msg->viaLen);
 
     return SIP_PARSE_SUCCESS;
 }
@@ -688,18 +662,13 @@ static int sip_parse_via(SIPMsg* msg, const char* start, const char* end, SIP_PR
 
 static int sip_parse_from(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
-    DEBUG_WRAP(int length = end -start; )
     char* buff;
     char* userEnd;
     char* userStart;
 
-    DebugFormat(DEBUG_SIP, "From value: %.*s\n", length, start);
     msg->from = start;
     msg->fromLen = end - start;
 
-    DebugFormat(DEBUG_SIP, "From length: %d , content: %.*s\n",
-        msg->fromLen, msg->fromLen, msg->from);
-
     /*Get the from tag*/
     msg->fromTagLen = 0;
 
@@ -730,9 +699,6 @@ static int sip_parse_from(SIPMsg* msg, const char* start, const char* end, SIP_P
         msg->userNameLen = 0;
     }
 
-    DebugFormat(DEBUG_SIP, "From tag length: %d , hash: %u, content: %.*s\n",
-        msg->fromTagLen, msg->dlgID.fromTagHash, msg->fromTagLen, msg->from_tag);
-
     return SIP_PARSE_SUCCESS;
 }
 
@@ -753,15 +719,10 @@ static int sip_parse_from(SIPMsg* msg, const char* start, const char* end, SIP_P
 
 static int sip_parse_to(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
-    DEBUG_WRAP(int length = end -start; )
     char* buff;
-    DebugFormat(DEBUG_SIP, "To value: %.*s\n", length, start);
     msg->to = start;
     msg->toLen = end - start;
 
-    DebugFormat(DEBUG_SIP, "To length: %d , content: %.*s\n",
-        msg->toLen, msg->toLen, msg->to);
-
     /*Processing tag information*/
     msg->toTagLen = 0;
 
@@ -778,31 +739,24 @@ static int sip_parse_to(SIPMsg* msg, const char* start, const char* end, SIP_PRO
         buff = (char*)memchr(buff + 1, ';', msg->toLen);
     }
 
-    DebugFormat(DEBUG_SIP, "To tag length: %d , Hash: %u, content: %.*s\n",
-        msg->toTagLen, msg->dlgID.toTagHash, msg->toTagLen, msg->to_tag);
     return SIP_PARSE_SUCCESS;
 }
 
-static inline bool is_valid_ip(const char *start, int length)
+static inline bool is_valid_ip(const charstart, int length)
 {
     SfIp ip;
     char ipStr[INET6_ADDRSTRLEN];
 
     /*Get the IP address*/
-    if(length > INET6_ADDRSTRLEN - 1)
+    if (length > INET6_ADDRSTRLEN - 1)
     {
         length = INET6_ADDRSTRLEN - 1;
     }
     memcpy(ipStr, start, length);
     ipStr[length] = '\0';
 
-    DebugFormat(DEBUG_SIP, "IP data: %s\n", ipStr);
-
-    if( ip.set(ipStr) != SFIP_SUCCESS)
-    {
-        DebugMessage(DEBUG_SIP, "Not valid IP! \n");
+    if ( ip.set(ipStr) != SFIP_SUCCESS)
         return false;
-    }
 
     return true;
 }
@@ -825,19 +779,16 @@ static inline bool is_valid_ip(const char *start, int length)
 static int sip_parse_call_id(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
     int length = end -start;
-    DebugFormat(DEBUG_SIP, "Call-Id value: %.*s\n", length, start);
     msg->call_id = start;
     /*ignore ip address in call id by adjusting length*/
     char* at = (char*)memchr(start, '@', length);
-    if(at && (at < end) && is_valid_ip(at+1, (end-at-1)))
+    if (at && (at < end) && is_valid_ip(at+1, (end-at-1)))
     {
         length = at - start;
     }
 
     msg->callIdLen = end - start;
     msg->dlgID.callIdHash =  strToHash(msg->call_id, length);
-    DebugFormat(DEBUG_SIP, "Call-Id length: %d, Hash: %u\n",
-        msg->callIdLen, msg->dlgID.callIdHash);
 
     return SIP_PARSE_SUCCESS;
 }
@@ -857,9 +808,6 @@ static int sip_parse_call_id(SIPMsg* msg, const char* start, const char* end, SI
  ********************************************************************/
 static int sip_parse_user_agent(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
-    DEBUG_WRAP(int length = end -start; )
-    DebugFormat(DEBUG_SIP, "User-Agent value: %.*s\n", length, start);
-
     msg->userAgent = start;
     msg->userAgentLen = end - start;
 
@@ -881,9 +829,6 @@ static int sip_parse_user_agent(SIPMsg* msg, const char* start, const char* end,
  ********************************************************************/
 static int sip_parse_server(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
-    DEBUG_WRAP(int length = end -start; )
-    DebugFormat(DEBUG_SIP, "Server value: %.*s\n", length, start);
-
     msg->server = start;
     msg->serverLen = end - start;
 
@@ -908,10 +853,8 @@ static int sip_parse_server(SIPMsg* msg, const char* start, const char* end, SIP
 static int sip_parse_cseq(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF* config)
 {
     char* next = nullptr;
-    DEBUG_WRAP(int length = end -start; )
     SIPMethodNode* method = nullptr;
 
-    DebugFormat(DEBUG_SIP, "CSeq value: %.*s\n", length, start);
     msg->cseqnum = SnortStrtoul(start, &next, 10);
     if ((nullptr != next )&&(next < end))
     {
@@ -919,8 +862,6 @@ static int sip_parse_cseq(SIPMsg* msg, const char* start, const char* end, SIP_P
         msg->cseqNameLen = end - msg->cseqName;
         method = SIP_FindMethod (config->methods, msg->cseqName, msg->cseqNameLen);
     }
-    DebugFormat(DEBUG_SIP, "CSeq number: %" PRIu64 ", CSeqName: %.*s\n",
-        msg->cseqnum, msg->cseqNameLen, msg->cseqName);
 
     if (nullptr == method)
     {
@@ -936,8 +877,6 @@ static int sip_parse_cseq(SIPMsg* msg, const char* start, const char* end, SIP_P
         {
             DetectionEngine::queue_event(GID_SIP, SIP_EVENT_MISMATCH_METHOD);
         }
-        DebugFormat(DEBUG_SIP, "Found the method: %s, Flag: 0x%x\n",
-            method->methodName, method->methodFlag);
     }
 
     return SIP_PARSE_SUCCESS;
@@ -961,10 +900,8 @@ static int sip_parse_cseq(SIPMsg* msg, const char* start, const char* end, SIP_P
 static int sip_parse_contact(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
     int length = end -start;
-    DebugFormat(DEBUG_SIP, "Contact value: %.*s\n", length, start);
     msg->contact = start;
     msg->contactLen = msg->contactLen + length;
-    DebugFormat(DEBUG_SIP, "Contact length: %d\n", msg->contactLen);
     return SIP_PARSE_SUCCESS;
 }
 
@@ -983,14 +920,8 @@ static int sip_parse_contact(SIPMsg* msg, const char* start, const char* end, SI
  ********************************************************************/
 
 static int sip_parse_authorization(
-    SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
+    SIPMsg* msg, const char* start, const char*, SIP_PROTO_CONF*)
 {
-#ifdef DEBUG_MSGS
-    DEBUG_WRAP(int length = end -start; )
-    DebugFormat(DEBUG_SIP, "Authorization value: %.*s\n", length, start);
-#else
-    UNUSED(end);
-#endif
     msg->authorization = start;
     return SIP_PARSE_SUCCESS;
 }
@@ -1011,8 +942,6 @@ static int sip_parse_authorization(
 
 static int sip_parse_content_type(SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
 {
-    DEBUG_WRAP(int length = end -start; )
-    DebugFormat(DEBUG_SIP, "Content type value: %.*s\n", length, start);
     msg->contentTypeLen = end - start;
     msg->content_type = start;
     return SIP_PARSE_SUCCESS;
@@ -1047,7 +976,6 @@ static int sip_parse_content_len(SIPMsg* msg, const char* start, const char*,
             DetectionEngine::queue_event(GID_SIP, SIP_EVENT_BAD_CONTENT_LEN);
         return SIP_PARSE_ERROR;
     }
-    DebugFormat(DEBUG_SIP, "Content length: %u\n", msg->content_len);
 
     return SIP_PARSE_SUCCESS;
 }
@@ -1067,14 +995,8 @@ static int sip_parse_content_len(SIPMsg* msg, const char* start, const char*,
  ********************************************************************/
 
 static int sip_parse_content_encode(
-    SIPMsg* msg, const char* start, const char* end, SIP_PROTO_CONF*)
+    SIPMsg* msg, const char* start, const char*, SIP_PROTO_CONF*)
 {
-#ifdef DEBUG_MSGS
-    DEBUG_WRAP(int length = end -start; )
-    DebugFormat(DEBUG_SIP, "Content encode value: %.*s\n", length, start);
-#else
-    UNUSED(end);
-#endif
     msg->content_encode = start;
     return SIP_PARSE_SUCCESS;
 }
@@ -1101,7 +1023,6 @@ static int sip_parse_sdp_o(SIPMsg* msg, const char* start, const char* end)
     if (nullptr == msg->mediaSession)
         return SIP_PARSE_ERROR;
     length = end - start;
-    DebugFormat(DEBUG_SIP, "Origination information: %.*s\n", length, start);
     // Get username and session ID information (before second space)
     spaceIndex = (char*)memchr(start, ' ', length);  // first space
     if ((nullptr == spaceIndex)||(spaceIndex == end))
@@ -1113,13 +1034,10 @@ static int sip_parse_sdp_o(SIPMsg* msg, const char* start, const char* end)
     if (nullptr == spaceIndex2)
         return SIP_PARSE_ERROR;
 
-    DebugFormat(DEBUG_SIP, "Session information: %.*s\n", static_cast<int>(spaceIndex - start), start);
-
     //sessionId uses all elements from o: line except sessionId version
     msg->mediaSession->sessionID =  strToHash(start, spaceIndex - start);
     msg->mediaSession->sessionID +=  strToHash(spaceIndex2+1, end - (spaceIndex2+1));
 
-    DebugFormat(DEBUG_SIP, "Session ID: %u\n", msg->mediaSession->sessionID);
     return SIP_PARSE_SUCCESS;
 }
 
@@ -1147,7 +1065,6 @@ static int sip_parse_sdp_c(SIPMsg* msg, const char* start, const char* end)
     if (nullptr == msg->mediaSession)
         return SIP_PARSE_ERROR;
     length = end - start;
-    DebugFormat(DEBUG_SIP, "Connection data: %.*s\n", length, start);
 
     /*Get the IP address*/
     spaceIndex = (char*)memchr(start, ' ', length);  // first space
@@ -1165,7 +1082,6 @@ static int sip_parse_sdp_c(SIPMsg* msg, const char* start, const char* end)
     }
     strncpy(ipStr, spaceIndex, length);
     ipStr[length] = '\0';
-    DebugFormat(DEBUG_SIP, "IP data: %s\n", ipStr);
 
     // If no default session connect information, add it
     if (nullptr == msg->mediaSession->medias)
@@ -1178,10 +1094,8 @@ static int sip_parse_sdp_c(SIPMsg* msg, const char* start, const char* end)
     }
     if ( ip->set(ipStr) != SFIP_SUCCESS)
     {
-        DebugMessage(DEBUG_SIP, "Parsed error! \n");
         return SIP_PARSE_ERROR;
     }
-    DebugFormat(DEBUG_SIP, "Parsed Connection data: %s\n", ip->ntoa());
 
     return SIP_PARSE_SUCCESS;
 }
@@ -1209,7 +1123,6 @@ static int sip_parse_sdp_m(SIPMsg* msg, const char* start, const char* end)
     if (nullptr == msg->mediaSession)
         return SIP_PARSE_ERROR;
     length = end - start;
-    DebugFormat(DEBUG_SIP, "Media information: %.*s\n", length, start);
 
     spaceIndex = (char*)memchr(start, ' ', length);  // first space
 
@@ -1225,8 +1138,7 @@ static int sip_parse_sdp_m(SIPMsg* msg, const char* start, const char* end)
     mdata->nextM = msg->mediaSession->medias;
     mdata->maddress = msg->mediaSession->maddress_default;
     msg->mediaSession->medias = mdata;
-    DebugFormat(DEBUG_SIP, "Media IP: %s, Media port %hu, number of media: %d\n",
-        mdata->maddress.ntoa(), mdata->mport, mdata->numPort);
+
     return SIP_PARSE_SUCCESS;
 }
 
@@ -1248,7 +1160,6 @@ bool sip_parse(SIPMsg* msg, const char* buff, const char* end, SIP_PROTO_CONF* c
 {
     const char* nextIndex;
     const char* start;
-    bool status;
 
     /*Initialize key values*/
     msg->methodFlag = SIP_METHOD_NULL;
@@ -1257,33 +1168,17 @@ bool sip_parse(SIPMsg* msg, const char* buff, const char* end, SIP_PROTO_CONF* c
     /*Parse the start line*/
     start = buff;
     nextIndex = nullptr;
-    DebugMessage(DEBUG_SIP, "Start parsing...\n");
 
     msg->header = (const uint8_t*)buff;
-    status = sip_startline_parse(msg, start, end, &nextIndex, config);
-
-    if ( !status )
-    {
-        DebugMessage(DEBUG_SIP, "Start line parsing failed...\n");
-        return status;
-    }
+    if (!sip_startline_parse(msg, start, end, &nextIndex, config))
+        return false;
 
     /*Parse the headers*/
     start = nextIndex;
-    status = sip_headers_parse(msg, start, end, &nextIndex, config);
+    sip_headers_parse(msg, start, end, &nextIndex, config);
     msg->headerLen =  nextIndex - buff;
 
-    if ( !status )
-    {
-        DebugMessage(DEBUG_SIP, "Header parsing failed...\n");
-    }
-
-    status = sip_check_headers(msg, config);
-
-    if ( !status )
-    {
-        DebugMessage(DEBUG_SIP, "Headers validation failed...\n");
-    }
+    sip_check_headers(msg, config);
 
     /*Parse the body*/
     start = nextIndex;
@@ -1293,12 +1188,7 @@ bool sip_parse(SIPMsg* msg, const char* buff, const char* end, SIP_PROTO_CONF* c
     if ((!msg->isTcp)&&(msg->content_len > bodyLen))
         DetectionEngine::queue_event(GID_SIP, SIP_EVENT_MISMATCH_CONTENT_LEN);
 
-    status = sip_body_parse(msg, start, start + msg->content_len, &nextIndex);
-
-    if ( !status )
-    {
-        DebugMessage(DEBUG_SIP, "Headers validation failed...\n");
-    }
+    bool status = sip_body_parse(msg, start, start + msg->content_len, &nextIndex);
 
     // Find out whether multiple SIP messages in this packet
     /*Disable this check for TCP. Revisit this again when PAF enabled for SIP*/
@@ -1360,8 +1250,6 @@ void sip_freeMediaSession(SIP_MediaSession* mediaSession)
 
     while (nullptr != curNode)
     {
-        DebugFormat(DEBUG_SIP, "Clear media ip: %s, port: %d, number of port: %d\n",
-            curNode->maddress.ntoa(), curNode->mport, curNode->numPort);
         nextNode = curNode->nextM;
         snort_free(curNode);
         curNode = nextNode;
@@ -1389,8 +1277,6 @@ void sip_freeMediaList(SIP_MediaList medias)
 
     while (nullptr != curNode)
     {
-        DebugFormat(DEBUG_SIP, "Clean Media session default IP: %s,  session ID: %u\n",
-            curNode->maddress_default.ntoa(), curNode->sessionID);
         nextNode = curNode->nextS;
         sip_freeMediaSession(curNode);
         curNode = nextNode;
index e1f728132f116fce56024d4f974822cfaa02a2f6..668c9edd8676d0a40f664687feb0a1ea395b1124 100644 (file)
@@ -26,7 +26,6 @@
 #include "detection/detection_util.h"
 #include "log/messages.h"
 #include "log/unified2.h"
-#include "main/snort_debug.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/ssl.h"
@@ -218,8 +217,6 @@ static SMTPData* SetNewSMTPData(SMTP_PROTO_CONF* config, Packet* p)
 
     if(Stream::is_midstream(p->flow))
     {
-        DebugMessage(DEBUG_SMTP, "Got midstream packet - "
-            "setting state to unknown\n");
         smtp_ssn->state = STATE_UNKNOWN;
     }
 
@@ -546,16 +543,12 @@ static int SMTP_Setup(Packet* p, SMTPData* ssn)
 
         if (ssn->session_flags & SMTP_FLAG_NEXT_STATE_UNKNOWN)
         {
-            DebugMessage(DEBUG_SMTP, "Found gap in previous reassembly buffer - "
-                "set state to unknown\n");
             ssn->state = STATE_UNKNOWN;
             ssn->session_flags &= ~SMTP_FLAG_NEXT_STATE_UNKNOWN;
         }
 
         if (missing_in_rebuilt == SSN_MISSING_BEFORE)
         {
-            DebugMessage(DEBUG_SMTP, "Found missing packets before "
-                "in reassembly buffer - set state to unknown\n");
             ssn->state = STATE_UNKNOWN;
         }
     }
@@ -719,29 +712,16 @@ static const uint8_t* SMTP_HandleCommand(SMTP_PROTO_CONF* config, Packet* p, SMT
          * state.  Check to see if we're encrypted */
         if (smtp_ssn->state == STATE_UNKNOWN)
         {
-            DebugMessage(DEBUG_SMTP, "Command not found, but state is "
-                "unknown - checking for SSL\n");
-
             /* check for encrypted */
 
             if ((smtp_ssn->session_flags & SMTP_FLAG_CHECK_SSL) &&
                 (IsSSL(ptr, end - ptr, p->packet_flags)))
             {
-                DebugMessage(DEBUG_SMTP, "Packet is SSL encrypted\n");
-
                 smtp_ssn->state = STATE_TLS_DATA;
-
-                /* Ignore data */
-                if (config->ignore_tls_data)
-                {
-                    DebugMessage(DEBUG_SMTP, "Ignoring encrypted data\n");
-                }
-
                 return end;
             }
             else
             {
-                DebugMessage(DEBUG_SMTP, "Not SSL - try data state\n");
                 /* don't check for ssl again in this packet */
                 if (smtp_ssn->session_flags & SMTP_FLAG_CHECK_SSL)
                     smtp_ssn->session_flags &= ~SMTP_FLAG_CHECK_SSL;
@@ -754,8 +734,6 @@ static const uint8_t* SMTP_HandleCommand(SMTP_PROTO_CONF* config, Packet* p, SMT
         }
         else
         {
-            DebugMessage(DEBUG_SMTP, "No known command found\n");
-
             if (smtp_ssn->state != STATE_AUTH)
             {
                 DetectionEngine::queue_event(GID_SMTP,SMTP_UNKNOWN_CMD);
@@ -871,16 +849,9 @@ static const uint8_t* SMTP_HandleCommand(SMTP_PROTO_CONF* config, Packet* p, SMT
             if ((smtp_ssn->state_flags & SMTP_FLAG_GOT_RCPT_CMD) ||
                 smtp_ssn->state == STATE_UNKNOWN)
             {
-                DebugMessage(DEBUG_SMTP, "Set to data state.\n");
-
                 smtp_ssn->state = STATE_DATA;
                 smtp_ssn->state_flags &= ~(SMTP_FLAG_GOT_MAIL_CMD | SMTP_FLAG_GOT_RCPT_CMD);
             }
-            else
-            {
-                DebugMessage(DEBUG_SMTP, "Didn't get MAIL -> RCPT command sequence - "
-                    "stay in command state.\n");
-            }
 
             break;
 
@@ -1020,12 +991,10 @@ static void SMTP_ProcessClientPacket(SMTP_PROTO_CONF* config, Packet* p, SMTPDat
         switch (smtp_ssn->state)
         {
         case STATE_COMMAND:
-            DebugMessage(DEBUG_SMTP, "COMMAND STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
             ptr = SMTP_HandleCommand(config, p, smtp_ssn, ptr, end);
             break;
         case STATE_DATA:
         case STATE_BDATA:
-            DebugMessage(DEBUG_SMTP, "DATA STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
             position = get_file_position(p);
             ptr = smtp_ssn->mime_ssn->process_mime_data(p->flow, ptr, len, true, position);
             //ptr = SMTP_HandleData(p, ptr, end, &(smtp_ssn->mime_ssn));
@@ -1040,13 +1009,11 @@ static void SMTP_ProcessClientPacket(SMTP_PROTO_CONF* config, Packet* p, SMTPDat
             ptr = SMTP_HandleCommand(config, p, smtp_ssn, ptr, end);
             break;
         case STATE_UNKNOWN:
-            DebugMessage(DEBUG_SMTP, "UNKNOWN STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
             /* If state is unknown try command state to see if we can
              * regain our bearings */
             ptr = SMTP_HandleCommand(config, p, smtp_ssn, ptr, end);
             break;
         default:
-            DebugMessage(DEBUG_SMTP, "Bad SMTP state\n");
             return;
         }
     }
@@ -1135,36 +1102,13 @@ static void SMTP_ProcessServerPacket(
                 }
                 break;
             }
-
-#ifdef DEBUG_MSGS
-            const uint8_t* dash = ptr + smtp_search_info.index + smtp_search_info.length;
-
-            /* only add response if not a dash after response code */
-            if ((dash == eolm) || ((dash < eolm) && (*dash != '-')))
-            {
-                DebugFormat(DEBUG_SMTP, "Server sent %s response\n",
-                    smtp_resps[smtp_search_info.id].name);
-            }
-#endif
         }
         else
         {
-            DebugMessage(DEBUG_SMTP,
-                "Server response not found - see if it's SSL data\n");
-
             if ((smtp_ssn->session_flags & SMTP_FLAG_CHECK_SSL) &&
                 (IsSSL(ptr, end - ptr, p->packet_flags)))
             {
-                DebugMessage(DEBUG_SMTP, "Server response is an SSL packet\n");
-
                 smtp_ssn->state = STATE_TLS_DATA;
-
-                /* Ignore data */
-                if (config->ignore_tls_data)
-                {
-                    DebugMessage(DEBUG_SMTP, "Ignoring Server TLS encrypted data\n");
-                }
-
                 return;
             }
             else if (smtp_ssn->session_flags & SMTP_FLAG_CHECK_SSL)
@@ -1222,8 +1166,6 @@ static void snort_smtp(SMTP_PROTO_CONF* config, Packet* p)
     {
         int next_state = 0;
 
-        DebugMessage(DEBUG_SMTP, "SMTP server packet\n");
-
         /* Process as a server packet */
         SMTP_ProcessServerPacket(config, p, smtp_ssn, &next_state);
 
@@ -1232,26 +1174,11 @@ static void snort_smtp(SMTP_PROTO_CONF* config, Packet* p)
     }
     else
     {
-#ifdef DEBUG_MSGS
-        if (pkt_dir == SMTP_PKT_FROM_CLIENT)
-        {
-            DebugMessage(DEBUG_SMTP, "SMTP client packet\n");
-        }
-        else
-        {
-            DebugMessage(DEBUG_SMTP, "SMTP packet NOT from client or server! "
-                "Processing as a client packet\n");
-        }
-#endif
-
         /* This packet should be a tls client hello */
         if (smtp_ssn->state == STATE_TLS_CLIENT_PEND)
         {
             if (IsTlsClientHello(p->data, p->data + p->dsize))
             {
-                DebugMessage(DEBUG_SMTP,
-                    "TLS DATA STATE ~~~~~~~~~~~~~~~~~~~~~~~~~\n");
-
                 smtp_ssn->state = STATE_TLS_SERVER_PEND;
             }
             else if (p->packet_flags & PKT_STREAM_ORDER_OK)
@@ -1276,7 +1203,6 @@ static void snort_smtp(SMTP_PROTO_CONF* config, Packet* p)
             if ( !InspectPacket(p))
             {
                 /* Packet will be rebuilt, so wait for it */
-                DebugMessage(DEBUG_SMTP, "Client packet will be reassembled\n");
                 return;
             }
             else if (!(p->packet_flags & PKT_REBUILT_STREAM))
@@ -1296,9 +1222,6 @@ static void snort_smtp(SMTP_PROTO_CONF* config, Packet* p)
                  * that were not rebuilt, state is going to be messed up
                  * so set state to unknown. It's likely this was the
                  * beginning of the conversation so reset state */
-                DebugMessage(DEBUG_SMTP, "Got non-rebuilt packets before "
-                    "this rebuilt packet\n");
-
                 smtp_ssn->state = STATE_UNKNOWN;
                 smtp_ssn->session_flags &= ~SMTP_FLAG_GOT_NON_REBUILT;
             }
index e73a1c4111611c4ee48d29e79f8d3778d74b1392..cf325890e1d2bfc4efbca37121daaf632508e563 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "detection/detection_engine.h"
 #include "events/event_queue.h"
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 #include "stream/stream.h"
 
@@ -95,7 +94,6 @@ static inline StreamSplitter::Status smtp_paf_server(SmtpPafData* pfdata,
 
     if (pch != nullptr)
     {
-        DebugMessage(DEBUG_SMTP, "Find end of line!\n");
         *fp = (uint32_t)(pch - (const char*)data) + 1;
         return StreamSplitter::FLUSH;
     }
@@ -235,8 +233,6 @@ static inline bool process_command(SmtpPafData* pfdata,  uint8_t val)
         /* Continue finding the data length ...*/
         if (get_length(val, &pfdata->length) != SMTP_PAF_LENGTH_CONTINUE)
         {
-            DebugFormat(DEBUG_SMTP, "Find data length: %u\n",
-                pfdata->length);
             pfdata->cmd_info.cmd_state = SMTP_PAF_CMD_DATA_END_STATE;
         }
         break;
@@ -269,7 +265,6 @@ static inline bool process_data(SmtpPafData* pfdata,  uint8_t data)
 {
     if (flush_based_length(pfdata)|| check_data_end(&(pfdata->data_end_state), data))
     {
-        DebugMessage(DEBUG_SMTP, "End of data\n");
         /*Clean up states*/
         pfdata->smtp_state = SMTP_PAF_CMD_STATE;
         pfdata->end_of_data = true;
@@ -291,7 +286,6 @@ static inline StreamSplitter::Status smtp_paf_client(SmtpPafData* pfdata,
     uint32_t boundary_start = 0;
     bool alert_generated = false;
 
-    DebugFormat(DEBUG_SMTP, "From client: %s \n", data);
     for (i = 0; i < len; i++)
     {
         uint8_t ch = data[i];
@@ -300,7 +294,6 @@ static inline StreamSplitter::Status smtp_paf_client(SmtpPafData* pfdata,
         case SMTP_PAF_CMD_STATE:
             if (process_command(pfdata, ch))
             {
-                DebugFormat(DEBUG_SMTP, "Flush command: %s \n", data);
                 *fp = i + 1;
                 return StreamSplitter::FLUSH;
             }
@@ -326,7 +319,6 @@ static inline StreamSplitter::Status smtp_paf_client(SmtpPafData* pfdata,
             }
             else if (process_data(pfdata, ch))
             {
-                DebugMessage(DEBUG_SMTP, "Flush data!\n");
                 *fp = i + 1;
                 return StreamSplitter::FLUSH;
             }
@@ -385,12 +377,10 @@ StreamSplitter::Status SmtpSplitter::scan(
 
     if (flags & PKT_FROM_SERVER)
     {
-        DebugMessage(DEBUG_SMTP, "PAF: From server.\n");
         return smtp_paf_server(pfdata, data, len, fp);
     }
     else
     {
-        DebugMessage(DEBUG_SMTP, "PAF: From client.\n");
         return smtp_paf_client(pfdata, data, len, fp, max_auth_command_line_len);
     }
 }