ClamAV-Clamd

 view release on metacpan or  search on metacpan

Clamd.xs  view on Meta::CPAN

                       "larger than max_size; refused without scanning", NULL);
            sc->rc = CC_ERR_TOOBIGLOC; sc->phase = CC_PH_DONE;
            goto made;
        }
        (void)cc_scan_start(sc, &t, CC_TRANSPORT_INSTREAM, -1, 0, dp, (size_t)dlen, -1);
    }

  made:
    h = newHV();
    (void)hv_stores(h, "_ptr", newSViv(PTR2IV(sc)));
    /* Hold the source alive for as long as the scan can read it. */
    if (keep) (void)hv_stores(h, "_keep", newSVsv(keep));
    RETVAL = sv_bless(newRV_noinc((SV *)h),
                      gv_stashpvs("ClamAV::Clamd::Scan", GV_ADD));
  OUTPUT:
    RETVAL

MODULE = ClamAV::Clamd    PACKAGE = ClamAV::Clamd::Scan    PREFIX = ccs_

PROTOTYPES: DISABLE

include/clamav/clamd_abi_impl.h  view on Meta::CPAN

 * functions. Not installed: a consumer vendors clamd_abi.h and never
 * sees this.
 */
#ifndef CLAMD_ABI_IMPL_H
#define CLAMD_ABI_IMPL_H

#include "clamav/clamd_abi.h"

/* A target is a cc_target plus the storage its char pointers reference.
 * cc_target borrows them, and an ABI consumer's strings are not this
 * dist's to keep alive. */
typedef struct {
    cc_target t;
    char     *path;
    char     *host;
} cca_target;

static void *cca_target_new(pTHX_ const char *socket_path,
                            const char *host, int port) {
    cca_target *g;

t/70-async.t  view on Meta::CPAN

        $c->start_scan('harmless bytes'),
    );
    drive(@scans);

    is $scans[0]->verdict->state, 'infected', 'interleaved scan 1: infected';
    is $scans[1]->verdict->state, 'clean',    'interleaved scan 2: clean';
    is $scans[2]->verdict->state, 'infected', 'interleaved scan 3: infected';
    is $scans[3]->verdict->state, 'clean',    'interleaved scan 4: clean';
}

# --- a filehandle scan holds its source alive ---------------------------
# The handle keeps a reference, because the scan outlives the call that
# started it and reading a freed PV is not a bug that shows up locally.
{
    my $s = do {
        open my $fh, '<:raw', $eicar or die $!;
        $c->start_scan($fh, 'fd');
    };                                   # $fh out of scope, scan still live
    drive($s);
    is $s->verdict->state, 'infected', 'a scan outlives the handle it was given';
}



( run in 1.493 second using v1.01-cache-2.11-cpan-14f38c9f855 )