~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to libclamav/others.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <unistd.h>
32
32
#endif
33
33
 
 
34
#if HAVE_PTHREAD_H
 
35
#include <pthread.h>
 
36
#endif
 
37
 
34
38
#include <stdio.h>
35
39
#include <stdlib.h>
36
40
#include "cltypes.h"
55
59
 * in re-enabling affected modules.
56
60
 */
57
61
 
58
 
#define CL_FLEVEL 76
 
62
#define CL_FLEVEL 77
59
63
#define CL_FLEVEL_DCONF CL_FLEVEL
60
64
#define CL_FLEVEL_SIGTOOL CL_FLEVEL
61
65
 
138
142
#endif
139
143
} cli_ctx;
140
144
 
 
145
#define STATS_ANON_UUID "5b585e8f-3be5-11e3-bf0b-18037319526c"
 
146
#define STATS_MAX_SAMPLES 50
 
147
#define STATS_MAX_MEM 1024*1024
 
148
 
 
149
typedef struct cli_flagged_sample {
 
150
    char **virus_name;
 
151
    char md5[16];
 
152
    uint32_t size; /* A size of zero means size is unavailable (why would this ever happen?) */
 
153
    uint32_t hits;
 
154
    stats_section_t *sections;
 
155
 
 
156
    struct cli_flagged_sample *prev;
 
157
    struct cli_flagged_sample *next;
 
158
} cli_flagged_sample_t;
 
159
 
 
160
typedef struct cli_clamav_intel {
 
161
    char *hostid;
 
162
    char *host_info;
 
163
    cli_flagged_sample_t *samples;
 
164
    uint32_t nsamples;
 
165
    uint32_t maxsamples;
 
166
    uint32_t maxmem;
 
167
    uint32_t timeout;
 
168
    time_t nextupdate;
 
169
    struct cl_engine *engine;
 
170
#ifdef CL_THREAD_SAFE
 
171
    pthread_mutex_t mutex;
 
172
#endif
 
173
} cli_intel_t;
141
174
 
142
175
typedef struct {uint64_t v[2][4];} icon_groupset;
143
176
 
193
226
    uint32_t ac_maxdepth;
194
227
    char *tmpdir;
195
228
    uint32_t keeptmp;
 
229
    uint64_t engine_options;
196
230
 
197
231
    /* Limits */
198
232
    uint64_t maxscansize;  /* during the scanning of archives this size
284
318
    uint64_t maxscriptnormalize; /* max size to normalize scripts */
285
319
    uint64_t maxziptypercg; /* max size to re-do zip filetype */
286
320
 
287
 
    uint32_t forcetodisk; /* cause memory or map scans to dump to disk first */
 
321
    /* Statistics/intelligence gathering */
 
322
    void *stats_data;
 
323
    clcb_stats_add_sample cb_stats_add_sample;
 
324
    clcb_stats_remove_sample cb_stats_remove_sample;
 
325
    clcb_stats_decrement_count cb_stats_decrement_count;
 
326
    clcb_stats_submit cb_stats_submit;
 
327
    clcb_stats_flush cb_stats_flush;
 
328
    clcb_stats_get_num cb_stats_get_num;
 
329
    clcb_stats_get_size cb_stats_get_size;
 
330
    clcb_stats_get_hostid cb_stats_get_hostid;
 
331
 
 
332
    /* Raw disk image max settings */
 
333
    uint32_t maxpartitions;
 
334
 
 
335
    /* Engine max settings */
 
336
    uint32_t maxiconspe; /* max number of icons to scan for PE */
288
337
};
289
338
 
290
339
struct cl_settings {
307
356
    uint32_t bytecode_timeout;
308
357
    enum bytecode_mode bytecode_mode;
309
358
    char *pua_cats;
 
359
    uint64_t engine_options;
310
360
 
311
361
    /* callbacks */
312
362
    clcb_pre_cache cb_pre_cache;
325
375
    uint64_t maxscriptnormalize; /* max size to normalize scripts */
326
376
    uint64_t maxziptypercg; /* max size to re-do zip filetype */
327
377
 
328
 
    uint32_t forcetodisk; /* cause memory or map scans to dump to disk first */
 
378
    /* Statistics/intelligence gathering */
 
379
    void *stats_data;
 
380
    clcb_stats_add_sample cb_stats_add_sample;
 
381
    clcb_stats_remove_sample cb_stats_remove_sample;
 
382
    clcb_stats_decrement_count cb_stats_decrement_count;
 
383
    clcb_stats_submit cb_stats_submit;
 
384
    clcb_stats_flush cb_stats_flush;
 
385
    clcb_stats_get_num cb_stats_get_num;
 
386
    clcb_stats_get_size cb_stats_get_size;
 
387
    clcb_stats_get_hostid cb_stats_get_hostid;
 
388
 
 
389
    /* Raw disk image max settings */
 
390
    uint32_t maxpartitions; /* max number of partitions to scan in a disk image */
 
391
 
 
392
    /* Engine max settings */
 
393
    uint32_t maxiconspe; /* max number of icons to scan for PE */
329
394
};
330
395
 
331
396
extern int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);
556
621
int cli_gentempfd(const char *dir, char **name, int *fd);
557
622
unsigned int cli_rndnum(unsigned int max);
558
623
int cli_filecopy(const char *src, const char *dest);
559
 
int cli_mapscan(fmap_t *map, off_t offset, size_t size, cli_ctx *ctx);
 
624
int cli_mapscan(fmap_t *map, off_t offset, size_t size, cli_ctx *ctx, cli_file_t type);
560
625
bitset_t *cli_bitset_init(void);
561
626
void cli_bitset_free(bitset_t *bs);
562
627
int cli_bitset_set(bitset_t *bs, unsigned long bit_offset);