1
*** /home/njh/src/clamav-devel/./libclamav/readdb.c 2007-02-11 16:28:20.000000000 +0000
2
--- ./libclamav/readdb.c 2007-02-11 16:29:00.000000000 +0000
6
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
10
+ #include <winsock.h> /* for Sleep() */
14
#include "clamav-config.h"
19
cli_dbgmsg("cli_loaddbdir: Acquiring dbdir lock\n");
20
while((lock = cli_readlockdb(dirname, 0)) == CL_ELOCKDB) {
27
cli_errmsg("cl_load(): Unable to lock database directory: %s\n", dirname);
29
*** /home/njh/src/clamav-devel/./libclamav/blob.c 2007-02-10 21:13:23.000000000 +0000
30
--- ./libclamav/blob.c 2007-02-10 14:22:00.000000000 +0000
35
cli_dbgmsg("blobClose: recovered all %lu bytes\n",
36
! (unsigned long)b->size);
39
unsigned char *ptr = cli_realloc(b->data, b->len);
43
cli_dbgmsg("blobClose: recovered all %lu bytes\n",
47
unsigned char *ptr = cli_realloc(b->data, b->len);
52
cli_dbgmsg("blobClose: recovered %lu bytes from %lu\n",
53
! (unsigned long)(b->size - b->len),
54
! (unsigned long)b->size);
61
cli_dbgmsg("blobClose: recovered %lu bytes from %lu\n",
62
! b->size - b->len, b->size);
68
cli_errmsg("fileblobDestroy: %s not saved: refer to http://www.clamav.net/bugs.html#pagestart\n", fb->b.name);
71
! cli_errmsg("fileblobDestroy: file not saved (%lu bytes): report to http://bugs.clamav.net\n",
72
! (unsigned long)fb->b.len);
75
fb->b.magic = INVALIDCLASS;
77
cli_errmsg("fileblobDestroy: %s not saved: refer to http://www.clamav.net/bugs.html#pagestart\n", fb->b.name);
80
! cli_errmsg("fileblobDestroy: file not saved (%lu bytes): report to http://bugs.clamav.net\n", fb->b.len);
83
fb->b.magic = INVALIDCLASS;
88
cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno));
89
! cli_dbgmsg("%lu %lu\n", (unsigned long)sizeof(fullname),
90
! (unsigned long)strlen(fullname));
97
cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno));
98
! cli_dbgmsg("%d %d\n", sizeof(fullname), strlen(fullname));
106
cli_errmsg("Can't create file %s: %s\n", fullname, strerror(errno));
107
! cli_dbgmsg("%lu %lu\n", (unsigned long)sizeof(fullname),
108
! (unsigned long)strlen(fullname));
115
cli_errmsg("Can't create file %s: %s\n", fullname, strerror(errno));
116
! cli_dbgmsg("%d %d\n", sizeof(fullname), strlen(fullname));
124
if(fwrite(data, len, 1, fb->fp) != 1) {
125
! cli_errmsg("fileblobAddData: Can't write %lu bytes to temporary file %s: %s\n",
126
! (unsigned long)len, fb->b.name, strerror(errno));
133
if(fwrite(data, len, 1, fb->fp) != 1) {
134
! cli_errmsg("fileblobAddData: Can't write %u bytes to temporary file %s: %s\n", len, fb->b.name, strerror(errno));
138
*** /home/njh/src/clamav-devel/./libclamav/message.c 2007-02-10 21:02:53.000000000 +0000
139
--- ./libclamav/message.c 2007-02-10 14:22:00.000000000 +0000
148
* The field is in quotes, so look for the
151
! kcopy = cli_strdup(key);
156
! ptr = strchr(kcopy, '=');
158
! ptr = strchr(kcopy, ':');
161
string = strchr(++cptr, '"');
169
* The field is in quotes, so look for the
172
! key = cli_strdup(key);
177
! ptr = strchr(key, '=');
179
! ptr = strchr(key, ':');
182
string = strchr(++cptr, '"');
188
! if(!usefulArg(kcopy)) {
197
! if(!usefulArg(key)) {
204
cli_dbgmsg("Can't parse header \"%s\" - if you believe this file contains a virus, submit it to www.clamav.net\n", s);
213
! field = cli_realloc(kcopy, strlen(kcopy) + strlen(data) + 2);
223
cli_dbgmsg("Can't parse header \"%s\" - if you believe this file contains a virus, submit it to www.clamav.net\n", s);
232
! field = cli_realloc((char *)key, strlen(key) + strlen(data) + 2);
243
* Find a MIME variable from the header and return a COPY to the value of that
244
* variable. The caller must free the copy
247
messageFindArgument(const message *m, const char *variable)
251
* Find a MIME variable from the header and return a COPY to the value of that
252
* variable. The caller must free the copy
255
messageFindArgument(const message *m, const char *variable)
260
if((ptr == NULL) || (*ptr == '\0'))
263
! cli_dbgmsg("messageFindArgument: compare %lu bytes of %s with %s\n",
264
! (unsigned long)len, variable, ptr);
266
if(strncasecmp(ptr, variable, len) == 0) {
269
if((ptr == NULL) || (*ptr == '\0'))
272
! cli_dbgmsg("messageFindArgument: compare %d bytes of %s with %s\n",
273
! len, variable, ptr);
275
if(strncasecmp(ptr, variable, len) == 0) {
279
blobAddData(u, &c, 1);
282
! cli_dbgmsg("uncompress HQX7 at 0x%06lu: %d repetitive bytes\n", l, count);
287
blobAddData(u, &c, 1);
290
! cli_dbgmsg("uncompress HQX7 at 0x%06x: %d repetitive bytes\n", l, count);
296
* Find the filename to decode
298
if(((enctype == YENCODE) && yEncBegin(m)) || ((i == 0) && yEncBegin(m))) {
302
* TODO: handle multipart yEnc encoded files
304
t_line = yEncBegin(m);
305
! f = lineGetData(t_line->t_line);
307
! if((filename = strstr(f, " name=")) != NULL) {
308
filename = cli_strdup(&filename[6]);
312
* Find the filename to decode
314
if(((enctype == YENCODE) && yEncBegin(m)) || ((i == 0) && yEncBegin(m))) {
316
* TODO: handle multipart yEnc encoded files
318
t_line = yEncBegin(m);
319
! filename = (char *)lineGetData(t_line->t_line);
321
! if((filename = strstr(filename, " name=")) != NULL) {
322
filename = cli_strdup(&filename[6]);
328
} while((t_line = t_line->t_next) != NULL);
330
! cli_dbgmsg("Exported %lu bytes using enctype %d\n",
331
! (unsigned long)size, enctype);
333
/* Verify we have nothing left to flush out */
337
} while((t_line = t_line->t_next) != NULL);
339
! cli_dbgmsg("Exported %u bytes using enctype %d\n", size, enctype);
341
/* Verify we have nothing left to flush out */
348
! cli_dbgmsg("messageDedup reclaimed %lu bytes\n", (unsigned long)saved);
349
m->dedupedThisFar = t1;
356
! cli_dbgmsg("messageDedup reclaimed %u bytes\n", saved);
357
m->dedupedThisFar = t1;
360
*** /home/njh/src/clamav-devel/./libclamav/mbox.c 2007-02-10 20:54:29.000000000 +0000
361
--- ./libclamav/mbox.c 2007-02-10 18:00:58.000000000 +0000
364
if(mainMessage && (messageGetBody(mainMessage) != NULL)) {
366
int subtype, inhead, htmltextPart, inMimeHead, i;
367
! const char *mimeSubtype;
368
! char *protocol, *boundary;
370
/*bool isAlternative;*/
373
if(mainMessage && (messageGetBody(mainMessage) != NULL)) {
375
int subtype, inhead, htmltextPart, inMimeHead, i;
376
! const char *mimeSubtype, *boundary;
379
/*bool isAlternative;*/
384
cli_dbgmsg("Save non mime part bounce message\n");
385
fileblobSetFilename(fb, mctx->dir, "bounce");
386
! fileblobAddData(fb, (const unsigned char *)"Received: by clamd (bounce)\n", 28);
387
fileblobSetCTX(fb, mctx->ctx);
392
cli_dbgmsg("Save non mime part bounce message\n");
393
fileblobSetFilename(fb, mctx->dir, "bounce");
394
! fileblobAddData(fb, (unsigned char *)"Received: by clamd (bounce)\n", 28);
395
fileblobSetCTX(fb, mctx->ctx);
403
! fileblobAddData(fb, (const unsigned char *)s, strlen(s));
405
! fileblobAddData(fb, (const unsigned char *)"\n", 1);
406
lookahead = t->t_next;
407
if(lookahead == NULL)
413
! fileblobAddData(fb, (unsigned char *)s, strlen(s));
415
! fileblobAddData(fb, (unsigned char *)"\n", 1);
416
lookahead = t->t_next;
417
if(lookahead == NULL)
422
boundaryStart(const char *line, const char *boundary)
427
char buf[RFC2821LENGTH + 1];
431
boundaryStart(const char *line, const char *boundary)
435
char buf[RFC2821LENGTH + 1];
440
ptr = rfc822comments(line, buf);
442
! ptr = out = rfc822comments(line, NULL);
451
ptr = rfc822comments(line, buf);
453
! out = ptr = rfc822comments(line, NULL);
456
! ptr = (char *)line;
463
b = messageToBlob(m, 1);
464
len = blobGetDataSize(b);
465
! cli_dbgmsg("Decoded as '%*.*s'\n", (int)len, (int)len,
467
memcpy(pout, blobGetData(b), len);
472
b = messageToBlob(m, 1);
473
len = blobGetDataSize(b);
474
! cli_dbgmsg("Decoded as '%*.*s'\n", len, len, blobGetData(b));
475
memcpy(pout, blobGetData(b), len);
478
*** /home/njh/src/clamav-devel/./libclamav/message.h 2007-02-10 17:13:33.000000000 +0000
479
--- ./libclamav/message.h 2006-10-19 19:54:14.000000000 +0100
482
const char *messageGetDispositionType(const message *m);
483
void messageAddArgument(message *m, const char *arg);
484
void messageAddArguments(message *m, const char *arg);
485
! char *messageFindArgument(const message *m, const char *variable);
486
void messageSetEncoding(message *m, const char *enctype);
487
encoding_type messageGetEncoding(const message *m);
488
int messageAddLine(message *m, line_t *line);
490
const char *messageGetDispositionType(const message *m);
491
void messageAddArgument(message *m, const char *arg);
492
void messageAddArguments(message *m, const char *arg);
493
! const char *messageFindArgument(const message *m, const char *variable);
494
void messageSetEncoding(message *m, const char *enctype);
495
encoding_type messageGetEncoding(const message *m);
496
int messageAddLine(message *m, line_t *line);
497
*** /home/njh/src/clamav-devel/./libclamav/untar.c 2007-02-10 21:05:37.000000000 +0000
498
--- ./libclamav/untar.c 2007-02-10 14:22:00.000000000 +0000
503
cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno));
504
! cli_dbgmsg("%lu %lu %lu\n",
505
! (unsigned long)suffixLen,
506
! (unsigned long)sizeof(fullname),
507
! (unsigned long)strlen(fullname));
514
cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno));
515
! cli_dbgmsg("%u %d %d\n", suffixLen, sizeof(fullname), strlen(fullname));
519
*** /home/njh/src/clamav-devel/./libclamav/untar.h 2006-12-22 18:29:13.000000000 +0000
520
--- ./libclamav/untar.h 2006-11-24 22:28:32.000000000 +0000
526
* Revision 1.16 2007/02/12 15:41:19 njh
527
* Latest diffs from the W32 fork
529
- * Revision 1.5 2006/12/22 18:29:13 njh
530
- * Recommit fix for bug 153
532
* Revision 1.4 2006/04/09 19:59:28 kojm
533
* update GPL headers with new address for FSF
541
! int cli_untar(const char *dir, int desc, unsigned int posix, const struct cl_limits *limits);
546
! int cli_untar(const char *dir, int desc, unsigned int posix);
547
*** /home/njh/src/clamav-devel/./libclamav/pst.c 2007-01-30 10:31:14.000000000 +0000
548
--- ./libclamav/pst.c 2007-01-05 14:45:18.000000000 +0000
551
pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr);
552
static void *_pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr);
553
static pst_num_array *_pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head);
554
! static int32_t _pst_process(pst_num_array *list, pst_item *item);
555
int32_t _pst_free_list(pst_num_array *list);
556
void _pst_freeItem(pst_item *item);
557
int32_t _pst_free_id2(pst_index2_ll * head);
559
pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr);
560
static void *_pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr);
561
static pst_num_array *_pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head);
562
! int32_t _pst_process(pst_num_array *list, pst_item *item);
563
int32_t _pst_free_list(pst_num_array *list);
564
void _pst_freeItem(pst_item *item);
565
int32_t _pst_free_id2(pst_index2_ll * head);
568
pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE *fp)
574
if (attach->id_val != -1) {
576
pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE *fp)
582
if (attach->id_val != -1) {
585
// for PST files this will load up ID2 0x61 and check it's "list" attribute.
588
! pst_index2_ll *list2 = NULL;
589
unsigned char * buffer=NULL, *headerbuffer=NULL;
590
pst_x_attrib xattrib;
591
! int32_t bptr = 0, bsize = 0, hsize, tint, err=0, x;
592
pst_x_attrib_ll *ptr, *p_head=NULL, *p_sh=NULL, *p_sh2=NULL;
594
if ((p = _pst_getDptr(pf, 0x61)) == NULL) {
596
// for PST files this will load up ID2 0x61 and check it's "list" attribute.
599
! pst_index2_ll *list2;
600
unsigned char * buffer=NULL, *headerbuffer=NULL;
601
pst_x_attrib xattrib;
602
! int32_t bptr = 0, bsize, hsize, tint, err=0, x;
603
pst_x_attrib_ll *ptr, *p_head=NULL, *p_sh=NULL, *p_sh2=NULL;
605
if ((p = _pst_getDptr(pf, 0x61)) == NULL) {
608
cli_dbgmsg("not able to read the ID2 data. Setting to be read later. %#x\n",
610
na_ptr->items[x]->size = 0;
611
- na_ptr->items[x]->type = table_rec.value;
612
- free(na_ptr->items[x]->data);
613
na_ptr->items[x]->data = NULL;
615
cli_dbgmsg("Read %i bytes to a buffer at %p\n",
616
na_ptr->items[x]->size, na_ptr->items[x]->data);
618
cli_dbgmsg("not able to read the ID2 data. Setting to be read later. %#x\n",
620
na_ptr->items[x]->size = 0;
621
na_ptr->items[x]->data = NULL;
622
+ na_ptr->items[x]->type = table_rec.value;
624
cli_dbgmsg("Read %i bytes to a buffer at %p\n",
625
na_ptr->items[x]->size, na_ptr->items[x]->data);
628
na_ptr->items[x]->type = table_rec.ref_type;
630
cli_warnmsg("ERROR Unknown ref_type %#x\n", table_rec.ref_type);
633
_pst_free_list(na_head);
642
! _pst_process(pst_num_array *list , pst_item *item)
646
pst_item_attach *attach;
647
pst_item_extra_field *ef;
652
! int32_t _pst_process(pst_num_array *list , pst_item *item) {
655
pst_item_attach *attach;
656
pst_item_extra_field *ef;
659
cli_dbgmsg("Attachment Size - ");
662
! t = (*(int32_t *)list->items[x]->data);
665
cli_dbgmsg("%i\n", attach->size);
669
cli_dbgmsg("Attachment Size - ");
672
! memcpy(&(attach->size), list->items[x]->data, sizeof(attach->size));
673
cli_dbgmsg("%i\n", attach->size);
679
while (list != NULL) {
680
while (x < list->count_item) {
681
! if (list->items[x] != NULL) {
682
! if (list->items[x]->data != NULL) {
683
free (list->items[x]->data);
685
free (list->items[x]);
690
while (list != NULL) {
691
while (x < list->count_item) {
692
! if (list->items[x]->data != NULL) {
693
free (list->items[x]->data);
695
! if (list->items[x] != NULL) {
696
free (list->items[x]);
701
if ((temp = item->email->outlook_sender) == NULL)
703
fprintf(f->output, "From: \"%s\" <%s>\n", item->email->outlook_sender_name, temp);
704
! if ((item->email->subject != NULL) && (item->email->subject->subj != NULL)) {
705
fprintf(f->output, "Subject: %s\n", item->email->subject->subj);
707
fprintf(f->output, "Subject: \n");*/
709
if ((temp = item->email->outlook_sender) == NULL)
711
fprintf(f->output, "From: \"%s\" <%s>\n", item->email->outlook_sender_name, temp);
712
! if (item->email->subject != NULL) {
713
fprintf(f->output, "Subject: %s\n", item->email->subject->subj);
715
fprintf(f->output, "Subject: \n");*/
716
*** /home/njh/src/clamav-devel/./libclamav/line.c 2007-02-10 17:15:14.000000000 +0000
717
--- ./libclamav/line.c 2006-10-19 19:54:12.000000000 +0100
721
return line ? line->l_str : NULL;
727
lineCreate(const char *data)
730
*** /home/njh/src/clamav-devel/./libclamav/text.c 2007-02-10 21:14:39.000000000 +0000
731
--- ./libclamav/text.c 2006-10-19 19:54:14.000000000 +0100
735
const char *l = lineGetData(line);
737
! blobAddData(b, (const unsigned char *)l, strlen(l));
739
! blobAddData(b, (const unsigned char *)"\n", 1);
745
const char *l = lineGetData(line);
747
! blobAddData(b, (unsigned char *)l, strlen(l));
749
! blobAddData(b, (unsigned char *)"\n", 1);
756
const char *l = lineGetData(line);
758
! fileblobAddData(fb, (const unsigned char *)l, strlen(l));
760
! fileblobAddData(fb, (const unsigned char *)"\n", 1);
766
const char *l = lineGetData(line);
768
! fileblobAddData(fb, (unsigned char *)l, strlen(l));
770
! fileblobAddData(fb, (unsigned char *)"\n", 1);
774
*** /home/njh/src/clamav-devel/./libclamav/js/alloc.c 2006-10-28 12:33:45.000000000 +0100
775
--- ./libclamav/js/alloc.c 2006-10-21 14:58:34.000000000 +0100
782
- #include "clamav-config.h"
785
- #ifdef CL_EXPERIMENTAL
788
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
789
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
792
#include "js/jsint.h"
798
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
799
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
802
#include "js/jsint.h"
807
#endif /* not JS_DEBUG_MEMORY_LEAKS */
808
- #endif /*CL_EXPERIMENTAL*/
810
*** /home/njh/src/clamav-devel/./libclamav/js/b_array.c 2006-10-28 12:33:45.000000000 +0100
811
--- ./libclamav/js/b_array.c 2006-10-21 14:58:34.000000000 +0100
816
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
817
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
824
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
825
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
835
- #include "clamav-config.h"
838
- #ifdef CL_EXPERIMENTAL
846
n = &vm->globals[js_vm_intern (vm, "Array")];
847
js_vm_builtin_create (vm, n, info, NULL);
849
- #endif /*CL_EXPERIMENTAL*/
851
*** /home/njh/src/clamav-devel/./libclamav/js/b_bool.c 2006-10-28 12:33:45.000000000 +0100
852
--- ./libclamav/js/b_bool.c 2006-10-21 14:58:34.000000000 +0100
857
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
858
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
862
- #include "clamav-config.h"
865
- #ifdef CL_EXPERIMENTAL
873
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
874
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
882
n = &vm->globals[js_vm_intern (vm, "Boolean")];
883
js_vm_builtin_create (vm, n, info, NULL);
885
- #endif /*CL_EXPERIMENTAL*/
887
*** /home/njh/src/clamav-devel/./libclamav/js/bc.c 2006-10-28 12:33:45.000000000 +0100
888
--- ./libclamav/js/bc.c 2006-10-21 14:58:34.000000000 +0100
893
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
894
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
897
- #include "clamav-config.h"
900
- #ifdef CL_EXPERIMENTAL
907
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
908
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
918
- #endif /*CL_EXPERIMENTAL*/
920
*** /home/njh/src/clamav-devel/./libclamav/js/b_core.c 2006-10-28 12:33:45.000000000 +0100
921
--- ./libclamav/js/b_core.c 2006-10-21 14:58:34.000000000 +0100
926
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
927
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
934
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
935
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
945
- #include "clamav-config.h"
948
- #ifdef CL_EXPERIMENTAL
955
js_vm_builtin_create (vm, n, info, NULL);
958
- #endif /*CL_EXPERIMENTAL*/
960
*** /home/njh/src/clamav-devel/./libclamav/js/b_date.c 2006-10-28 12:33:45.000000000 +0100
961
--- ./libclamav/js/b_date.c 2006-10-21 14:58:34.000000000 +0100
966
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
967
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
970
- #include "clamav-config.h"
973
- #ifdef CL_EXPERIMENTAL
976
#include "rentrant.h"
980
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
981
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
985
#include "rentrant.h"
988
js_vm_builtin_create (vm, n, info, NULL);
991
- #endif /*CL_EXPERIMENTAL*/
993
*** /home/njh/src/clamav-devel/./libclamav/js/b_dir.c 2006-10-28 12:33:45.000000000 +0100
994
--- ./libclamav/js/b_dir.c 2006-10-21 14:58:34.000000000 +0100
999
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1000
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1003
- #include "clamav-config.h"
1006
- #ifdef CL_EXPERIMENTAL
1013
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1014
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1021
n = &vm->globals[js_vm_intern (vm, "Directory")];
1022
js_vm_builtin_create (vm, n, info, NULL);
1024
- #endif /*CL_EXPERIMENTAL*/
1026
*** /home/njh/src/clamav-devel/./libclamav/js/b_file.c 2006-10-28 12:33:45.000000000 +0100
1027
--- ./libclamav/js/b_file.c 2006-10-21 14:58:34.000000000 +0100
1032
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1033
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1040
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1041
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1047
* autoFlush boolean mutable
1048
* bufferSize integer mutable
1051
- #include "clamav-config.h"
1054
- #ifdef CL_EXPERIMENTAL
1061
/* Create the builtin. */
1062
js_vm_builtin_create (vm, result_return, n->u.vbuiltin->info, ictx);
1064
- #endif /*CL_EXPERIMENTAL*/
1066
*** /home/njh/src/clamav-devel/./libclamav/js/b_func.c 2006-10-28 12:33:45.000000000 +0100
1067
--- ./libclamav/js/b_func.c 2006-10-21 14:58:34.000000000 +0100
1072
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1073
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1076
- #include "clamav-config.h"
1079
- #ifdef CL_EXPERIMENTAL
1086
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1087
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1094
n = &vm->globals[js_vm_intern (vm, "Function")];
1095
js_vm_builtin_create (vm, n, info, NULL);
1097
- #endif /*CL_EXPERIMENTAL*/
1099
*** /home/njh/src/clamav-devel/./libclamav/js/b_math.c 2006-10-28 12:33:45.000000000 +0100
1100
--- ./libclamav/js/b_math.c 2006-10-21 14:58:34.000000000 +0100
1105
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1106
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1109
- #include "clamav-config.h"
1112
- #ifdef CL_EXPERIMENTAL
1115
#include "rentrant.h"
1119
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1120
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1124
#include "rentrant.h"
1127
n = &vm->globals[js_vm_intern (vm, "Math")];
1128
js_vm_builtin_create (vm, n, info, NULL);
1130
- #endif /*CL_EXPERIMENTAL*/
1132
*** /home/njh/src/clamav-devel/./libclamav/js/b_number.c 2006-10-28 12:33:45.000000000 +0100
1133
--- ./libclamav/js/b_number.c 2006-10-21 14:58:34.000000000 +0100
1138
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1139
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1143
* Standard: ECMAScript-2.0.draft-22-Apr-98
1146
- #include "clamav-config.h"
1149
- #ifdef CL_EXPERIMENTAL
1156
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1157
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1161
* Standard: ECMAScript-2.0.draft-22-Apr-98
1168
n = &vm->globals[js_vm_intern (vm, "Number")];
1169
js_vm_builtin_create (vm, n, info, NULL);
1171
- #endif /*CL_EXPERIMENTAL*/
1173
*** /home/njh/src/clamav-devel/./libclamav/js/b_object.c 2006-10-28 12:33:45.000000000 +0100
1174
--- ./libclamav/js/b_object.c 2006-10-21 14:58:34.000000000 +0100
1179
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1180
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1183
- #include "clamav-config.h"
1186
- #ifdef CL_EXPERIMENTAL
1193
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1194
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1201
n = &vm->globals[js_vm_intern (vm, "Object")];
1202
js_vm_builtin_create (vm, n, info, NULL);
1204
- #endif /*CL_EXPERIMENTAL*/
1206
*** /home/njh/src/clamav-devel/./libclamav/js/b_regexp.c 2006-10-28 12:33:45.000000000 +0100
1207
--- ./libclamav/js/b_regexp.c 2006-10-21 14:58:34.000000000 +0100
1212
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1213
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1216
- #include "clamav-config.h"
1219
- #ifdef CL_EXPERIMENTAL
1226
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1227
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1237
- #endif /*CL_EXPERIMENTAL*/
1239
*** /home/njh/src/clamav-devel/./libclamav/js/b_string.c 2006-10-28 12:33:45.000000000 +0100
1240
--- ./libclamav/js/b_string.c 2006-10-21 14:58:34.000000000 +0100
1245
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1246
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1249
/* TODO: global method: String (obj) => string */
1251
- #include "clamav-config.h"
1254
- #ifdef CL_EXPERIMENTAL
1261
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1262
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1265
/* TODO: global method: String (obj) => string */
1271
n = &vm->globals[js_vm_intern (vm, "RegExp")];
1272
ctx->regexp_info = n->u.vbuiltin->info;
1274
- #endif /*CL_EXPERIMENTAL*/
1276
*** /home/njh/src/clamav-devel/./libclamav/js/b_vm.c 2006-10-28 12:33:45.000000000 +0100
1277
--- ./libclamav/js/b_vm.c 2006-10-21 14:58:34.000000000 +0100
1282
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1283
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1290
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1291
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1297
* VM.versionPatch integer
1298
* VM.warnUndef boolean yes
1301
- #include "clamav-config.h"
1304
- #ifdef CL_EXPERIMENTAL
1311
n = &vm->globals[js_vm_intern (vm, "VM")];
1312
js_vm_builtin_create (vm, n, info, NULL);
1314
- #endif /*CL_EXPERIMENTAL*/
1316
*** /home/njh/src/clamav-devel/./libclamav/js/compiler.c 2006-10-28 12:33:45.000000000 +0100
1317
--- ./libclamav/js/compiler.c 2006-10-21 14:58:34.000000000 +0100
1321
- #include "clamav-config.h"
1324
- #ifdef CL_EXPERIMENTAL
1325
const unsigned char js_compiler_bytecode[] = {
1326
0xc0, 0x01, 0x4a, 0x53, 0x00, 0x00, 0x00, 0x03,
1327
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x54,
1330
*** 11201,11204 ****
1332
unsigned int js_compiler_bytecode_len = 89552;
1333
#define JS_COMPILER_BYTECODE_LEN 89552
1334
- #endif /*CL_EXPERIMENTAL*/
1335
--- 11196,11198 ----
1336
*** /home/njh/src/clamav-devel/./libclamav/js/heap.c 2006-10-28 12:33:45.000000000 +0100
1337
--- ./libclamav/js/heap.c 2006-10-21 14:58:34.000000000 +0100
1342
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1343
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1346
- #include "clamav-config.h"
1349
- #ifdef CL_EXPERIMENTAL
1356
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1357
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1364
/* Just sweep without marking. */
1367
- #endif /*CL_EXPERIMENTAL*/
1369
*** /home/njh/src/clamav-devel/./libclamav/js/iostream.c 2006-10-28 12:33:45.000000000 +0100
1370
--- ./libclamav/js/iostream.c 2006-10-21 14:58:34.000000000 +0100
1375
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1376
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1379
- #include "clamav-config.h"
1382
- #ifdef CL_EXPERIMENTAL
1389
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1390
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1397
if (stream->data_in_buf == 0)
1400
- #endif /*CL_EXPERIMENTAL*/
1402
*** /home/njh/src/clamav-devel/./libclamav/js/js.c 2006-10-28 12:33:45.000000000 +0100
1403
--- ./libclamav/js/js.c 2006-10-21 14:58:34.000000000 +0100
1408
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1409
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1412
- #include "clamav-config.h"
1415
- #ifdef CL_EXPERIMENTAL
1418
#include "js/jsint.h"
1422
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1423
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1427
#include "js/jsint.h"
1433
- #endif /*CL_EXPERIMENTAL*/
1435
*** /home/njh/src/clamav-devel/./libclamav/js/object.c 2006-10-28 12:33:45.000000000 +0100
1436
--- ./libclamav/js/object.c 2006-10-21 14:58:34.000000000 +0100
1441
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1442
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1445
- #include "clamav-config.h"
1448
- #ifdef CL_EXPERIMENTAL
1455
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1456
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1466
- #endif /*CL_EXPERIMENTAL*/
1468
*** /home/njh/src/clamav-devel/./libclamav/js/r_pthrs.c 2006-10-28 12:33:45.000000000 +0100
1469
--- ./libclamav/js/r_pthrs.c 2006-10-21 14:58:34.000000000 +0100
1474
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1475
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1478
- #include "clamav-config.h"
1481
- #ifdef CL_EXPERIMENTAL
1484
#include "rentrant.h"
1488
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1489
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1493
#include "rentrant.h"
1498
#endif /* not DRAND48_R_WITH_DRAND48D */
1499
- #endif /*CL_EXPERIMENTAL*/
1501
*** /home/njh/src/clamav-devel/./libclamav/js/utils.c 2006-10-28 12:33:45.000000000 +0100
1502
--- ./libclamav/js/utils.c 2006-10-21 14:58:34.000000000 +0100
1507
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1508
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1511
- #include "clamav-config.h"
1514
- #ifdef CL_EXPERIMENTAL
1521
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1522
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1532
- #endif /*CL_EXPERIMENTAL*/
1534
*** /home/njh/src/clamav-devel/./libclamav/js/vm.c 2006-10-28 12:33:45.000000000 +0100
1535
--- ./libclamav/js/vm.c 2006-10-21 14:58:34.000000000 +0100
1540
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1541
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1544
- #include "clamav-config.h"
1547
- #ifdef CL_EXPERIMENTAL
1554
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1555
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1562
js_builtin_Object (vm);
1563
js_builtin_String (vm);
1565
- #endif /*CL_EXPERIMENTAL*/
1567
*** /home/njh/src/clamav-devel/./libclamav/js/vmjumps.c 2006-10-28 12:33:45.000000000 +0100
1568
--- ./libclamav/js/vmjumps.c 2006-10-21 14:58:34.000000000 +0100
1573
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1574
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1577
- #include "clamav-config.h"
1580
- #ifdef CL_EXPERIMENTAL
1587
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1588
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1596
#endif /* not (__GNUC__ && !DISABLE_JUMPS) */
1598
- #endif /*CL_EXPERIMENTAL*/
1600
*** /home/njh/src/clamav-devel/./libclamav/js/vmswitch.c 2006-10-28 12:33:45.000000000 +0100
1601
--- ./libclamav/js/vmswitch.c 2006-10-21 14:58:34.000000000 +0100
1606
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1607
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1610
- #include "clamav-config.h"
1613
- #ifdef CL_EXPERIMENTAL
1620
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1621
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1629
JS_COPY (&vm->exec_result, JS_SP1);
1631
- #endif /*CL_EXPERIMENTAL*/
1633
*** /home/njh/src/clamav-devel/./libclamav/js/xjs.c 2006-10-28 12:33:45.000000000 +0100
1634
--- ./libclamav/js/xjs.c 2006-10-21 14:58:34.000000000 +0100
1639
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1640
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1643
- #include "clamav-config.h"
1646
- #ifdef CL_EXPERIMENTAL
1649
#include "js/jsint.h"
1653
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1654
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1658
#include "js/jsint.h"
1662
js_vm_builtin_create (vm, n, info, NULL);
1664
- #endif /*CL_EXPERIMENTAL*/
1666
*** /home/njh/src/clamav-devel/./libclamav/js/xmd5.c 2006-10-28 12:33:45.000000000 +0100
1667
--- ./libclamav/js/xmd5.c 2006-10-21 14:58:34.000000000 +0100
1672
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1673
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1676
- #include "clamav-config.h"
1679
! #ifdef CL_EXPERIMENTAL
1681
! #include "jsint.h"
1685
* Types and definitions.
1689
* $Source: /cvsroot/clamav/clamav-devel/contrib/Windows/Projects/clamAV/patches,v $
1690
! * $Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $
1693
! #include "js/jsint.h"
1694
! #include "js/md5.h"
1697
* Types and definitions.
1700
n = &vm->globals[js_vm_intern (vm, "MD5")];
1701
js_vm_builtin_create (vm, n, info, NULL);
1703
- #endif /*CL_EXPERIMENTAL*/
1705
*** /home/njh/src/clamav-devel/./libclamav/js/jsconfig.h 2006-10-19 18:27:28.000000000 +0100
1706
--- ./libclamav/js/jsconfig.h 2006-10-21 16:12:36.000000000 +0100
1709
#define HAVE_STRING_H 1
1711
/* Define if you have the <unistd.h> header file. */
1712
! #define HAVE_UNISTD_H 1
1714
#define HAVE_STRING_H 1
1716
/* Define if you have the <unistd.h> header file. */
1717
! /* #undef HAVE_UNISTD_H 1 */
1718
*** /home/njh/src/clamav-devel/./libclamav/jscript.c 2006-12-13 15:25:34.000000000 +0000
1719
--- ./libclamav/jscript.c 2006-11-24 20:52:14.000000000 +0000
1722
* TODO: Add mailfollowurls type feature
1723
* TODO: Check the NGS code for vulnerabilities, leaks etc.
1724
* TODO: Check the NGS code is thread safe
1725
- * TODO: Test code such as
1727
- * document.writeln("<script> function f() { ..the real worm code..
1728
- * </script>"); f();
1731
! static char const rcsid[] = "$Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $";
1734
#include "clamav-config.h"
1736
* TODO: Add mailfollowurls type feature
1737
* TODO: Check the NGS code for vulnerabilities, leaks etc.
1738
* TODO: Check the NGS code is thread safe
1740
! static char const rcsid[] = "$Id: patches,v 1.16 2007/02/12 15:41:19 njh Exp $";
1743
#include "clamav-config.h"
1744
*** /home/njh/src/clamav-devel/./libclamav/lockdb.c 2007-02-11 16:26:35.000000000 +0000
1745
--- ./libclamav/lockdb.c 2007-02-11 16:26:52.000000000 +0000
1749
#define pthread_mutex_unlock(arg)
1753
+ #define DONT_LOCK_DBDIRS
1757
struct dblock *lock_link;
1758
char lock_file[NAME_MAX];
1759
*** /home/njh/src/clamav-devel/./libclamav/pdf.c 2007-02-10 21:25:35.000000000 +0000
1760
--- ./libclamav/pdf.c 2007-02-10 14:22:00.000000000 +0000
1766
! static int flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx);
1767
static int ascii85decode(const char *buf, off_t len, unsigned char *output);
1768
static const char *pdf_nextlinestart(const char *ptr, size_t len);
1769
static const char *pdf_nextobject(const char *ptr, size_t len);
1774
! static int flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx);
1775
static int ascii85decode(const char *buf, off_t len, unsigned char *output);
1776
static const char *pdf_nextlinestart(const char *ptr, size_t len);
1777
static const char *pdf_nextobject(const char *ptr, size_t len);
1780
if(buf == MAP_FAILED)
1783
! cli_dbgmsg("cli_pdf: scanning %lu bytes\n", (unsigned long)size);
1785
/* Lines are terminated by \r, \n or both */
1788
if(buf == MAP_FAILED)
1791
! cli_dbgmsg("cli_pdf: scanning %lu bytes\n", size);
1793
/* Lines are terminated by \r, \n or both */
1800
! cli_writen(fout, (const char *)streamstart, streamlen);
1803
} else if(is_flatedecode) {
1808
! cli_writen(fout, (char *)streamstart, streamlen);
1811
} else if(is_flatedecode) {
1817
! cli_dbgmsg("cli_pdf: writing %lu bytes from the stream\n",
1818
! (unsigned long)streamlen);
1819
! cli_writen(fout, (const char *)streamstart, streamlen);
1827
! cli_dbgmsg("cli_pdf: writing %u bytes from the stream\n",
1829
! cli_writen(fout, (char *)streamstart, streamlen);
1836
/* flate inflation - returns zlib status, e.g. Z_OK */
1838
! flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx)
1844
/* flate inflation - returns zlib status, e.g. Z_OK */
1846
! flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx)
1852
stream.zalloc = (alloc_func)Z_NULL;
1853
stream.zfree = (free_func)Z_NULL;
1854
stream.opaque = (void *)NULL;
1855
! stream.next_in = (Bytef *)buf;
1856
stream.avail_in = len;
1857
stream.next_out = output;
1858
stream.avail_out = sizeof(output);
1860
stream.zalloc = (alloc_func)Z_NULL;
1861
stream.zfree = (free_func)Z_NULL;
1862
stream.opaque = (void *)NULL;
1863
! stream.next_in = (unsigned char *)buf;
1864
stream.avail_in = len;
1865
stream.next_out = output;
1866
stream.avail_out = sizeof(output);
1871
} else if(!isspace(byte)) {
1872
! cli_warnmsg("ascii85Decode: invalid character 0x%x, len %lu\n",
1873
! byte & 0xFF, (unsigned long)len);
1880
} else if(!isspace(byte)) {
1881
! cli_warnmsg("ascii85Decode: invalid character 0x%x, len %lu\n", byte & 0xFF, len);
1885
*** /home/njh/src/clamav-devel/./clamscan/manager.c 2007-02-11 16:20:26.000000000 +0000
1886
--- ./clamscan/manager.c 2007-02-11 16:20:48.000000000 +0000
1891
#include <sys/stat.h>
1892
#include <sys/types.h>
1894
+ #include <sys/utime.h>
1896
#include <sys/wait.h>
1899
+ #ifdef HAVE_INITGROUPS
1903
+ #ifdef HAVE_UNISTD_H
1906
#include <sys/types.h>
1918
+ #define P_tmpdir "C:\\WINDOWS\\TEMP"
1921
static int scandirs(const char *dirname, struct cl_engine *engine, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options)
1923
return treewalk(dirname, engine, user, opt, limits, options, 1);
1928
/* njh@bandsman.co.uk: BeOS */
1929
! #if !defined(C_CYGWIN) && !defined(C_OS2) && !defined(C_BEOS)
1931
if((user = getpwnam(CLAMAVUSER)) == NULL) {
1932
logg("!Can't get information about user "CLAMAVUSER"\n");
1936
/* njh@bandsman.co.uk: BeOS */
1937
! #if !defined(C_CYGWIN) && !defined(C_OS2) && !defined(C_BEOS) && !defined(C_WINDOWS)
1939
if((user = getpwnam(CLAMAVUSER)) == NULL) {
1940
logg("!Can't get information about user "CLAMAVUSER"\n");
1944
options |= CL_SCAN_MAIL;
1946
if(opt_check(opt, "mail-follow-urls"))
1948
options |= CL_SCAN_MAILURL;
1950
+ logg("^Support for URLs downloading with libcurl not compiled in\n");
1954
if(opt_check(opt, "no-algorithmic"))
1958
* -3 -> external signal
1964
+ clamav_unpack(const char *prog, char **args, const char *tmpdir, const struct passwd *user, const struct optstruct *opt)
1966
+ /* TODO: use spamvp(P_WAIT, prog, args); */
1967
+ cli_errmsg("clamav_unpack is not supported under Windows yet\n");
1971
static int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struct passwd *user, const struct optstruct *opt)
1982
static void move_infected(const char *filename, const struct optstruct *opt)
1987
logg("*Scanning %s\n", filename);
1989
! if((fd = open(filename, O_RDONLY)) == -1) {
1990
logg("^Can't open file %s\n", filename);
1995
logg("*Scanning %s\n", filename);
1997
! if((fd = open(filename, O_RDONLY|O_BINARY)) == -1) {
1998
logg("^Can't open file %s\n", filename);
2003
tmpdir = getenv("TMPDIR");
2011
tmpdir = getenv("TMPDIR");
2020
exit(63); /* critical */
2025
chown(gendir, user->pw_uid, user->pw_gid);
2028
exit(63); /* critical */
2031
! #if (!defined(C_OS2)) && (!defined(C_WINDOWS))
2032
! /* FIXME: do the correct native windows way */
2034
chown(gendir, user->pw_uid, user->pw_gid);
2038
tmpdir = getenv("TMPDIR");
2046
tmpdir = getenv("TMPDIR");
2060
chown(gendir, user->pw_uid, user->pw_gid);
2061
chown(tmpfile, user->pw_uid, user->pw_gid);
2066
! #if (!defined(C_OS2)) && (!defined(C_WINDOWS))
2068
chown(gendir, user->pw_uid, user->pw_gid);
2069
chown(tmpfile, user->pw_uid, user->pw_gid);
2078
if(checkaccess(filename, NULL, R_OK) != 1) {
2080
logg("%s: Access denied\n", filename);
2087
*** /home/njh/src/clamav-devel/./clamscan/clamscan.c 2007-01-31 04:46:12.000000000 +0000
2088
--- ./clamscan/clamscan.c 2007-02-09 19:45:48.000000000 +0000
2095
+ #ifdef HAVE_UNISTD_H
2099
+ #include <fcntl.h>
2101
#include <sys/time.h>
2104
+ #include <ctype.h>
2106
#include <sys/resource.h>
2114
+ #if defined(C_WINDOWS) && defined(_DEBUG)
2115
+ #include <crtdbg.h>
2119
short recursion = 0, printinfected = 0, bell = 0;
2126
struct timeval t1, t2;
2130
struct optstruct *opt;
2133
+ #if defined(C_WINDOWS) && defined(CL_THREAD_SAFE)
2134
+ if(!pthread_win32_process_attach_np()) {
2135
+ mprintf("!Can't start the win32 pthreads layer\n");
2141
opt = opt_parse(argc, argv, clamscan_shortopt, clamscan_longopt, NULL);
2146
memset(&info, 0, sizeof(struct s_info));
2149
+ _set_fmode(_O_BINARY);
2152
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
2153
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
2157
+ gettimeofday(&t1, NULL);
2159
gettimeofday(&t1, &tz);
2162
ret = scanmanager(opt);
2164
if(!opt_check(opt, "disable-summary") && !opt_check(opt, "no-summary")) {
2166
+ gettimeofday(&t2, NULL);
2168
gettimeofday(&t2, &tz);
2170
ds = t2.tv_sec - t1.tv_sec;
2171
dms = t2.tv_usec - t1.tv_usec;
2172
ds -= (dms < 0) ? (1):(0);
2180
+ #if defined(C_WINDOWS) && defined(CL_THREAD_SAFE)
2181
+ if(!pthread_win32_process_detach_np()) {
2182
+ mprintf("!Can't stop the win32 pthreads layer\n");
2190
*** /home/njh/src/clamav-devel/./clamscan/treewalk.c 2007-01-31 04:46:12.000000000 +0000
2191
--- ./clamscan/treewalk.c 2007-01-31 09:37:40.000000000 +0000
2198
+ #ifdef HAVE_UNISTD_H
2201
#include <sys/stat.h>
2202
#include <sys/types.h>
2204
#include <sys/wait.h>
2206
+ #ifdef HAVE_INITGROUPS
2218
if((dd = opendir(dirname)) != NULL) {
2219
while((dent = readdir(dd))) {
2226
if((dd = opendir(dirname)) != NULL) {
2227
while((dent = readdir(dd))) {
2228
! #if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) && (!defined(C_CYGWIN))
2240
+ clamav_rmdirs(const char *dir)
2242
+ return rmdirs(dir);
2245
int clamav_rmdirs(const char *dir)
2256
int fixperms(const char *dirname)
2261
if((dd = opendir(dirname)) != NULL) {
2262
while((dent = readdir(dd))) {
2269
if((dd = opendir(dirname)) != NULL) {
2270
while((dent = readdir(dd))) {
2271
! #if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) && (!defined(C_CYGWIN))
2278
if((dd = opendir(dirname)) != NULL) {
2279
while((dent = readdir(dd))) {
2286
if((dd = opendir(dirname)) != NULL) {
2287
while((dent = readdir(dd))) {
2288
! #if (!defined(C_INTERIX)) && (!defined(C_WINDOWS)) && (!defined(C_CYGWIN))
2292
*** /home/njh/src/clamav-devel/./clamscan/treewalk.h 2007-01-31 04:46:12.000000000 +0000
2293
--- ./clamscan/treewalk.h 2007-01-31 09:37:34.000000000 +0000
2297
#ifndef __TREEWALK_H
2298
#define __TREEWALK_H
2304
#include "libclamav/clamav.h"
2305
#include "shared/options.h"
2307
*** /home/njh/src/clamav-devel/./clamscan/manager.h 2007-01-31 04:46:12.000000000 +0000
2308
--- ./clamscan/manager.h 2007-01-31 09:37:40.000000000 +0000
2316
#include "libclamav/clamav.h"
2317
! #include "shared/options.h"
2319
int scanmanager(const struct optstruct *opt);
2321
! int scanfile(const char *filename, struct cl_engine *engine, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, unsigned int options);
2328
#include "libclamav/clamav.h"
2332
! #include "options.h"
2334
int scanmanager(const struct optstruct *opt);
2336
! int scanfile(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options);
2338
! int scancompressed(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options);
2340
! int scandenied(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options);
2342
! int scandirs(const char *dirname, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options);
2344
! int checkfile(const char *filename, const struct cl_node *root, const struct cl_limits *limits, int options, short printclean);
2346
! int checkstdin(const struct cl_node *root, const struct cl_limits *limits, int options);
2348
! int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struct passwd *user, const struct optstruct *opt);
2350
! void move_infected(const char *filename, const struct optstruct *opt);
2353
! /* breaks mspack/qtmd.c :-( */
2354
! #define free(p) _free_dbg(p, _NORMAL_BLOCK)
2358
*** /home/njh/src/clamav-devel/./clamscan/others.c 2007-01-31 04:46:12.000000000 +0000
2359
--- ./clamscan/others.c 2006-07-26 16:03:16.000000000 +0100
2363
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2364
* MA 02110-1301, USA.
2366
+ * Sat May 18 15:20:26 CEST 2002: included detectCpu() from Magnus Ekdahl
2367
+ * Sat Jun 29 12:19:26 CEST 2002: fixed non386 detectCpu (Magnus Ekdahl)
2378
+ #ifdef HAVE_UNISTD_H
2385
#include <sys/types.h>
2386
#include <sys/stat.h>
2388
#include <sys/wait.h>
2389
#include <sys/time.h>
2399
! #include "shared/output.h"
2402
int fileinfo(const char *filename, short i)
2407
! #include "output.h"
2410
int fileinfo(const char *filename, short i)
2418
+ /* FIXME: Handle users correctly */
2420
+ checkaccess(const char *path, const char *username, int mode)
2422
+ return _access(path, mode);
2425
int checkaccess(const char *path, const char *username, int mode)
2427
struct passwd *user;
2436
int match_regex(const char *filename, const char *pattern)
2438
*** /home/njh/src/clamav-devel/./shared/getopt.c 2004-03-29 01:00:58.000000000 +0100
2439
--- ./shared/getopt.c 2006-07-26 16:49:38.000000000 +0100
2447
int strncmp(const char *s1, const char *s2, size_t n);
2450
/* Comment out all this code if we are using the GNU C Library, and are not
2451
actually compiling the library itself. This code is part of the GNU C
2452
*** /home/njh/src/clamav-devel/./shared/network.h 2006-04-09 20:59:28.000000000 +0100
2453
--- ./shared/network.h 2006-07-31 15:59:30.000000000 +0100
2460
+ #ifdef HAVE_SYS_TYPES_H
2461
#include <sys/types.h>
2468
int r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t len);
2470
*** /home/njh/src/clamav-devel/./shared/output.c 2006-08-31 09:03:18.000000000 +0100
2471
--- ./shared/output.c 2006-08-31 10:23:58.000000000 +0100
2475
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2476
* MA 02110-1301, USA.
2479
+ #include <windows.h>
2480
+ #include <winsock.h>
2485
#include "clamav-config.h"
2492
+ #ifdef HAVE_UNISTD_H
2497
#include <sys/stat.h>
2500
#include <sys/time.h>
2501
#include <sys/socket.h>
2503
#if HAVE_SYS_TYPES_H
2504
#include <sys/types.h>
2509
int logg(const char *str, ...)
2511
va_list args, argscpy, argsout;
2515
char *pt, *timestr, vbuff[1025];
2522
old_umask = umask(0037);
2523
! if((logg_fd = fopen(logg_file, "a")) == NULL) {
2525
#ifdef CL_THREAD_SAFE
2526
pthread_mutex_unlock(&logg_mutex);
2530
old_umask = umask(0037);
2531
! if((logg_fd = fopen(logg_file, "at")) == NULL) {
2533
#ifdef CL_THREAD_SAFE
2534
pthread_mutex_unlock(&logg_mutex);
2539
} else umask(old_umask);
2543
memset(&fl, 0, sizeof(fl));
2544
fl.l_type = F_WRLCK;
2555
*** /home/njh/src/clamav-devel/./shared/memory.h 2006-04-09 20:59:28.000000000 +0100
2556
--- ./shared/memory.h 2006-10-10 11:16:24.000000000 +0100
2560
void *mmalloc(size_t size);
2561
void *mcalloc(size_t nmemb, size_t size);
2564
+ #include <crtdbg.h>
2565
+ #define free(p) _free_dbg(p, _NORMAL_BLOCK)
2569
*** /home/njh/src/clamav-devel/./shared/memory.c 2007-02-11 11:43:29.000000000 +0000
2570
--- ./shared/memory.c 2007-02-11 15:02:08.000000000 +0000
2577
+ #ifdef HAVE_UNISTD_H
2582
void *mmalloc(size_t size)
2583
*** /home/njh/src/clamav-devel/./shared/cdiff.c 2007-02-11 11:43:29.000000000 +0000
2584
--- ./shared/cdiff.c 2007-02-11 15:06:46.000000000 +0000
2589
#include <sys/types.h>
2590
#include <sys/stat.h>
2591
+ #ifdef HAVE_UNISTD_H
2595
#include "shared/memory.h"
2596
#include "shared/misc.h"
2597
*** /home/njh/src/clamav-devel/./freshclam/manager.c 2007-02-12 13:30:50.000000000 +0000
2598
--- ./freshclam/manager.c 2007-02-12 13:32:08.000000000 +0000
2602
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2603
* MA 02110-1301, USA.
2607
+ #include <winsock.h> /* only needed in CL_EXPERIMENTAL */
2611
#include "clamav-config.h"
2618
+ #ifdef HAVE_UNISTD_H
2624
#include <netinet/in.h>
2627
#include <sys/types.h>
2629
#include <sys/socket.h>
2630
#include <sys/time.h>
2634
#include <sys/stat.h>
2642
+ #define closesocket(s) close(s)
2645
static int wwwconnect(const char *server, const char *proxy, int pport, char *ip, const char *localip, int ctimeout, struct mirdat *mdat)
2663
if((host = gethostbyname(hostpt)) == NULL) {
2666
case HOST_NOT_FOUND:
2667
herr = "Host not found";
2671
if((host = gethostbyname(hostpt)) == NULL) {
2674
case HOST_NOT_FOUND:
2675
herr = "Host not found";
2681
! if(write(sd, cmd, strlen(cmd)) < 0) {
2682
logg("!remote_cvdhead: write failed\n");
2691
! if(send(sd, cmd, strlen(cmd), 0) < 0) {
2692
logg("!remote_cvdhead: write failed\n");
2705
logg("!remote_cvdhead: Error while reading CVD header from %s\n", hostname);
2713
logg("!remote_cvdhead: Error while reading CVD header from %s\n", hostname);
2719
! if(write(sd, cmd, strlen(cmd)) < 0) {
2720
logg("!getfile: Can't write to socket\n");
2727
! if(send(sd, cmd, strlen(cmd), 0) < 0) {
2728
logg("!getfile: Can't write to socket\n");
2733
if((strstr(buffer, "HTTP/1.1 404")) != NULL || (strstr(buffer, "HTTP/1.0 404")) != NULL) {
2734
logg("!getfile: %s not found on remote server (IP: %s)\n", srcfile, ipaddr);
2735
/* mirman_update(mdat->currip, mdat, 1); */
2741
if((strstr(buffer, "HTTP/1.1 404")) != NULL || (strstr(buffer, "HTTP/1.0 404")) != NULL) {
2742
logg("!getfile: %s not found on remote server (IP: %s)\n", srcfile, ipaddr);
2743
/* mirman_update(mdat->currip, mdat, 1); */
2750
!strstr(buffer, "HTTP/1.1 206") && !strstr(buffer, "HTTP/1.0 206")) {
2751
logg("!getfile: Unknown response from remote server (IP: %s)\n", ipaddr);
2752
mirman_update(mdat->currip, mdat, 1);
2758
!strstr(buffer, "HTTP/1.1 206") && !strstr(buffer, "HTTP/1.0 206")) {
2759
logg("!getfile: Unknown response from remote server (IP: %s)\n", ipaddr);
2760
mirman_update(mdat->currip, mdat, 1);
2767
getcwd(currdir, sizeof(currdir));
2768
logg("!getfile: Can't create new file %s in %s\n", destfile, currdir);
2769
logg("Hint: The database directory must be writable for UID %d or GID %d\n", getuid(), getgid());
2775
getcwd(currdir, sizeof(currdir));
2776
logg("!getfile: Can't create new file %s in %s\n", destfile, currdir);
2777
logg("Hint: The database directory must be writable for UID %d or GID %d\n", getuid(), getgid());
2784
logg("getfile: Can't write %d bytes to %s\n", bread, destfile);
2788
return 57; /* FIXME */
2792
logg("getfile: Can't write %d bytes to %s\n", bread, destfile);
2796
return 57; /* FIXME */
2816
*** /home/njh/src/clamav-devel/./freshclam/execute.c 2007-02-11 16:30:34.000000000 +0000
2817
--- ./freshclam/execute.c 2007-02-11 16:25:36.000000000 +0000
2821
! * By Per Jessen <per@computer.org>
2823
* This program is free software; you can redistribute it and/or modify
2824
* it under the terms of the GNU General Public License as published by
2827
! * By Per Jessen <per@computer.org> with changes by the ClamAV team
2829
* This program is free software; you can redistribute it and/or modify
2830
* it under the terms of the GNU General Public License as published by
2837
+ #ifdef HAVE_UNISTD_H
2843
+ #include <process.h>
2846
#include "shared/output.h"
2847
#include "execute.h"
2852
void execute( const char *type, const char *text )
2855
+ if(active_children < MAX_CHILDREN) {
2856
+ if(spawnlp(P_DETACH, text, text, NULL) == -1) {
2857
+ logg("^%s: couldn't execute \"%s\".\n", type, text);
2860
+ active_children++; /* FIXME: this is never reduced */
2862
+ logg("^%s: already %d processes active.\n", type, active_children);
2866
if ( active_children<MAX_CHILDREN )
2871
logg("^%s: already %d processes active.\n", type, active_children);
2875
*** /home/njh/src/clamav-devel/./freshclam/nonblock.c 2007-01-31 04:43:08.000000000 +0000
2876
--- ./freshclam/nonblock.c 2007-02-10 16:40:54.000000000 +0000
2880
* along with this program; if not, write to the Free Software
2881
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2884
+ #include <winsock.h>
2888
#include "clamav-config.h"
2897
#include <netinet/in.h>
2899
#include <sys/types.h>
2900
! #include <sys/socket.h>
2901
#include <sys/time.h>
2904
#include <sys/stat.h>
2909
+ #ifdef HAVE_UNISTD_H
2915
#include <netinet/in.h>
2918
#include <sys/types.h>
2919
! /*#include <sys/socket.h> /* in nonblock.h */
2921
#include <sys/time.h>
2925
#include <sys/stat.h>
2929
#include "shared/output.h"
2930
#include "libclamav/clamav.h"
2932
+ #if (!defined(EALREADY)) && (defined(WSAEALREADY))
2933
+ #define EALREADY WSAEALREADY
2935
+ #if (!defined(EINPROGRESS)) && (defined(WSAEINPROGRESS))
2936
+ #define EINPROGRESS WSAEINPROGRESS
2938
+ #if (!defined(EISCONN)) && (defined(WSAEISCONN))
2939
+ #define EISCONN WSAEISCONN
2949
static long nonblock_fcntl(int sock)
2952
long fcntl_flags; /* Save fcntl() flags */
2954
fcntl_flags = fcntl(sock, F_GETFL, 0);
2966
static void restore_fcntl(int sock, long fcntl_flags)
2969
if (fcntl_flags != -1) {
2970
if (fcntl(sock, F_SETFL, fcntl_flags)) {
2971
logg("restore_fcntl: restoring: fcntl(%d, F_SETFL): errno=%d: %s\n",
2972
sock, errno, strerror(errno));
2979
*** /home/njh/src/clamav-devel/./freshclam/nonblock.h 2006-09-04 09:24:02.000000000 +0100
2980
--- ./freshclam/nonblock.h 2006-09-04 10:35:10.000000000 +0100
2986
#include <sys/types.h>
2988
#include <sys/socket.h>
2992
wait_connect(): wrapper for connect(), with explicit 'secs' timeout
2993
*** /home/njh/src/clamav-devel/./freshclam/notify.c 2007-02-11 16:25:00.000000000 +0000
2994
--- ./freshclam/notify.c 2007-02-11 16:24:48.000000000 +0000
2998
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
2999
* MA 02110-1301, USA.
3002
+ #include <windows.h>
3003
+ #include <winsock.h>
3008
#include "clamav-config.h"
3015
+ #ifdef HAVE_UNISTD_H
3018
#include <sys/types.h>
3020
#include <sys/socket.h>
3022
#include <netinet/in.h>
3023
#include <arpa/inet.h>
3028
#include "shared/cfgparser.h"
3029
#include "shared/output.h"
3033
+ #define closesocket(s) close(s)
3036
int notify(const char *cfgfile)
3040
struct sockaddr_un server;
3042
struct sockaddr_in server2;
3044
struct cfgstruct *copt, *cpt;
3052
if((cpt = cfgopt(copt, "LocalSocket"))->enabled) {
3054
server.sun_family = AF_UNIX;
3059
if(connect(sockd, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) {
3061
logg("^Clamd was NOT notified: Can't connect to clamd through %s\n", cpt->strarg);
3062
perror("connect()");
3066
! } else if((cpt = cfgopt(copt, "TCPSocket"))->enabled) {
3073
if(connect(sockd, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) {
3074
! closesocket(sockd);
3075
logg("^Clamd was NOT notified: Can't connect to clamd through %s\n", cpt->strarg);
3076
perror("connect()");
3082
! if((cpt = cfgopt(copt, "TCPSocket"))->enabled) {
3090
if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
3092
logg("^Clamd was NOT notified: Can't connect to clamd on %s:%d\n",
3093
inet_ntoa(server2.sin_addr), ntohs(server2.sin_port));
3094
perror("connect()");
3098
if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
3099
! closesocket(sockd);
3100
logg("^Clamd was NOT notified: Can't connect to clamd on %s:%d\n",
3101
inet_ntoa(server2.sin_addr), ntohs(server2.sin_port));
3102
perror("connect()");
3108
! if(write(sockd, "RELOAD", 6) < 0) {
3109
logg("^Clamd was NOT notified: Could not write to %s socket\n", socktype);
3115
/* TODO: Handle timeout */
3116
memset(buff, 0, sizeof(buff));
3117
! if((bread = read(sockd, buff, sizeof(buff))) > 0)
3118
if(!strstr(buff, "RELOADING")) {
3119
logg("^Clamd was NOT notified: Unknown answer from clamd: '%s'\n", buff);
3125
logg("Clamd successfully notified about the update.\n");
3132
! if(send(sockd, "RELOAD", 6, 0) < 0) {
3133
logg("^Clamd was NOT notified: Could not write to %s socket\n", socktype);
3135
! closesocket(sockd);
3139
/* TODO: Handle timeout */
3140
memset(buff, 0, sizeof(buff));
3141
! if((bread = recv(sockd, buff, sizeof(buff), 0)) > 0)
3142
if(!strstr(buff, "RELOADING")) {
3143
logg("^Clamd was NOT notified: Unknown answer from clamd: '%s'\n", buff);
3144
! closesocket(sockd);
3148
! closesocket(sockd);
3149
logg("Clamd successfully notified about the update.\n");
3152
*** /home/njh/src/clamav-devel/./clamd/server-th.c 2007-02-12 15:39:21.000000000 +0000
3153
--- ./clamd/server-th.c 2007-02-12 15:39:54.000000000 +0000
3157
logg("*Listening daemon: PID: %d\n", getpid());
3158
max_threads = cfgopt(copt, "MaxThreads")->numarg;
3161
if(cfgopt(copt, "ScanArchive")->enabled) {
3169
! struct stat st_buf;
3170
int socketd = socketds[0];
3172
int pollret = poll_fds(socketds, nsockets, -1);
3177
! #if !defined(C_WINDOWS) && !defined(C_BEOS)
3178
! struct stat st_buf;
3180
int socketd = socketds[0];
3182
int pollret = poll_fds(socketds, nsockets, -1);
3186
socketd = socketds[0]; /* on a poll error use the first socket */
3189
if(fstat(socketd, &st_buf) == -1) {
3190
logg("!fstat(): socket descriptor gone\n");
3191
memmove(socketds, socketds + 1, sizeof(socketds[0]) * nsockets);
3194
socketd = socketds[0]; /* on a poll error use the first socket */
3197
! #if !defined(C_WINDOWS) && !defined(C_BEOS)
3198
if(fstat(socketd, &st_buf) == -1) {
3199
logg("!fstat(): socket descriptor gone\n");
3200
memmove(socketds, socketds + 1, sizeof(socketds[0]) * nsockets);
3208
new_sd = accept(socketd, NULL, NULL);
3209
if((new_sd == -1) && (errno != EINTR)) {
3211
*** /home/njh/src/clamav-devel/./clamd/localserver.c 2007-02-11 16:14:40.000000000 +0000
3212
--- ./clamd/localserver.c 2007-02-11 16:15:10.000000000 +0000
3218
#include <sys/types.h>
3220
#include <sys/socket.h>
3222
#include <sys/stat.h>
3227
#ifdef HAVE_UNISTD_H
3229
*** /home/njh/src/clamav-devel/./clamdscan/clamdscan.c 2007-02-11 16:10:59.000000000 +0000
3230
--- ./clamdscan/clamdscan.c 2007-02-11 16:11:26.000000000 +0000
3234
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
3235
* MA 02110-1301, USA.
3239
+ #include <windows.h>
3240
+ #include <winsock.h>
3244
#include "clamav-config.h"
3251
+ #ifdef HAVE_UNISTD_H
3255
+ #ifdef CL_THREAD_SAFE
3256
+ #include <pthread.h>
3259
#include <sys/time.h>
3267
int ds, dms, ret, infected;
3268
struct timeval t1, t2;
3271
struct optstruct *opt;
3272
const char *clamdscan_accepted[] = { "help", "version", "verbose", "quiet",
3273
"stdout", "log", "move", "copy", "remove",
3274
"config-file", "no-summary",
3275
"disable-summary", "multiscan", NULL };
3278
opt = opt_parse(argc, argv, clamscan_shortopt, clamscan_longopt, clamdscan_accepted);
3282
int ds, dms, ret, infected;
3283
struct timeval t1, t2;
3288
struct optstruct *opt;
3289
const char *clamdscan_accepted[] = { "help", "version", "verbose", "quiet",
3290
"stdout", "log", "move", "copy", "remove",
3291
"config-file", "no-summary",
3292
"disable-summary", "multiscan", NULL };
3295
! if(!pthread_win32_process_attach_np()) {
3296
! mprintf("!Can't start the win32 pthreads layer\n");
3301
opt = opt_parse(argc, argv, clamscan_shortopt, clamscan_longopt, clamdscan_accepted);
3306
/* ctime() does \n, but I need it once more */
3308
! gettimeofday(&t1, &tz);
3310
ret = client(opt, &infected);
3312
/* TODO: Implement STATUS in clamd */
3313
if(!opt_check(opt, "disable-summary") && !opt_check(opt, "no-summary")) {
3314
gettimeofday(&t2, &tz);
3315
ds = t2.tv_sec - t1.tv_sec;
3316
dms = t2.tv_usec - t1.tv_usec;
3317
ds -= (dms < 0) ? (1):(0);
3320
/* ctime() does \n, but I need it once more */
3323
! gettimeofday(&t1, NULL);
3325
! gettimeofday(&t1, &tz);
3328
ret = client(opt, &infected);
3330
/* TODO: Implement STATUS in clamd */
3331
if(!opt_check(opt, "disable-summary") && !opt_check(opt, "no-summary")) {
3333
+ gettimeofday(&t2, NULL);
3335
gettimeofday(&t2, &tz);
3337
ds = t2.tv_sec - t1.tv_sec;
3338
dms = t2.tv_usec - t1.tv_usec;
3339
ds -= (dms < 0) ? (1):(0);
3349
+ if(!pthread_win32_process_detach_np()) {
3350
+ mprintf("!Can't stop the win32 pthreads layer\n");
3358
*** /home/njh/src/clamav-devel/./clamdscan/client.c 2007-02-11 16:10:59.000000000 +0000
3359
--- ./clamdscan/client.c 2007-02-11 16:11:16.000000000 +0000
3363
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
3364
* MA 02110-1301, USA.
3367
+ #include <winsock.h>
3371
#include "clamav-config.h"
3375
+ #ifdef HAVE_UNISTD_H
3379
#include <sys/types.h>
3380
#include <sys/stat.h>
3382
#include <sys/socket.h>
3384
#include <netinet/in.h>
3385
#include <arpa/inet.h>
3391
#ifdef HAVE_SYS_UIO_H
3395
# define SOCKET_INET AF_INET
3399
+ #define closesocket(s) close(s)
3402
/* #define ENABLE_FD_PASSING FIXME: Doesn't work yet */
3404
void move_infected(const char *filename, const struct optstruct *opt);
3405
int notremoved = 0, notmoved = 0;
3406
static int ncore = 0;
3409
+ static int get_a_line(int sockd, char *buf, size_t len);
3412
+ dsresult(int sockd, const struct optstruct *opt)
3414
+ char buff[BUFSIZ], *pt;
3415
+ int infected = 0, waserror = 0;
3417
+ while(get_a_line(sockd, buff, sizeof(buff))) {
3418
+ if(strstr(buff, "FOUND\n")) {
3421
+ if(opt_check(opt, "move") || opt_check(opt, "copy")) {
3422
+ /* filename: Virus FOUND */
3423
+ if((pt = strrchr(buff, ':'))) {
3425
+ move_infected(buff, opt);
3427
+ mprintf("@Broken data format. File not %s.\n", opt_check(opt, "move") ? "moved" : "copied");
3428
+ } else if(opt_check(opt, "remove")) {
3429
+ if(!(pt = strrchr(buff, ':')))
3430
+ mprintf("@Broken data format. File not removed.\n");
3433
+ if(unlink(buff)) {
3434
+ mprintf("%s: Can't remove.\n", buff);
3435
+ logg("%s: Can't remove.\n", buff);
3438
+ mprintf("%s: Removed.\n", buff);
3439
+ logg("%s: Removed.\n", buff);
3445
+ if(strstr(buff, "ERROR\n")) {
3451
+ return infected ? infected : (waserror ? -1 : 0);
3455
+ get_a_line(int sockd, char *buf, size_t len)
3459
+ for(ptr = buf; ptr < &buf[len]; ptr++) {
3460
+ /* FIXME: very inefficient to call recv so many times */
3461
+ if(recv(sockd, ptr, sizeof(char), 0) <= 0)
3463
+ if(*ptr == '\n') {
3472
static int dsresult(int sockd, const struct optstruct *opt)
3474
int infected = 0, waserror = 0;
3481
if((fd = fdopen(dup(sockd), "r")) == NULL) {
3482
! #else /* FIXME: accoriding to YD OS/2 does not support dup() for sockets */
3483
! if((fd = fdopen(sockd, "r")) == NULL) {
3485
logg("^Can't open descriptor for reading.\n");
3492
if((fd = fdopen(dup(sockd), "r")) == NULL) {
3493
! #else /* FIXME: according to YD OS/2 does not support dup() for sockets */
3494
! if((fd = fdopen(sockd, "rb")) == NULL) {
3496
logg("^Can't open descriptor for reading.\n");
3500
if(strstr(buff, "FOUND\n")) {
3503
! if(opt_check(opt, "move") || opt_check(opt, "copy")) {
3504
/* filename: Virus FOUND */
3505
if((pt = strrchr(buff, ':'))) {
3507
move_infected(buff, opt);
3509
! mprintf("@Broken data format. File not %s.\n", opt_check(opt, "move") ? "moved" : "copied");
3512
} else if(opt_check(opt, "remove")) {
3514
if(strstr(buff, "FOUND\n")) {
3517
! if(opt_check(opt, "move")) {
3518
/* filename: Virus FOUND */
3519
if((pt = strrchr(buff, ':'))) {
3521
move_infected(buff, opt);
3523
! mprintf("@Broken data format. File not moved.\n");
3526
} else if(opt_check(opt, "remove")) {
3531
return infected ? infected : (waserror ? -1 : 0);
3533
+ #endif /* C_WINDOWS */
3535
static int dsfile(int sockd, const char *scantype, const char *filename, const struct optstruct *opt)
3539
scancmd = mcalloc(strlen(filename) + 20, sizeof(char));
3540
sprintf(scancmd, "%s %s", scantype, filename);
3542
! if(write(sockd, scancmd, strlen(scancmd)) <= 0) {
3543
logg("^Can't write to the socket.\n");
3547
scancmd = mcalloc(strlen(filename) + 20, sizeof(char));
3548
sprintf(scancmd, "%s %s", scantype, filename);
3550
! if(send(sockd, scancmd, strlen(scancmd), 0) <= 0) {
3551
logg("^Can't write to the socket.\n");
3556
char buff[4096], *pt;
3559
! if(write(sockd, "STREAM", 6) <= 0) {
3560
logg("^Can't write to the socket.\n");
3564
char buff[4096], *pt;
3567
! if(send(sockd, "STREAM", 6, 0) <= 0) {
3568
logg("^Can't write to the socket.\n");
3575
static int dconnect(const struct optstruct *opt)
3578
struct sockaddr_un server;
3580
struct sockaddr_in server2;
3582
struct cfgstruct *copt, *cpt;
3588
memset((char *) &server, 0, sizeof(server));
3589
memset((char *) &server2, 0, sizeof(server2));
3591
/* Set default address to connect to */
3592
server2.sin_addr.s_addr = inet_addr("127.0.0.1");
3594
- if((cpt = cfgopt(copt, "LocalSocket"))->enabled) {
3596
server.sun_family = AF_UNIX;
3597
strncpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
3604
memset((char *) &server, 0, sizeof(server));
3606
memset((char *) &server2, 0, sizeof(server2));
3608
/* Set default address to connect to */
3609
server2.sin_addr.s_addr = inet_addr("127.0.0.1");
3612
+ if((cpt = cfgopt(copt, "LocalSocket"))->enabled) {
3614
+ logg("^LocalSocket is not supported under Windows");
3616
server.sun_family = AF_UNIX;
3617
strncpy(server.sun_path, cpt->strarg, sizeof(server.sun_path));
3627
} else if((cpt = cfgopt(copt, "TCPSocket"))->enabled) {
3631
+ if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
3632
+ logg("!Error at WSAStartup(): %d\n", WSAGetLastError());
3637
if((sockd = socket(SOCKET_INET, SOCK_STREAM, 0)) < 0) {
3642
if((cpt = cfgopt(copt, "TCPAddr"))->enabled) {
3643
if ((he = gethostbyname(cpt->strarg)) == 0) {
3645
perror("gethostbyname()");
3646
logg("^Can't lookup clamd hostname.\n");
3650
if((cpt = cfgopt(copt, "TCPAddr"))->enabled) {
3651
if ((he = gethostbyname(cpt->strarg)) == 0) {
3652
! closesocket(sockd);
3653
perror("gethostbyname()");
3654
logg("^Can't lookup clamd hostname.\n");
3660
if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
3662
perror("connect()");
3663
logg("^Can't connect to clamd.\n");
3668
if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
3669
! closesocket(sockd);
3670
perror("connect()");
3671
logg("^Can't connect to clamd.\n");
3680
#if defined(ENABLE_FD_PASSING) && defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN)
3681
} else if(!strcmp(opt->filename, "-")) { /* scan data from stdin */
3686
! closesocket(sockd);
3688
#if defined(ENABLE_FD_PASSING) && defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN)
3689
} else if(!strcmp(opt->filename, "-")) { /* scan data from stdin */
3703
! closesocket(sockd);
3709
struct stat fstat, mfstat;
3710
int n, len, movefilename_size;
3711
int moveflag = opt_check(opt, "move");
3712
struct utimbuf ubuf;
3715
if((moveflag && !(movedir = opt_arg(opt, "move"))) ||
3716
! (!moveflag && !(movedir = opt_arg(opt, "copy")))) {
3717
/* Should never reach here */
3718
logg("^opt_arg() returned NULL\n");
3721
struct stat fstat, mfstat;
3722
int n, len, movefilename_size;
3723
int moveflag = opt_check(opt, "move");
3725
struct utimbuf ubuf;
3729
if((moveflag && !(movedir = opt_arg(opt, "move"))) ||
3730
! (!moveflag && !(movedir = opt_arg(opt, "copy")))) {
3731
/* Should never reach here */
3732
logg("^opt_arg() returned NULL\n");
3739
! if(!moveflag || rename(filename, movefilename) == -1) {
3740
if(filecopy(filename, movefilename) == -1) {
3741
logg("^cannot %s '%s' to '%s': %s\n", (moveflag) ? "move" : "copy", filename, movefilename, strerror(errno));
3747
! if(rename(filename, movefilename) == -1) {
3748
if(filecopy(filename, movefilename) == -1) {
3749
logg("^cannot %s '%s' to '%s': %s\n", (moveflag) ? "move" : "copy", filename, movefilename, strerror(errno));
3754
chmod(movefilename, fstat.st_mode);
3755
chown(movefilename, fstat.st_uid, fstat.st_gid);
3758
ubuf.actime = fstat.st_atime;
3759
ubuf.modtime = fstat.st_mtime;
3760
utime(movefilename, &ubuf);
3763
if(moveflag && unlink(filename)) {
3764
logg("^cannot unlink '%s': %s\n", filename, strerror(errno));
3770
! logg("%s: %s to '%s'\n", (moveflag)?"moved":"copied", filename, movefilename);
3778
! logg("%s: %s to '%s'\n", (moveflag) ? "moved" : "copied", filename, movefilename);
3782
*** /home/njh/src/clamav-devel/./clamconf/clamconf.c 2007-02-11 16:13:08.000000000 +0000
3783
--- ./clamconf/clamconf.c 2007-02-11 16:12:52.000000000 +0000
3788
#include <sys/types.h>
3789
#include <sys/stat.h>
3790
+ #ifdef HAVE_UNISTD_H
3794
#include "cfgparser.h"
3796
*** /home/njh/src/clamav-devel/./sigtool/sigtool.c 2007-02-10 00:08:29.000000000 +0000
3797
--- ./sigtool/sigtool.c 2006-11-05 10:16:14.000000000 +0000
3802
#include <netinet/in.h>
3803
#include <arpa/inet.h>
3804
+ #include <clamav.h>
3805
#include <sys/wait.h>
3810
#include "shared/misc.h"
3811
#include "shared/cdiff.h"
3813
- #include "libclamav/clamav.h"
3814
#include "libclamav/cvd.h"
3815
#include "libclamav/others.h"
3816
#include "libclamav/str.h"
3822
char *newname, buff[512], *decoded;
3823
! int fd1, fd2, bytes;
3826
fname = opt_arg(opt, "utf16-decode");
3830
char *newname, buff[512], *decoded;
3831
! int ret = CL_CLEAN, fd1, fd2, bytes;
3834
fname = opt_arg(opt, "utf16-decode");
3840
- if((pt = getenv("SIGNDPASS"))) {
3841
- strncpy(pass, pt, sizeof(pass));
3844
- mprintf("Password: ");
3846
- #ifdef HAVE_TERMIOS_H
3847
- if(tcgetattr(0, &old)) {
3848
- mprintf("!getdsig: tcgetattr() failed\n");
3852
- new.c_lflag &= ~ECHO;
3853
- if(tcsetattr(0, TCSAFLUSH, &new)) {
3854
- mprintf("!getdsig: tcsetattr() failed\n");
3859
- if(fgets(pass, sizeof(pass), stdin)) {
3862
- mprintf("!getdsig: Can't get password\n");
3866
- #ifdef HAVE_TERMIOS_H
3867
- if(tcsetattr(0, TCSAFLUSH, &old)) {
3868
- mprintf("!getdsig: tcsetattr() failed\n", host);
3869
- memset(pass, 0, strlen(pass));
3877
if((sockd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
3884
mprintf("!getdsig: Can't create socket\n");
3885
- memset(pass, 0, strlen(pass));
3893
perror("connect()");
3894
mprintf("!getdsig: Can't connect to ClamAV Signing Service at %s\n", host);
3895
- memset(pass, 0, strlen(pass));
3898
memset(cmd, 0, sizeof(cmd));
3901
snprintf(cmd, sizeof(cmd) - datalen, "ClamSignPSS:%s:%s:", user, pass);
3905
perror("connect()");
3906
mprintf("!getdsig: Can't connect to ClamAV Signing Service at %s\n", host);
3910
memset(cmd, 0, sizeof(cmd));
3913
+ mprintf("Password: ");
3915
+ #ifdef HAVE_TERMIOS_H
3916
+ if(tcgetattr(0, &old)) {
3917
+ mprintf("!getdsig: tcgetattr() failed\n", host);
3922
+ new.c_lflag &= ~ECHO;
3923
+ if(tcsetattr(0, TCSAFLUSH, &new)) {
3924
+ mprintf("!getdsig: tcsetattr() failed\n", host);
3930
+ if(fgets(pass, sizeof(pass), stdin)) {
3933
+ mprintf("!getdsig: Can't get password\n");
3938
+ #ifdef HAVE_TERMIOS_H
3939
+ if(tcsetattr(0, TCSAFLUSH, &old)) {
3940
+ mprintf("!getdsig: tcsetattr() failed\n", host);
3948
snprintf(cmd, sizeof(cmd) - datalen, "ClamSignPSS:%s:%s:", user, pass);
3952
memset(pass, 0, strlen(pass));
3953
memset(buff, 0, sizeof(buff));
3955
! if((bread = cli_readn(sockd, buff, sizeof(buff))) > 0) {
3956
if(!strstr(buff, "Signature:")) {
3957
mprintf("!getdsig: Error generating digital signature\n");
3958
mprintf("!getdsig: Answer from remote server: %s\n", buff);
3962
! mprintf("Signature received (length = %u)\n", strlen(buff) - 10);
3965
- mprintf("!getdsig: Communication error with remote server\n");
3976
memset(pass, 0, strlen(pass));
3977
memset(buff, 0, sizeof(buff));
3979
! if((bread = read(sockd, buff, sizeof(buff))) > 0) {
3980
if(!strstr(buff, "Signature:")) {
3981
mprintf("!getdsig: Error generating digital signature\n");
3982
mprintf("!getdsig: Answer from remote server: %s\n", buff);
3986
! /* mprintf("Signature received (length = %d)\n", strlen(buff) - 10); */
3998
char file[32], *md5;
3999
! char *extlist[] = { "db", "fp", "hdb", "mdb", "ndb", "pdb", "rmd", "zmd", "sdb", "cfg", NULL };
4002
snprintf(file, sizeof(file), "%s.info", db);
4006
char file[32], *md5;
4007
! char *extlist[] = { "db", "fp", "hdb", "mdb", "ndb", "pdb", "rmd", "zmd", "sdb", NULL };
4010
snprintf(file, sizeof(file), "%s.info", db);
4014
int ret, inc = 1, dn;
4016
! unsigned int sigs = 0, oldsigs = 0, lines = 0, version, real_header, fl;
4018
char buffer[FILEBUFF], *tarfile, *gzfile, header[513], smbuff[32],
4019
builder[32], *pt, *dbname, olddb[512], patch[32], broken[32];
4020
! struct cl_engine *engine = NULL;
4026
int ret, inc = 1, dn;
4028
! unsigned int sigs = 0, oldsigs = 0, lines = 0, version, real_header;
4030
char buffer[FILEBUFF], *tarfile, *gzfile, header[513], smbuff[32],
4031
builder[32], *pt, *dbname, olddb[512], patch[32], broken[32];
4032
! struct cl_node *root = NULL;
4041
! if((ret = cl_load(".", &engine, &sigs, CL_DB_STDOPT))) {
4042
mprintf("!build: Can't load database: %s\n", cl_strerror(ret));
4053
! if((ret = cl_loaddbdir(".", &root, &sigs))) {
4054
mprintf("!build: Can't load database: %s\n", cl_strerror(ret));
4063
countlines("main.fp") + countlines("daily.fp");
4066
! mprintf("^build: Signatures in database: %d, loaded by libclamav: %d\n", lines, sigs);
4067
! mprintf("^build: Please check the current directory and remove unnecessary databases\n");
4068
! mprintf("^build: or install the latest ClamAV version.\n");
4073
countlines("main.fp") + countlines("daily.fp");
4076
! mprintf("!build: Signatures in database: %d, loaded by libclamav: %d\n", lines, sigs);
4077
! mprintf("!build: Please check the current directory and remove unnecessary databases\n");
4078
! mprintf("!build: or install the latest ClamAV version.\n");
4089
! if(opt->filename) {
4090
! if(cli_strbcasestr(opt->filename, ".cvd")) {
4091
! strncpy(olddb, opt->filename, sizeof(olddb));
4093
! } else if(cli_strbcasestr(opt->filename, ".inc")) {
4094
! snprintf(olddb, sizeof(olddb), "%s/%s.info", opt->filename, dbname);
4096
! mprintf("!build: The optional argument points to neither CVD nor incremental directory\n");
4101
! pt = freshdbdir();
4102
! snprintf(olddb, sizeof(olddb), "%s/%s.inc/%s.info", pt, dbname, dbname);
4103
! if(stat(olddb, &foo) == -1) {
4105
! snprintf(olddb, sizeof(olddb), "%s/%s.cvd", pt, dbname);
4110
if(!(oldcvd = cl_cvdhead(olddb))) {
4111
! mprintf("^build: CAN'T READ CVD HEADER OF CURRENT DATABASE %s\n", olddb);
4119
! pt = freshdbdir();
4120
! snprintf(olddb, sizeof(olddb), "%s/%s.inc/%s.info", pt, dbname, dbname);
4121
! if(stat(olddb, &foo) == -1) {
4123
! snprintf(olddb, sizeof(olddb), "%s/%s.cvd", pt, dbname);
4128
if(!(oldcvd = cl_cvdhead(olddb))) {
4129
! mprintf("^build: CAN'T READ CVD HEADER OF CURRENT DATABASE %s\n", buffer);
4135
strcat(header, smbuff);
4137
/* functionality level */
4138
! if(!strcmp(dbname, "main")) {
4140
! mprintf("Functionality level: ");
4143
! fl = cl_retflevel();
4145
! sprintf(smbuff, "%u:", fl);
4146
strcat(header, smbuff);
4148
real_header = strlen(header);
4150
strcat(header, smbuff);
4152
/* functionality level */
4153
! sprintf(smbuff, "%d:", cl_retflevel());
4154
strcat(header, smbuff);
4156
real_header = strlen(header);
4159
/* add fake MD5 and dsig (for writeinfo) */
4160
strcat(header, "X:X:");
4162
! if((pt = getenv("SIGNDUSER"))) {
4163
! strncpy(builder, pt, sizeof(builder));
4165
! /* ask for builder name */
4167
! mprintf("Builder name: ");
4168
! if(fgets(builder, sizeof(builder), stdin)) {
4169
! cli_chomp(builder);
4171
! mprintf("!build: Can't get builder name\n");
4178
/* add fake MD5 and dsig (for writeinfo) */
4179
strcat(header, "X:X:");
4181
! /* ask for builder name */
4183
! mprintf("Builder name: ");
4184
! if(fgets(builder, sizeof(builder), stdin)) {
4185
! cli_chomp(builder);
4187
! mprintf("!build: Can't get builder name\n");
4194
"daily.fp", "main.mdb", "daily.mdb",
4195
"daily.info", "main.info", "main.wdb",
4196
"daily.wdb", "main.pdb", "daily.pdb",
4197
- "main.cfg", "daily.cfg",
4200
if(!opt_check(opt, "debug")) {
4204
mprintf("Created %s\n", pt);
4206
/* generate patch */
4207
! if(opt->filename) {
4208
! strncpy(olddb, opt->filename, sizeof(olddb));
4211
! pt = freshdbdir();
4212
! snprintf(olddb, sizeof(olddb), "%s/%s.inc", pt, dbname);
4215
! pt = freshdbdir();
4216
! snprintf(olddb, sizeof(olddb), "%s/%s.cvd", pt, dbname);
4222
pt = cli_gentemp(NULL);
4223
if(mkdir(pt, 0700)) {
4224
mprintf("!build: Can't create temporary directory %s\n", pt);
4226
mprintf("Created %s\n", pt);
4228
/* generate patch */
4230
! pt = freshdbdir();
4231
! snprintf(olddb, sizeof(olddb), "%s/%s.inc", pt, dbname);
4234
! pt = freshdbdir();
4235
! snprintf(olddb, sizeof(olddb), "%s/%s.cvd", pt, dbname);
4238
pt = cli_gentemp(NULL);
4239
if(mkdir(pt, 0700)) {
4240
mprintf("!build: Can't create temporary directory %s\n", pt);
4243
mprintf(" --html-normalise=FILE create normalised parts of HTML file\n");
4244
mprintf(" --utf16-decode=FILE decode UTF16 encoded files\n");
4245
mprintf(" --info=FILE -i FILE print database information\n");
4246
! mprintf(" --build=NAME [cvd/inc] -b NAME build a CVD file\n");
4247
mprintf(" --server=ADDR ClamAV Signing Service address\n");
4248
mprintf(" --unpack=FILE -u FILE Unpack a CVD file\n");
4249
mprintf(" --unpack-current=SHORTNAME Unpack local CVD/INCDIR in cwd\n");
4250
mprintf(" --list-sigs[=FILE] -l[FILE] List signature names\n");
4251
mprintf(" --vba=FILE Extract VBA/Word6 macro code\n");
4252
mprintf(" --vba-hex=FILE Extract Word6 macro code with hex values\n");
4253
mprintf(" --diff=OLD NEW -d OLD NEW Create diff for OLD and NEW CVDs\n");
4254
mprintf(" --run-cdiff=FILE -r FILE Execute update script FILE in cwd\n");
4255
mprintf(" --verify-cdiff=DIFF CVD/INCDIR Verify DIFF against CVD\n");
4257
mprintf(" --html-normalise=FILE create normalised parts of HTML file\n");
4258
mprintf(" --utf16-decode=FILE decode UTF16 encoded files\n");
4259
mprintf(" --info=FILE -i FILE print database information\n");
4260
! mprintf(" --build=NAME -b NAME build a CVD file\n");
4261
mprintf(" --server=ADDR ClamAV Signing Service address\n");
4262
mprintf(" --unpack=FILE -u FILE Unpack a CVD file\n");
4263
mprintf(" --unpack-current=SHORTNAME Unpack local CVD/INCDIR in cwd\n");
4264
mprintf(" --list-sigs[=FILE] -l[FILE] List signature names\n");
4265
mprintf(" --vba=FILE Extract VBA/Word6 macro code\n");
4266
mprintf(" --vba-hex=FILE Extract Word6 macro code with hex values\n");
4267
+ mprintf(" --vba-hex=FILE Extract Word6 macro code with hex values\n");
4268
mprintf(" --diff=OLD NEW -d OLD NEW Create diff for OLD and NEW CVDs\n");
4269
mprintf(" --run-cdiff=FILE -r FILE Execute update script FILE in cwd\n");
4270
mprintf(" --verify-cdiff=DIFF CVD/INCDIR Verify DIFF against CVD\n");
4271
*** /home/njh/src/clamav-devel/./sigtool/vba.c 2007-02-11 14:41:15.000000000 +0000
4272
--- ./sigtool/vba.c 2006-11-05 10:16:14.000000000 +0000
4275
#include <sys/stat.h>
4280
! #include "libclamav/clamav.h"
4281
! #include "libclamav/vba_extract.h"
4282
! #include "libclamav/others.h"
4283
! #include "libclamav/cltypes.h"
4284
! #include "libclamav/ole2_extract.h"
4286
typedef struct mac_token_tag
4288
unsigned char token;
4289
! const unsigned char *str;
4292
typedef struct mac_token2_tag
4295
! const unsigned char *str;
4300
#include <sys/stat.h>
4303
+ #include <clamav.h>
4306
! #include "../libclamav/vba_extract.h"
4307
! #include "../libclamav/others.h"
4308
! #include "../libclamav/cltypes.h"
4309
! #include "../libclamav/ole2_extract.h"
4311
typedef struct mac_token_tag
4313
unsigned char token;
4314
! unsigned char *str;
4317
typedef struct mac_token2_tag
4320
! unsigned char *str;