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

« back to all changes in this revision

Viewing changes to clamd/server-th.c

  • 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:
40
40
#include <unistd.h>
41
41
#endif
42
42
 
 
43
#include <openssl/ssl.h>
 
44
#include <openssl/err.h>
 
45
#include "libclamav/crypto.h"
 
46
 
43
47
#include <fcntl.h>
44
48
#ifdef C_SOLARIS
45
49
#include <stdio_ext.h>
67
71
time_t reloaded_time = 0;
68
72
pthread_mutex_t reload_mutex = PTHREAD_MUTEX_INITIALIZER;
69
73
int sighup = 0;
 
74
extern pthread_mutex_t logg_mutex;
70
75
static struct cl_stat dbstat;
71
76
 
72
77
void *event_wake_recv = NULL;
853
858
    val = cl_engine_get_num(engine, CL_ENGINE_MAX_ZIPTYPERCG, NULL);
854
859
    logg("Limits: MaxZipTypeRcg limit set to %llu bytes.\n", val);
855
860
 
 
861
    if((opt = optget(opts, "MaxPartitions"))->active) {
 
862
        if((ret = cl_engine_set_num(engine, CL_ENGINE_MAX_PARTITIONS, opt->numarg))) {
 
863
            logg("!cli_engine_set_num(MaxPartitions) failed: %s\n", cl_strerror(ret));
 
864
            cl_engine_free(engine);
 
865
            return 1;
 
866
        }
 
867
    }
 
868
    val = cl_engine_get_num(engine, CL_ENGINE_MAX_PARTITIONS, NULL);
 
869
    logg("Limits: MaxPartitions limit set to %llu.\n", val);
 
870
 
 
871
    if((opt = optget(opts, "MaxIconsPE"))->active) {
 
872
        if((ret = cl_engine_set_num(engine, CL_ENGINE_MAX_ICONSPE, opt->numarg))) {
 
873
            logg("!cli_engine_set_num(MaxIconsPE) failed: %s\n", cl_strerror(ret));
 
874
            cl_engine_free(engine);
 
875
            return 1;
 
876
        }
 
877
    }
 
878
    val = cl_engine_get_num(engine, CL_ENGINE_MAX_ICONSPE, NULL);
 
879
    logg("Limits: MaxIconsPE limit set to %llu.\n", val);
 
880
 
856
881
    if(optget(opts, "ScanArchive")->enabled) {
857
882
        logg("Archive support enabled.\n");
858
883
        options |= CL_SCAN_ARCHIVE;
952
977
        }
953
978
    }
954
979
 
 
980
    if(optget(opts,"PartitionIntersection")->enabled) {
 
981
        options |= CL_SCAN_PARTITION_INTXN;
 
982
        logg("Raw DMG: Always checking for partitons intersections\n");
 
983
    }
 
984
 
955
985
    if(optget(opts,"HeuristicScanPrecedence")->enabled) {
956
986
            options |= CL_SCAN_HEURISTIC_PRECEDENCE;
957
987
            logg("Heuristic: precedence enabled\n");
1008
1038
        if((fd = fopen(opt->strarg, "w")) == NULL) {
1009
1039
            logg("!Can't save PID in file %s\n", opt->strarg);
1010
1040
        } else {
1011
 
            if (fprintf(fd, "%u", (unsigned int) mainpid)<0) {
 
1041
            if (fprintf(fd, "%u\n", (unsigned int) mainpid)<0) {
1012
1042
                logg("!Can't save PID in file %s\n", opt->strarg);
1013
1043
            }
1014
1044
            fclose(fd);
1363
1393
#if defined(FANOTIFY) || defined(CLAMAUTH)
1364
1394
            if(optget(opts, "ScanOnAccess")->enabled && tharg) {
1365
1395
                logg("Restarting on-access scan\n");
 
1396
                pthread_mutex_lock(&logg_mutex);
1366
1397
                pthread_kill(fan_pid, SIGUSR1);
 
1398
                pthread_mutex_unlock(&logg_mutex);
1367
1399
                pthread_join(fan_pid, NULL);
1368
1400
            }
1369
1401
#endif
1409
1441
#if defined(FANOTIFY) || defined(CLAMAUTH)
1410
1442
    if(optget(opts, "ScanOnAccess")->enabled && tharg) {
1411
1443
        logg("Stopping on-access scan\n");
 
1444
        pthread_mutex_lock(&logg_mutex);
1412
1445
        pthread_kill(fan_pid, SIGUSR1);
 
1446
        pthread_mutex_unlock(&logg_mutex);
1413
1447
        pthread_join(fan_pid, NULL);
1414
1448
    }
1415
1449
#endif