76
char *get_hostid(void *cbdata);
71
79
/* FIXME: If possible, handle users correctly */
72
80
static int checkaccess(const char *path, const char *username, int mode)
578
if (optget(opts, "disable-cache")->enabled)
579
cl_engine_set_num(engine, CL_ENGINE_DISABLE_CACHE, 1);
581
if (optget(opts, "disable-pe-stats")->enabled) {
582
cl_engine_set_num(engine, CL_ENGINE_DISABLE_PE_STATS, 1);
585
if (optget(opts, "enable-stats")->enabled) {
586
cl_engine_stats_enable(engine);
589
if (optget(opts, "stats-timeout")->enabled) {
590
cl_engine_set_num(engine, CL_ENGINE_STATS_TIMEOUT, optget(opts, "StatsTimeout")->numarg);
593
if (optget(opts, "stats-host-id")->enabled) {
594
char *p = optget(opts, "stats-host-id")->strarg;
596
if (strcmp(p, "default")) {
597
if (!strcmp(p, "none")) {
598
cl_engine_set_clcb_stats_get_hostid(engine, NULL);
599
} else if (!strcmp(p, "anonymous")) {
600
strcpy(hostid, STATS_ANON_UUID);
602
if (strlen(p) > 36) {
603
logg("!Invalid HostID\n");
604
cl_engine_set_clcb_stats_submit(engine, NULL);
605
cl_engine_free(engine);
612
cl_engine_set_clcb_stats_get_hostid(engine, get_hostid);
570
616
if(optget(opts, "detect-pua")->enabled) {
571
617
dboptions |= CL_DB_PUA;
572
618
if((opt = optget(opts, "exclude-pua"))->enabled) {
838
if((opt = optget(opts, "max-partitions"))->active) {
839
if((ret = cl_engine_set_num(engine, CL_ENGINE_MAX_PARTITIONS, opt->numarg))) {
840
logg("!cli_engine_set_num(CL_ENGINE_MAX_PARTITIONS) failed: %s\n", cl_strerror(ret));
841
cl_engine_free(engine);
846
if((opt = optget(opts, "max-iconspe"))->active) {
847
if((ret = cl_engine_set_num(engine, CL_ENGINE_MAX_ICONSPE, opt->numarg))) {
848
logg("!cli_engine_set_num(CL_ENGINE_MAX_ICONSPE) failed: %s\n", cl_strerror(ret));
849
cl_engine_free(engine);
792
854
/* set scan options */
793
855
if(optget(opts, "allmatch")->enabled)
794
856
options |= CL_SCAN_ALLMATCHES;
799
861
if(optget(opts,"phishing-cloak")->enabled)
800
862
options |= CL_SCAN_PHISHING_BLOCKCLOAK;
864
if(optget(opts,"partition-intersection")->enabled)
865
options |= CL_SCAN_PARTITION_INTXN;
802
867
if(optget(opts,"heuristic-scan-precedence")->enabled)
803
868
options |= CL_SCAN_HEURISTIC_PRECEDENCE;
1034
int is_valid_hostid(void)
1038
if (strlen(hostid) != 36)
1042
for (i=0; i < 36; i++)
1043
if (hostid[i] == '-')
1049
if (hostid[8] != '-' || hostid[13] != '-' || hostid[18] != '-' || hostid[23] != '-')
1055
char *get_hostid(void *cbdata)
1057
if (!strcmp(hostid, "none"))
1060
if (!is_valid_hostid())
1061
return strdup(STATS_ANON_UUID);
1063
logg("HostID is valid: %s\n", hostid);
1065
return strdup(hostid);