~ubuntu-branches/ubuntu/intrepid/dansguardian/intrepid-security

« back to all changes in this revision

Viewing changes to KAV.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2008-04-06 14:47:06 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080406144706-2r26l1rougdmb1sd
Tags: 2.9.9.3-2
This time build with gcc 4.3 (Closes: #454889) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//  This program is free software; you can redistribute it and/or modify
2
 
//  it under the terms of the GNU General Public License as published by
3
 
//  the Free Software Foundation; either version 2 of the License, or
4
 
//  (at your option) any later version.
5
 
//
6
 
//  This program is distributed in the hope that it will be useful,
7
 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
8
 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9
 
//  GNU General Public License for more details.
10
 
//
11
 
//  You should have received a copy of the GNU General Public License
12
 
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14
 
 
15
 
//  Written by Nerijus Baliunas
16
 
//  adapted by mad@madness.at
17
 
//
18
 
 
19
 
#include "KAV.hpp"
20
 
 
21
 
extern OptionContainer o;
22
 
 
23
 
 
24
 
KAVEngine::KAVEngine ()
25
 
{
26
 
}
27
 
 
28
 
KAVEngine::~KAVEngine ()
29
 
{
30
 
}
31
 
 
32
 
 
33
 
int
34
 
KAVEngine::scanFile (const char *filename)
35
 
{
36
 
  int isinfected = 0;
37
 
 
38
 
  kav_ctx ctx = kav_new ();
39
 
  kav_set_timeout (ctx, o.virus_scanner_timeout);
40
 
 
41
 
  if (kav_check_file (ctx, filename) == -1)
42
 
    {
43
 
      int kav_error;
44
 
      kav_error = kav_get_error (ctx);
45
 
 
46
 
#ifdef DGDEBUG
47
 
      cout << kav_strerror (kav_error) << " (" << kav_error << ")";
48
 
      if (errno != 0)
49
 
        cout << ": (" << strerror (errno) << ")\n";
50
 
      else
51
 
        cout << "\n";
52
 
#endif
53
 
      setErrString (kav_strerror (kav_error));
54
 
      isinfected = AV_FAIL;
55
 
    }
56
 
  else
57
 
    {
58
 
      isinfected = kav_result_get_status (ctx);
59
 
      virname = kav_result_get_report (ctx);
60
 
 
61
 
      if (isinfected == KAV_STATUS_CLEAN || isinfected == KAV_STATUS_CORRUPTED_FOUND)
62
 
        isinfected = AV_CLEAN;
63
 
      else
64
 
        isinfected = AV_VIRUS;
65
 
    }
66
 
  return isinfected;
67
 
}