]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode-mime: add function to get status
authorEric Leblond <eric@regit.org>
Wed, 29 Apr 2015 16:24:09 +0000 (18:24 +0200)
committerEric Leblond <eric@regit.org>
Fri, 2 Oct 2015 20:57:58 +0000 (22:57 +0200)
This new function return the textual status of MIME parsing.

src/util-decode-mime.c
src/util-decode-mime.h

index 312a9af493ae1a2c0ac43ceaf9e40f5a6aff6d70..718cdeb64b05e0990c5097dccf6599fa94b7ac9d 100644 (file)
@@ -81,7 +81,6 @@
 /* Globally hold configuration data */
 static MimeDecConfig mime_dec_config = { 1, 1, 1, 0, MAX_HEADER_VALUE };
 
-#ifdef DEBUG
 /* Mime Parser String translation */
 static const char *StateFlags[] = { "NONE",
         "HEADER_READY",
@@ -93,7 +92,6 @@ static const char *StateFlags[] = { "NONE",
         "PARSE_DONE",
         "PARSE_ERROR",
         NULL };
-#endif
 
 /* URL executable file extensions */
 static const char *UrlExeExts[] = { ".exe",
@@ -2265,6 +2263,11 @@ static int ProcessMimeBody(const uint8_t *buf, uint32_t len,
     return ret;
 }
 
+const char *MimeDecParseStateGetStatus(MimeDecParseState *state)
+{
+    return StateFlags[state->state_flag];
+}
+
 /**
  * \brief Processes the MIME Entity based on the input line and current state of
  * the parser
index 020a1f16657bb28abf14d6c74ea7f98e813da10b..50d67a92a35ec6da718df2569b4db8b06ac43ce0 100644 (file)
@@ -238,6 +238,7 @@ int MimeDecParseComplete(MimeDecParseState *state);
 int MimeDecParseLine(const uint8_t *line, const uint32_t len, MimeDecParseState *state);
 MimeDecEntity * MimeDecParseFullMsg(const uint8_t *buf, uint32_t blen, void *data,
         int (*DataChunkProcessorFunc)(const uint8_t *chunk, uint32_t len, MimeDecParseState *state));
+const char *MimeDecParseStateGetStatus(MimeDecParseState *state);
 
 /* Test functions */
 void MimeDecRegisterTests(void);