~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to docs/html/node45.html

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mfrom: (0.35.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080905172534-yi3f8fkye1o7u1r3
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8
8
<HTML>
9
9
<HEAD>
10
 
<TITLE>Forking daemons</TITLE>
11
 
<META NAME="description" CONTENT="Forking daemons">
 
10
<TITLE>Data scan functions</TITLE>
 
11
<META NAME="description" CONTENT="Data scan functions">
12
12
<META NAME="keywords" CONTENT="clamdoc">
13
13
<META NAME="resource-type" CONTENT="document">
14
14
<META NAME="distribution" CONTENT="global">
20
20
 
21
21
<LINK REL="next" HREF="node46.html">
22
22
<LINK REL="previous" HREF="node44.html">
23
 
<LINK REL="up" HREF="node42.html">
 
23
<LINK REL="up" HREF="node44.html">
24
24
<LINK REL="next" HREF="node46.html">
25
25
</HEAD>
26
26
 
27
27
<BODY >
28
28
 
29
29
<DIV CLASS="navigation"><!--Navigation Panel-->
30
 
<A NAME="tex2html777"
 
30
<A NAME="tex2html788"
31
31
  HREF="node46.html">
32
32
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
33
 
<A NAME="tex2html773"
34
 
  HREF="node42.html">
 
33
<A NAME="tex2html784"
 
34
  HREF="node44.html">
35
35
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
36
 
<A NAME="tex2html767"
 
36
<A NAME="tex2html778"
37
37
  HREF="node44.html">
38
38
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
39
 
<A NAME="tex2html775"
 
39
<A NAME="tex2html786"
40
40
  HREF="node1.html">
41
41
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>  
42
42
<BR>
43
 
<B> Next:</B> <A NAME="tex2html778"
44
 
  HREF="node46.html">clamav-config</A>
45
 
<B> Up:</B> <A NAME="tex2html774"
46
 
  HREF="node42.html">Database reloading</A>
47
 
<B> Previous:</B> <A NAME="tex2html768"
48
 
  HREF="node44.html">Memory</A>
49
 
 &nbsp; <B>  <A NAME="tex2html776"
 
43
<B> Next:</B> <A NAME="tex2html789"
 
44
  HREF="node46.html">Memory</A>
 
45
<B> Up:</B> <A NAME="tex2html785"
 
46
  HREF="node44.html">Database reloading</A>
 
47
<B> Previous:</B> <A NAME="tex2html779"
 
48
  HREF="node44.html">Database reloading</A>
 
49
 &nbsp; <B>  <A NAME="tex2html787"
50
50
  HREF="node1.html">Contents</A></B> 
51
51
<BR>
52
52
<BR></DIV>
53
53
<!--End of Navigation Panel-->
54
54
 
55
 
<H3><A NAME="SECTION00074300000000000000">
56
 
Forking daemons</A>
 
55
<H3><A NAME="SECTION00074100000000000000">
 
56
Data scan functions</A>
57
57
</H3>
58
 
    If you're using libclamav with a forking daemon you should call
59
 
    <code>srand()</code> inside a forked child before making any calls to the
60
 
    libclamav functions. This will avoid possible collisions with temporary
61
 
    filenames created by other processes of the daemon. This procedure
62
 
    is not required for multi-threaded daemons.
 
58
    It's possible to scan a file or descriptor using:
 
59
    <PRE>
 
60
        int cl_scanfile(const char *filename, const char **virname,
 
61
        unsigned long int *scanned, const struct cl_engine *engine,
 
62
        const struct cl_limits *limits, unsigned int options);
 
63
 
 
64
        int cl_scandesc(int desc, const char **virname, unsigned
 
65
        long int *scanned, const struct cl_engine *engine, const
 
66
        struct cl_limits *limits, unsigned int options);
 
67
</PRE>
 
68
    Both functions will store a virus name under the pointer <code>virname</code>,
 
69
    the virus name is part of the engine structure and must not be released
 
70
    directly. If the third argument (<code>scanned</code>) is not NULL, the
 
71
    functions will increase its value with the size of scanned data (in
 
72
    <code>CL_COUNT_PRECISION</code> units). Both functions have support for archive
 
73
    limits in order to protect against Denial of Service attacks.
 
74
    <PRE>
 
75
struct cl_limits {
 
76
    unsigned long int maxscansize;  /* during the scanning of archives this
 
77
                                     * size will never be exceeded
 
78
                                     */
 
79
    unsigned long int maxfilesize;  /* compressed files will only be
 
80
                                     * decompressed and scanned up to this size
 
81
                                     */
 
82
    unsigned int maxreclevel;       /* maximum recursion level for archives */
 
83
    unsigned int maxfiles;          /* maximum number of files to be scanned
 
84
                                     * within a single archive
 
85
                                     */
 
86
    unsigned short archivememlim;   /* limit memory usage for some unpackers */
 
87
};
 
88
</PRE>
 
89
    The last argument (<code>options</code>) configures the scan engine and supports
 
90
    the following flags (that can be combined using bit operators):
 
91
    
 
92
<UL>
 
93
<LI><SPAN  CLASS="textbf">CL_SCAN_STDOPT</SPAN>
 
94
<BR>
 
95
This is an alias for a recommended set of scan options. You
 
96
              should use it to make your software ready for new features
 
97
              in the future versions of libclamav.
 
98
</LI>
 
99
<LI><SPAN  CLASS="textbf">CL_SCAN_RAW</SPAN>
 
100
<BR>
 
101
Use it alone if you want to disable support for special files.
 
102
</LI>
 
103
<LI><SPAN  CLASS="textbf">CL_SCAN_ARCHIVE</SPAN>
 
104
<BR>
 
105
This flag enables transparent scanning of various archive formats.
 
106
</LI>
 
107
<LI><SPAN  CLASS="textbf">CL_SCAN_BLOCKENCRYPTED</SPAN>
 
108
<BR>
 
109
With this flag the library will mark encrypted archives as viruses
 
110
              (Encrypted.Zip, Encrypted.RAR).
 
111
</LI>
 
112
<LI><SPAN  CLASS="textbf">CL_SCAN_MAIL</SPAN>
 
113
<BR>
 
114
Enable support for mail files.
 
115
</LI>
 
116
<LI><SPAN  CLASS="textbf">CL_SCAN_MAILURL</SPAN>
 
117
<BR>
 
118
The mail scanner will download and scan URLs listed in a mail
 
119
              body. This flag should not be used on loaded servers. Due to
 
120
              potential problems please do not enable it by default but make
 
121
              it optional.
 
122
</LI>
 
123
<LI><SPAN  CLASS="textbf">CL_SCAN_OLE2</SPAN>
 
124
<BR>
 
125
Enables support for OLE2 containers (used by MS Office and .msi
 
126
              files).
 
127
</LI>
 
128
<LI><SPAN  CLASS="textbf">CL_SCAN_PDF</SPAN>
 
129
<BR>
 
130
Enables scanning within PDF files.
 
131
</LI>
 
132
<LI><SPAN  CLASS="textbf">CL_SCAN_PE</SPAN>
 
133
<BR>
 
134
This flag enables deep scanning of Portable Executable files and
 
135
              allows libclamav to unpack executables compressed with run-time
 
136
              unpackers.
 
137
</LI>
 
138
<LI><SPAN  CLASS="textbf">CL_SCAN_ELF</SPAN>
 
139
<BR>
 
140
Enable support for ELF files.
 
141
</LI>
 
142
<LI><SPAN  CLASS="textbf">CL_SCAN_BLOCKBROKEN</SPAN>
 
143
<BR>
 
144
libclamav will try to detect broken executables and mark them as
 
145
              Broken.Executable.
 
146
</LI>
 
147
<LI><SPAN  CLASS="textbf">CL_SCAN_HTML</SPAN>
 
148
<BR>
 
149
This flag enables HTML normalisation (including ScrEnc
 
150
              decryption).
 
151
</LI>
 
152
<LI><SPAN  CLASS="textbf">CL_SCAN_ALGORITHMIC</SPAN>
 
153
<BR>
 
154
Enable algorithmic detection of viruses.
 
155
</LI>
 
156
<LI><SPAN  CLASS="textbf">CL_SCAN_PHISHING_BLOCKSSL</SPAN>
 
157
<BR>
 
158
Phishing module: always block SSL mismatches in URLs.
 
159
</LI>
 
160
<LI><SPAN  CLASS="textbf">CL_SCAN_PHISHING_BLOCKCLOAK</SPAN>
 
161
<BR>
 
162
Phishing module: always block cloaked URLs.
 
163
    
 
164
</LI>
 
165
</UL>
 
166
    All functions return 0 (<code>CL_CLEAN</code>) when the file seems clean,
 
167
    <code>CL_VIRUS</code> when a virus is detected and another value on failure.
 
168
    <PRE>
 
169
            ...
 
170
            struct cl_limits limits;
 
171
            const char *virname;
 
172
 
 
173
        memset(&amp;limits, 0, sizeof(struct cl_limits));
 
174
        limits.maxfiles = 10000;
 
175
        limits.maxscansize = 100 * 1048576; /* 100 MB */
 
176
        limits.maxfilesize = 10 * 1048576; /* 10 MB */
 
177
        limits.maxreclevel = 16;
 
178
 
 
179
        if((ret = cl_scanfile("/tmp/test.exe", &amp;virname, NULL, engine,
 
180
        &amp;limits, CL_STDOPT)) == CL_VIRUS) {
 
181
            printf("Virus detected: %s\n", virname);
 
182
        } else {
 
183
            printf("No virus detected.\n");
 
184
            if(ret != CL_CLEAN)
 
185
                printf("Error: %s\n", cl_strerror(ret));
 
186
        }
 
187
</PRE>
63
188
 
64
189
<P>
65
 
<BR><HR>
 
190
 
 
191
<DIV CLASS="navigation"><HR>
 
192
<!--Navigation Panel-->
 
193
<A NAME="tex2html788"
 
194
  HREF="node46.html">
 
195
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
 
196
<A NAME="tex2html784"
 
197
  HREF="node44.html">
 
198
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
 
199
<A NAME="tex2html778"
 
200
  HREF="node44.html">
 
201
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
 
202
<A NAME="tex2html786"
 
203
  HREF="node1.html">
 
204
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>  
 
205
<BR>
 
206
<B> Next:</B> <A NAME="tex2html789"
 
207
  HREF="node46.html">Memory</A>
 
208
<B> Up:</B> <A NAME="tex2html785"
 
209
  HREF="node44.html">Database reloading</A>
 
210
<B> Previous:</B> <A NAME="tex2html779"
 
211
  HREF="node44.html">Database reloading</A>
 
212
 &nbsp; <B>  <A NAME="tex2html787"
 
213
  HREF="node1.html">Contents</A></B> </DIV>
 
214
<!--End of Navigation Panel-->
66
215
<ADDRESS>
67
216
Tomasz Kojm
68
 
2008-07-07
 
217
2008-09-01
69
218
</ADDRESS>
70
219
</BODY>
71
220
</HTML>