mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-11-01 00:20:53 +00:00
libclamav, freshclam: fix handling of dbs when both daily.cvd and daily.cld
are present in the db directory and ScriptedUpdates are turned off (bb#1739)
This commit is contained in:
parent
5ccfa0b76a
commit
284e1ee4ba
4 changed files with 71 additions and 10 deletions
|
|
@ -117,6 +117,8 @@ void print_version(const char *dbdir)
|
|||
char *fdbdir = NULL, *path;
|
||||
const char *pt;
|
||||
struct cl_cvd *daily;
|
||||
time_t db_time;
|
||||
unsigned int db_version = 0;
|
||||
|
||||
|
||||
if(dbdir)
|
||||
|
|
@ -136,17 +138,32 @@ void print_version(const char *dbdir)
|
|||
}
|
||||
|
||||
sprintf(path, "%s"PATHSEP"daily.cvd", pt);
|
||||
if(access(path, R_OK))
|
||||
sprintf(path, "%s"PATHSEP"daily.cld", pt);
|
||||
if(!access(path, R_OK)) {
|
||||
daily = cl_cvdhead(path);
|
||||
if(daily) {
|
||||
db_version = daily->version;
|
||||
db_time = daily->stime;
|
||||
cl_cvdfree(daily);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(path, "%s"PATHSEP"daily.cld", pt);
|
||||
if(!access(path, R_OK)) {
|
||||
daily = cl_cvdhead(path);
|
||||
if(daily) {
|
||||
if(daily->version > db_version) {
|
||||
db_version = daily->version;
|
||||
db_time = daily->stime;
|
||||
}
|
||||
cl_cvdfree(daily);
|
||||
}
|
||||
}
|
||||
|
||||
if(!dbdir)
|
||||
free(fdbdir);
|
||||
|
||||
if(!access(path, R_OK) && (daily = cl_cvdhead(path))) {
|
||||
time_t t = (time_t) daily->stime;
|
||||
|
||||
printf("ClamAV %s/%d/%s", get_version(), daily->version, ctime(&t));
|
||||
cl_cvdfree(daily);
|
||||
if(db_version) {
|
||||
printf("ClamAV %s/%u/%s", get_version(), db_version, ctime(&db_time));
|
||||
} else {
|
||||
printf("ClamAV %s\n",get_version());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue