~ubuntu-branches/ubuntu/jaunty/clamav/jaunty-backports

« back to all changes in this revision

Viewing changes to libclamav/others.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-10-02 17:11:00 UTC
  • mfrom: (0.3.1 lucid-proposed)
  • Revision ID: james.westby@ubuntu.com-20101002171100-0erjjoucua6kw2pc
Tags: 0.96.3+dfsg-2ubuntu0.10.04.1~jaunty1
* Source backport for Jaunty
  - Change build-dep on libtdl-dev to libtdl7-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
            return "CL_EFORMAT: Bad format or broken data";
249
249
        case CL_EBYTECODE:
250
250
            return "CL_EBYTECODE: error during bytecode execution";
 
251
        case CL_EBYTECODE_TESTFAIL:
 
252
            return "CL_EBYTECODE_TESTFAIL: failure in bytecode testmode";
251
253
        default:
252
254
            return "Unknown error code";
253
255
    }
301
303
    new->bytecode_security = CL_BYTECODE_TRUST_SIGNED;
302
304
    /* 5 seconds timeout */
303
305
    new->bytecode_timeout = 60000;
 
306
    new->bytecode_mode = CL_BYTECODE_MODE_AUTO;
304
307
    new->refcount = 1;
305
308
    new->ac_only = 0;
306
309
    new->ac_mindepth = CLI_DEFAULT_AC_MINDEPTH;
390
393
        case CL_ENGINE_BYTECODE_SECURITY:
391
394
#ifndef CL_BCUNSIGNED
392
395
            if (num == CL_BYTECODE_TRUST_ALL) {
393
 
                cli_errmsg("cl_engine_set_num: CL_BYTECODE_TRUST_ALL is only supported when ClamAV is built in debug mode\n");
 
396
                cli_errmsg("cl_engine_set_num: CL_BYTECODE_TRUST_ALL is only supported when ClamAV is built with ./configure --enable-unsigned-bytecode\n");
394
397
                return CL_EARG;
395
398
            }
396
399
#endif
 
400
            if (engine->dboptions & CL_DB_COMPILED) {
 
401
                cli_errmsg("cl_engine_set_num: CL_ENGINE_BYTECODE_SECURITY cannot be set after engine was compiled\n");
 
402
                return CL_EARG;
 
403
            }
397
404
            engine->bytecode_security = num;
398
405
            break;
399
406
        case CL_ENGINE_BYTECODE_TIMEOUT:
400
407
            engine->bytecode_timeout = num;
401
408
            break;
 
409
        case CL_ENGINE_BYTECODE_MODE:
 
410
            if (engine->dboptions & CL_DB_COMPILED) {
 
411
                cli_errmsg("cl_engine_set_num: CL_ENGINE_BYTECODE_MODE cannot be set after engine was compiled\n");
 
412
                return CL_EARG;
 
413
            }
 
414
            if (num == CL_BYTECODE_MODE_OFF) {
 
415
                cli_errmsg("cl_engine_set_num: CL_BYTECODE_MODE_OFF is not settable, use dboptions to turn off!\n");
 
416
            }
 
417
            engine->bytecode_mode = num;
 
418
            break;
402
419
        default:
403
420
            cli_errmsg("cl_engine_set_num: Incorrect field number\n");
404
421
            return CL_EARG;
446
463
            return engine->ac_maxdepth;
447
464
        case CL_ENGINE_KEEPTMP:
448
465
            return engine->keeptmp;
 
466
        case CL_ENGINE_BYTECODE_SECURITY:
 
467
            return engine->bytecode_security;
 
468
        case CL_ENGINE_BYTECODE_TIMEOUT:
 
469
            return engine->bytecode_timeout;
 
470
        case CL_ENGINE_BYTECODE_MODE:
 
471
            return engine->bytecode_mode;
449
472
        default:
450
473
            cli_errmsg("cl_engine_get: Incorrect field number\n");
451
474
            if(err)
945
968
        }
946
969
        bs->length = BITSET_DEFAULT_SIZE;
947
970
        bs->bitset = cli_calloc(BITSET_DEFAULT_SIZE, 1);
 
971
        if (!bs->bitset) {
 
972
            free(bs);
 
973
            return NULL;
 
974
        }
948
975
        return bs;
949
976
}
950
977
 
1004
1031
        }
1005
1032
        return (bs->bitset[char_offset] & ((unsigned char)1 << bit_offset));
1006
1033
}
 
1034
 
 
1035
void cl_engine_set_clcb_pre_scan(struct cl_engine *engine, clcb_pre_scan callback) {
 
1036
    engine->cb_pre_scan = callback;
 
1037
}
 
1038
 
 
1039
void cl_engine_set_clcb_post_scan(struct cl_engine *engine, clcb_post_scan callback) {
 
1040
    engine->cb_post_scan = callback;
 
1041
}
 
1042
 
 
1043
void cl_engine_set_clcb_sigload(struct cl_engine *engine, clcb_sigload callback, void *context) {
 
1044
    engine->cb_sigload = callback;
 
1045
    engine->cb_sigload_ctx = callback ? context : NULL;
 
1046
}