... | ... |
@@ -1575,72 +1575,6 @@ static int cli_scantar(cli_ctx *ctx, unsigned int posix) |
1575 | 1575 |
return ret; |
1576 | 1576 |
} |
1577 | 1577 |
|
1578 |
-static int cli_scanmschm(cli_ctx *ctx) |
|
1579 |
-{ |
|
1580 |
- int ret = CL_CLEAN, rc; |
|
1581 |
- chm_metadata_t metadata; |
|
1582 |
- char *dir; |
|
1583 |
- unsigned int viruses_found = 0; |
|
1584 |
- |
|
1585 |
- cli_dbgmsg("in cli_scanmschm()\n"); |
|
1586 |
- |
|
1587 |
- /* generate the temporary directory */ |
|
1588 |
- if(!(dir = cli_gentemp(ctx->engine->tmpdir))) |
|
1589 |
- return CL_EMEM; |
|
1590 |
- |
|
1591 |
- if(mkdir(dir, 0700)) { |
|
1592 |
- cli_dbgmsg("CHM: Can't create temporary directory %s\n", dir); |
|
1593 |
- free(dir); |
|
1594 |
- return CL_ETMPDIR; |
|
1595 |
- } |
|
1596 |
- |
|
1597 |
- ret = cli_chm_open(dir, &metadata, ctx); |
|
1598 |
- if (ret != CL_SUCCESS) { |
|
1599 |
- if(!ctx->engine->keeptmp) |
|
1600 |
- cli_rmdirs(dir); |
|
1601 |
- free(dir); |
|
1602 |
- cli_dbgmsg("CHM: Error: %s\n", cl_strerror(ret)); |
|
1603 |
- return ret; |
|
1604 |
- } |
|
1605 |
- |
|
1606 |
- do { |
|
1607 |
- ret = cli_chm_prepare_file(&metadata); |
|
1608 |
- if (ret != CL_SUCCESS) { |
|
1609 |
- break; |
|
1610 |
- } |
|
1611 |
- ret = cli_chm_extract_file(dir, &metadata, ctx); |
|
1612 |
- if (ret == CL_SUCCESS) { |
|
1613 |
- rc = cli_magic_scandesc(metadata.ofd, ctx); |
|
1614 |
- close(metadata.ofd); |
|
1615 |
- if (rc == CL_VIRUS) { |
|
1616 |
- cli_dbgmsg("CHM: infected with %s\n", cli_get_last_virus(ctx)); |
|
1617 |
- if (SCAN_ALL) |
|
1618 |
- viruses_found++; |
|
1619 |
- else { |
|
1620 |
- ret = CL_VIRUS; |
|
1621 |
- break; |
|
1622 |
- } |
|
1623 |
- } |
|
1624 |
- } |
|
1625 |
- |
|
1626 |
- } while(ret == CL_SUCCESS); |
|
1627 |
- |
|
1628 |
- cli_chm_close(&metadata); |
|
1629 |
- |
|
1630 |
- if(!ctx->engine->keeptmp) |
|
1631 |
- cli_rmdirs(dir); |
|
1632 |
- |
|
1633 |
- free(dir); |
|
1634 |
- |
|
1635 |
- cli_dbgmsg("CHM: Exit code: %d\n", ret); |
|
1636 |
- if (ret == CL_BREAK) |
|
1637 |
- ret = CL_CLEAN; |
|
1638 |
- |
|
1639 |
- if (viruses_found) |
|
1640 |
- return CL_VIRUS; |
|
1641 |
- return ret; |
|
1642 |
-} |
|
1643 |
- |
|
1644 | 1578 |
static int cli_scanscrenc(cli_ctx *ctx) |
1645 | 1579 |
{ |
1646 | 1580 |
char *tempname; |