diff --git a/libclamav/htmlnorm.c b/libclamav/htmlnorm.c
index 1a3aa10ab..a705e9720 100644
--- a/libclamav/htmlnorm.c
+++ b/libclamav/htmlnorm.c
@@ -49,10 +49,12 @@
#include "others.h"
#include "htmlnorm.h"
-#ifdef CL_EXPERIMENTAL
-#include "mbox.h"
+typedef enum {
+ INVALIDCLASS, BLOBCLASS
+} object_type;
+#include "blob.h"
+
#include "entconv.h"
-#endif
#define HTML_STR_LENGTH 1024
#define MAX_TAG_CONTENTS_LENGTH HTML_STR_LENGTH
@@ -62,9 +64,7 @@ typedef enum {
HTML_NORM,
HTML_COMMENT,
HTML_CHAR_REF,
-#ifdef CL_EXPERIMENTAL
HTML_ENTITY_REF_DECODE,
-#endif
HTML_SKIP_WS,
HTML_TRIM_WS,
HTML_TAG,
@@ -313,7 +313,6 @@ static void html_tag_arg_add(tag_arguments_t *tags,
if (!tags->value) {
goto abort;
}
-#ifdef CL_EXPERIMENTAL
if(tags->scanContents) {
tags->contents= (blob **) cli_realloc(tags->contents,
tags->count*sizeof(*tags->contents));
@@ -322,7 +321,6 @@ static void html_tag_arg_add(tag_arguments_t *tags,
}
tags->contents[tags->count-1]=NULL;
}
-#endif
tags->tag[tags->count-1] = cli_strdup(tag);
if (value) {
if (*value == '"') {
@@ -349,12 +347,10 @@ abort:
if (tags->value) {
free(tags->value[i]);
}
-#ifdef CL_EXPERIMENTAL
if(tags->contents) {
if(tags->contents[i])
blobDestroy(tags->contents[i]);
}
-#endif
}
if (tags->tag) {
free(tags->tag);
@@ -362,11 +358,9 @@ abort:
if (tags->value) {
free(tags->value);
}
-#ifdef CL_EXPERIMENTAL
if (tags->contents)
free(tags->contents);
tags->contents=NULL;
-#endif
tags->tag = tags->value = NULL;
tags->count = 0;
return;
@@ -402,11 +396,9 @@ void html_tag_arg_free(tag_arguments_t *tags)
if (tags->value[i]) {
free(tags->value[i]);
}
-#ifdef CL_EXPERIMENTAL
if(tags->contents)
if (tags->contents[i])
blobDestroy(tags->contents[i]);
-#endif
}
if (tags->tag) {
free(tags->tag);
@@ -414,16 +406,13 @@ void html_tag_arg_free(tag_arguments_t *tags)
if (tags->value) {
free(tags->value);
}
-#ifdef CL_EXPERIMENTAL
if(tags->contents)
free(tags->contents);
tags->contents = NULL;
-#endif
tags->tag = tags->value = NULL;
tags->count = 0;
}
-#ifdef CL_EXPERIMENTAL
/**
* this is used for img, and iframe tags. If they are inside an tag, then set the contents of the image|iframe to the real URL.
*/
@@ -460,9 +449,9 @@ static inline void html_tag_contents_length_check(tag_arguments_t *tags,int* idx
*idx=0;/*in_ahref=0;*/
}
}
-#endif
-static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag_arguments_t *hrefs)
+
+static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag_arguments_t *hrefs,const struct cli_dconf* dconf)
{
int fd_tmp, tag_length, tag_arg_length, binary;
int retval=FALSE, escape, value = 0, hex, tag_val_length=0, table_pos, in_script=FALSE;
@@ -476,21 +465,20 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
unsigned long length;
file_buff_t *file_buff_o1, *file_buff_o2, *file_buff_script;
file_buff_t *file_tmp_o1;
-#ifdef CL_EXPERIMENTAL
int in_ahref=0;/* index of tag, whose contents we are parsing. Indexing starts from 1, 0 means outside of */
unsigned char* href_contents_begin=NULL;/*beginning of the next portion of contents*/
unsigned char* ptrend=NULL;/*end of contents*/
unsigned char* in_form_action = NULL;/* the action URL of the current