@ -46,9 +46,7 @@
# endif
# endif
# if HAVE_LIBXML2
# include <libxml/xmlreader.h>
# endif
# include "clamav.h"
# include "others.h"
@ -85,9 +83,7 @@ enum dmgReadState {
} ;
static int dmg_extract_xml ( cli_ctx * , char * , struct dmg_koly_block * ) ;
# if HAVE_LIBXML2
static int dmg_decode_mish ( cli_ctx * , unsigned int * , xmlChar * , struct dmg_mish_with_stripes * ) ;
# endif
static int cmp_mish_stripes ( const void * stripe_a , const void * stripe_b ) ;
static int dmg_track_sectors ( uint64_t * , uint8_t * , uint32_t , uint32_t , uint64_t ) ;
static int dmg_handle_mish ( cli_ctx * , unsigned int , char * , uint64_t , struct dmg_mish_with_stripes * ) ;
@ -104,9 +100,7 @@ int cli_scandmg(cli_ctx *ctx)
struct dmg_mish_with_stripes * mish_list = NULL , * mish_list_tail = NULL ;
enum dmgReadState state = DMG_FIND_BASE_PLIST ;
int stateDepth [ DMG_MAX_STATE ] ;
# if HAVE_LIBXML2
xmlTextReaderPtr reader ;
# endif
if ( ! ctx | | ! ctx - > fmap ) {
cli_errmsg ( " cli_scandmg: Invalid context \n " ) ;
@ -204,9 +198,6 @@ int cli_scandmg(cli_ctx *ctx)
/* each of those bottom level dict should have 4 parts */
/* [ Attributes, Data, ID, Name ], where Data is Base64 mish block */
/* This is the block where we require libxml2 */
# if HAVE_LIBXML2
# define DMG_XML_PARSE_OPTS ((XML_PARSE_NONET | XML_PARSE_COMPACT) | CLAMAV_MIN_XMLREADER_FLAGS)
reader = xmlReaderForMemory ( outdata , ( int ) hdr . xmlLength , " toc.xml " , NULL , DMG_XML_PARSE_OPTS ) ;
@ -434,12 +425,6 @@ int cli_scandmg(cli_ctx *ctx)
xmlFreeTextReader ( reader ) ;
# else
cli_dbgmsg ( " cli_scandmg: libxml2 support is compiled out. It is required for full DMG support. \n " ) ;
# endif
/* Loop over mish array */
file = 0 ;
while ( ( ret = = CL_CLEAN ) & & ( mish_list ! = NULL ) ) {
@ -465,7 +450,6 @@ int cli_scandmg(cli_ctx *ctx)
return ret ;
}
# if HAVE_LIBXML2
/* Transform the base64-encoded string into the binary structure
* After this , the base64 string ( from xml ) can be released
* If mish_set - > mish is set by this function , it must be freed by the caller */
@ -535,7 +519,6 @@ static int dmg_decode_mish(cli_ctx *ctx, unsigned int *mishblocknum, xmlChar *mi
mish_set - > stripes = ( struct dmg_block_data * ) ( decoded + sizeof ( struct dmg_mish_block ) ) ;
return CL_CLEAN ;
}
# endif
/* Comparator for stripe sorting */
static int cmp_mish_stripes ( const void * stripe_a , const void * stripe_b )