Browse code

libclamav/cvd.c: enable new dsig check for main db

Tomasz Kojm authored on 2010/02/17 00:42:13
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Feb 16 16:41:30 CET 2010 (tk)
2
+---------------------------------
3
+ * libclamav/cvd.c: enable new dsig check for main db
4
+
1 5
 Tue Feb 16 16:27:13 CET 2010 (tk)
2 6
 ---------------------------------
3 7
  * freshclam/manager.c: handle empty cdiffs more gently
... ...
@@ -46,8 +46,6 @@
46 46
 
47 47
 #define TAR_BLOCKSIZE 512
48 48
 
49
-#define DB_NOCHECK 0x80000 /* FIXME: temporary */
50
-
51 49
 static int cli_untgz(int fd, const char *destdir)
52 50
 {
53 51
 	char *path, osize[13], name[101], type;
... ...
@@ -309,7 +307,7 @@ static int cli_tgzload(int fd, struct cl_engine *engine, unsigned int *signo, un
309 309
 	else
310 310
 	    off = ftell(dbio->fs);
311 311
 
312
-	if((!dbinfo && !(options & DB_NOCHECK) && cli_strbcasestr(name, ".info")) || ((dbinfo || (options & DB_NOCHECK)) && CLI_DBEXT(name))) {
312
+	if((!dbinfo && cli_strbcasestr(name, ".info")) || (dbinfo && CLI_DBEXT(name))) {
313 313
 	    ret = cli_load(name, engine, signo, options, dbio);
314 314
 	    if(ret) {
315 315
 		cli_errmsg("cli_tgzload: Can't load %s\n", name);
... ...
@@ -318,11 +316,9 @@ static int cli_tgzload(int fd, struct cl_engine *engine, unsigned int *signo, un
318 318
 		return CL_EMALFDB;
319 319
 	    }
320 320
 	    if(!dbinfo) {
321
-		if(!(options & DB_NOCHECK)) { /* FIXME: temporary */
322
-		    free(dbio->buf);
323
-		    CLOSE_DBIO;
324
-		    return CL_SUCCESS;
325
-		}
321
+		free(dbio->buf);
322
+		CLOSE_DBIO;
323
+		return CL_SUCCESS;
326 324
 	    } else {
327 325
 		db = dbinfo;
328 326
 		while(db && strcmp(db->name, name))
... ...
@@ -600,30 +596,20 @@ int cli_cvdload(FILE *fs, struct cl_engine *engine, unsigned int *signo, unsigne
600 600
     }
601 601
 
602 602
     cfd = fileno(fs);
603
-
604
-    if(strstr(dbname, "main.")) /* FIXME: temporary */
605
-	options |= DB_NOCHECK;
606
-    else
607
-	ret = cli_tgzload(cfd, engine, signo, options | CL_DB_OFFICIAL, &dbio, NULL);
608
-    /*
603
+    ret = cli_tgzload(cfd, engine, signo, options | CL_DB_OFFICIAL, &dbio, NULL);
609 604
     if(ret != CL_SUCCESS)
610 605
 	return ret;
611
-    options |= CL_DB_SIGNED;
612
-    */
613
-    if(ret != CL_SUCCESS)
614
-	options |= DB_NOCHECK;
615 606
 
616
-    if(!(options & DB_NOCHECK)) { /* FIXME: temporary */
617
-	dbinfo = engine->dbinfo;
618
-	if(!dbinfo || !dbinfo->cvd || (dbinfo->cvd->version != cvd.version) || (dbinfo->cvd->sigs != cvd.sigs) || (dbinfo->cvd->fl != cvd.fl) || (dbinfo->cvd->stime != cvd.stime)) {
619
-	    cli_errmsg("cli_cvdload: Corrupted CVD header\n");
620
-	    return CL_EMALFDB;
621
-	}
622
-	dbinfo = engine->dbinfo ? engine->dbinfo->next : NULL;
623
-	if(!dbinfo)
624
-	    return CL_EMALFDB;
625
-	options |= CL_DB_SIGNED;
607
+    dbinfo = engine->dbinfo;
608
+    if(!dbinfo || !dbinfo->cvd || (dbinfo->cvd->version != cvd.version) || (dbinfo->cvd->sigs != cvd.sigs) || (dbinfo->cvd->fl != cvd.fl) || (dbinfo->cvd->stime != cvd.stime)) {
609
+	cli_errmsg("cli_cvdload: Corrupted CVD header\n");
610
+	return CL_EMALFDB;
626 611
     }
612
+    dbinfo = engine->dbinfo ? engine->dbinfo->next : NULL;
613
+    if(!dbinfo)
614
+	return CL_EMALFDB;
615
+
616
+    options |= CL_DB_SIGNED;
627 617
     ret = cli_tgzload(cfd, engine, signo, options | CL_DB_OFFICIAL, &dbio, dbinfo);
628 618
 
629 619
     while(engine->dbinfo) {