~yolanda.robla/ubuntu/saucy/clamav/dep-8-tests

« back to all changes in this revision

Viewing changes to libclamav/scanners.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2009-11-02 23:27:19 UTC
  • mfrom: (0.35.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091102232719-61ay35095dhbuxfm
Tags: 0.95.3+dfsg-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Build-dep on libltdl3-dev instead of libltdl-dev for updating earlier
    releases more easily
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
413
413
        return ret;
414
414
    }
415
415
    
416
 
   metadata.filename = NULL;
417
 
 
418
416
   do {
 
417
        metadata.filename = NULL;
419
418
        ret = cli_unarj_prepare_file(desc, dir, &metadata);
420
419
        if (ret != CL_SUCCESS) {
421
420
           break;
422
421
        }
423
422
        if ((ret = cli_checklimits("ARJ", ctx, metadata.orig_size, metadata.comp_size, 0))!=CL_CLEAN) {
424
423
            ret = CL_SUCCESS;
 
424
            if (metadata.filename)
 
425
                free(metadata.filename);
425
426
            continue;
426
427
        }
427
428
        ret = cli_unarj_extract_file(desc, dir, &metadata);
432
433
            if (rc == CL_VIRUS) {
433
434
                cli_dbgmsg("ARJ: infected with %s\n",*ctx->virname);
434
435
                ret = CL_VIRUS;
 
436
                if (metadata.filename) {
 
437
                    free(metadata.filename);
 
438
                    metadata.filename = NULL;
 
439
                }
435
440
                break;
436
441
            }
437
442
        }
1081
1086
                        /* when we flush the buffer also scan */
1082
1087
                        if(cli_scanbuff(state.out, state.out_pos, offset, ctx, CL_TYPE_TEXT_ASCII, mdata) == CL_VIRUS) {
1083
1088
                                ret = CL_VIRUS;
 
1089
                                if(ofd != -1)
 
1090
                                    ret = cli_checkfp(ofd, ctx) ? CL_CLEAN : CL_VIRUS;
1084
1091
                                break;
1085
1092
                        }
1086
1093
                        if(ctx->scanned)
1135
1142
            if(write(fd, decoded, strlen(decoded)) == -1) {
1136
1143
                cli_errmsg("cli_scanhtml_utf16: Can't write to file %s\n", tempname);
1137
1144
                free(decoded);
 
1145
                close(fd);
1138
1146
                cli_unlink(tempname);
1139
1147
                free(tempname);
1140
 
                close(fd);
1141
1148
                return CL_EWRITE;
1142
1149
            }
1143
1150
            free(decoded);
1750
1757
                if(fpt->offset) switch(fpt->type) {
1751
1758
                    case CL_TYPE_RARSFX:
1752
1759
                            cli_dbgmsg("RAR/RAR-SFX signature found at %u\n", (unsigned int) fpt->offset);
1753
 
                        if(type != CL_TYPE_RAR && have_rar && SCAN_ARCHIVE && fpt->offset < 102400 && (DCONF_ARCH & ARCH_CONF_RAR)) {
 
1760
                        if(type != CL_TYPE_RAR && have_rar && SCAN_ARCHIVE && (DCONF_ARCH & ARCH_CONF_RAR)) {
1754
1761
                            cli_dbgmsg("RAR/RAR-SFX signature found at %u\n", (unsigned int) fpt->offset);
1755
1762
                            nret = cli_scanrar(desc, ctx, fpt->offset, &lastrar);
1756
1763
                        }
1757
1764
                        break;
1758
1765
 
1759
1766
                    case CL_TYPE_ZIPSFX:
1760
 
                        if(type != CL_TYPE_ZIP && SCAN_ARCHIVE && fpt->offset < 102400 && (DCONF_ARCH & ARCH_CONF_ZIP)) {
 
1767
                        if(type != CL_TYPE_ZIP && SCAN_ARCHIVE && (DCONF_ARCH & ARCH_CONF_ZIP)) {
1761
1768
                            cli_dbgmsg("ZIP/ZIP-SFX signature found at %u\n", (unsigned int) fpt->offset);
1762
1769
                            nret = cli_unzip_single(desc, ctx, fpt->offset);
1763
1770
                        }
1764
1771
                        break;
1765
1772
 
1766
1773
                    case CL_TYPE_CABSFX:
1767
 
                        if(type != CL_TYPE_MSCAB && SCAN_ARCHIVE && fpt->offset < 102400 && (DCONF_ARCH & ARCH_CONF_CAB)) {
 
1774
                        if(type != CL_TYPE_MSCAB && SCAN_ARCHIVE && (DCONF_ARCH & ARCH_CONF_CAB)) {
1768
1775
                            cli_dbgmsg("CAB/CAB-SFX signature found at %u\n", (unsigned int) fpt->offset);
1769
1776
                            nret = cli_scanmscab(desc, ctx, fpt->offset);
1770
1777
                        }
1771
1778
                        break;
1772
1779
                    case CL_TYPE_ARJSFX:
1773
 
                        if(type != CL_TYPE_ARJ && SCAN_ARCHIVE && fpt->offset < 102400 && (DCONF_ARCH & ARCH_CONF_ARJ)) {
 
1780
                        if(type != CL_TYPE_ARJ && SCAN_ARCHIVE && (DCONF_ARCH & ARCH_CONF_ARJ)) {
1774
1781
                            cli_dbgmsg("ARJ-SFX signature found at %u\n", (unsigned int) fpt->offset);
1775
1782
                            nret = cli_scanarj(desc, ctx, fpt->offset, &lastrar);
1776
1783
                        }