diff --git a/clamd/server-th.c b/clamd/server-th.c index a7b5813c2..4dff799bf 100644 --- a/clamd/server-th.c +++ b/clamd/server-th.c @@ -75,6 +75,7 @@ struct reload_th_t { struct cl_settings *settings; char *dbdir; unsigned int dboptions; + long long max_cvd_age; }; /* @@ -242,6 +243,13 @@ static void *reload_th(void *arg) goto done; } + if (rldata->max_cvd_age > 0) { + if (check_if_cvd_outdated(rldata->dbdir, rldata->max_cvd_age) != CL_SUCCESS) { + status = CL_ECVD; + goto done; + } + } + retval = cl_load(rldata->dbdir, engine, &sigs, rldata->dboptions); if (CL_SUCCESS != retval) { logg(LOGG_ERROR, "reload_th: Database load failed: %s\n", cl_strerror(retval)); @@ -339,6 +347,10 @@ static cl_error_t reload_db(struct cl_engine **engine, unsigned int dboptions, c goto done; } + if (optget(opts, "fail-if-cvd-older-than")->enabled) { + rldata->max_cvd_age = optget(opts, "fail-if-cvd-older-than")->numarg; + } + if (dbstat.entries) { cl_statfree(&dbstat); }