~ubuntu-branches/ubuntu/jaunty/clamav/jaunty-backports

« back to all changes in this revision

Viewing changes to clamdscan/proto.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-05-20 22:09:21 UTC
  • mfrom: (1.44.1 upstream) (10.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20100520220921-flsp1pbntitvwc59
Tags: 0.96.1+dfsg-0ubuntu1
* New upstream release
  - Remove non-free libclamunrar directory and repack +dfsg tarball
  - Remove win32/ for size reasons since the tarball is repacked already and
    adjust Makefile.in/am
  - Add support for new TestDatabases option in debian/clamav-
    freshclam.postinst.in (match upstream default of yes)
  - Add VirusAction option to debian/clamav-milter.postinst.in
  - Drop powerpc clamd fix, incorporated upstream
  - Drop diff in docs/man/clamd.conf.5.in, incorporated upstream
  - Drop addition of COPYING.llvm, incorporated upstream
* Remaining differences from Debian:
  - Drop initial signature definitions from clamav-base
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Detect incorrect value for clamav-freshclam/NotifyClamd and set it to true

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#include "libclamav/others.h"
47
47
#include "shared/actions.h"
48
48
#include "shared/output.h"
 
49
#include "shared/misc.h"
49
50
 
50
51
#include "proto.h"
51
52
#include "client.h"
54
55
extern int mainsasz;
55
56
extern unsigned long int maxstream;
56
57
int printinfected;
 
58
extern struct optstruct *clamdopts;
57
59
 
58
60
static const char *scancmd[] = { "CONTSCAN", "MULTISCAN" };
59
61
 
244
246
}
245
247
#endif
246
248
 
 
249
/* 0: scan, 1: skip */
 
250
static int chkpath(const char *path)
 
251
{
 
252
        const struct optstruct *opt;
 
253
 
 
254
   if((opt = optget(clamdopts, "ExcludePath"))->enabled) {
 
255
        while(opt) {
 
256
            if(match_regex(path, opt->strarg) == 1) {
 
257
                logg("~%s: Excluded\n", path);
 
258
                return 1;
 
259
            }
 
260
            opt = opt->nextarg;
 
261
        }
 
262
    }
 
263
    return 0;
 
264
}
 
265
 
247
266
/* Sends a proper scan request to clamd and parses its replies
248
267
 * This is used only in non IDSESSION mode
249
268
 * Returns the number of infected files or -1 on error */
253
272
    struct RCVLN rcv;
254
273
    struct stat sb;
255
274
 
 
275
    if(chkpath(filename))
 
276
        return 0;
256
277
    recvlninit(&rcv, sockd);
257
278
 
258
279
    switch(scantype) {
501
522
    struct SCANID *cid;
502
523
    int res;
503
524
 
 
525
    if(chkpath(filename))
 
526
        return 0;
504
527
    c->files++;
505
528
    switch(reason) {
506
529
    case error_stat: