~ubuntu-branches/ubuntu/maverick/clamav/maverick-backports

« back to all changes in this revision

Viewing changes to libclamav/special.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran, Stephen Gran, Michael Tautschnig
  • Date: 2010-04-26 21:41:18 UTC
  • mfrom: (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100426214118-i6lo606wnh7ywfj6
Tags: 0.96+dfsg-4
[ Stephen Gran ]
* Fixed typo in clamav-milter's postinst

[ Michael Tautschnig ]
* Fixed typo in clamav-freshclam's postinst (closes: #579271)
* Debconf translation updates
  - Portuguese (closes: #579068)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  MA 02110-1301, USA.
19
19
 */
20
20
 
21
 
#ifdef  _MSC_VER
22
 
#include <windows.h>
23
 
#endif
24
 
 
 
21
#if HAVE_CONFIG_H
25
22
#include "clamav-config.h"
 
23
#endif
26
24
 
27
25
#include <sys/types.h>
28
26
#include <sys/stat.h>
30
28
#ifdef  HAVE_UNISTD_H
31
29
#include <unistd.h>
32
30
#endif
33
 
#ifndef C_WINDOWS
34
 
#include <netinet/in.h>
35
 
#endif
36
31
#include <string.h>
37
32
#include <ctype.h>
 
33
#ifndef _WIN32
 
34
#include <netinet/in.h>
 
35
#endif
38
36
#include "clamav.h"
39
37
#include "others.h"
40
38
#include "cltypes.h"
49
47
 
50
48
int cli_check_mydoom_log(int desc, cli_ctx *ctx)
51
49
{
52
 
        int32_t record[8], check;
 
50
        uint32_t record[8], check;
53
51
        int i, retval=CL_VIRUS, j;
54
52
 
55
53
    cli_dbgmsg("in cli_check_mydoom_log()\n");
79
77
    if (j < 2) {
80
78
        retval = CL_CLEAN;
81
79
    } else if (retval==CL_VIRUS) {
82
 
        if(cli_checkfp(desc, ctx))
83
 
            return CL_CLEAN;
84
 
        *ctx->virname = "Worm.Mydoom.M.log";
 
80
        *ctx->virname = "Heuristics.Worm.Mydoom.M.log";
85
81
    }
86
82
 
87
83
    return retval;
362
358
{
363
359
        cli_dbgmsg("swizz_j48: %u, %u, %u\n",n[0],n[1],n[2]);
364
360
        /* rules based on J48 tree */
365
 
        if (n[0] <= 945 || !n[1])
 
361
        if (n[0] <= 961 || !n[1])
366
362
                return 0;
367
363
        if (n[0] <= 1006)
368
364
                return (n[2] > 0 && n[2] <= 6);
369
365
        else
370
 
                return n[1] <= 10;
 
366
                return n[1] <= 10 && n[2];
371
367
}
372
368
 
373
369
void cli_detect_swizz_str(const unsigned char *str, uint32_t len, struct swizz_stats *stats, int blob)
433
429
                ngram_cnts[i] = (v<<10)/all;
434
430
        }
435
431
        ret = swizz_j48(ngram_cnts) ? CL_VIRUS : CL_CLEAN;
436
 
        if (!words) ret = CL_CLEAN;
 
432
        if (words < 3) ret = CL_CLEAN;
437
433
        cli_dbgmsg("cli_detect_swizz_str: %s, %u words\n", ret == CL_VIRUS ? "suspicious" : "ok", words);
438
434
        if (ret == CL_VIRUS) {
439
435
                stats->suspicious += j;
492
488
                        uint32_t v = gn[i];
493
489
                        gn[i] = (v<<15)/all;
494
490
                        if (cli_debug_flag)
495
 
                        cli_dbgmsg("%lu, ", (unsigned long)gn[i]);
 
491
                            fprintf(stderr, "%lu, ", (unsigned long)gn[i]);
496
492
                }
497
493
                global_swizz = swizz_j48_global(gn) ? CL_VIRUS : CL_CLEAN;
498
 
                cli_dbgmsg("\ncli_detect_swizz: global: %s\n", global_swizz ? "suspicious" : "clean");
 
494
                if (cli_debug_flag) {
 
495
                    fprintf(stderr, "\n");
 
496
                    cli_dbgmsg("cli_detect_swizz: global: %s\n", global_swizz ? "suspicious" : "clean");
 
497
                }
499
498
        }
500
499
 
501
500
        if (stats->errors > stats->entries || stats->errors >= SWIZZ_MAXERRORS) {