Browse code

add support for incremental directories

git-svn: trunk@2126

Tomasz Kojm authored on 2006/07/27 00:02:22
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Jul 26 17:00:59 CEST 2006 (tk)
2
+----------------------------------
3
+  * libclamav/readdb.c: add support for incremental directories
4
+
1 5
 Tue Jul 25 18:33:06 CEST 2006 (tk)
2 6
 ----------------------------------
3 7
   * libclamav/cvd.c: handle .info files
... ...
@@ -1022,6 +1022,8 @@ static int cli_loadhw(const char *filename, struct cl_engine **engine, unsigned
1022 1022
 }
1023 1023
 #endif /* HAVE_HWACCEL */
1024 1024
 
1025
+static int cli_loaddbdir(const char *dirname, struct cl_engine **engine, unsigned int *signo, unsigned int options);
1026
+
1025 1027
 static int cli_load(const char *filename, struct cl_engine **engine, unsigned int *signo, unsigned int options)
1026 1028
 {
1027 1029
 	FILE *fd;
... ...
@@ -1029,6 +1031,9 @@ static int cli_load(const char *filename, struct cl_engine **engine, unsigned in
1029 1029
 	uint8_t skipped = 0;
1030 1030
 
1031 1031
 
1032
+    if(cli_strbcasestr(filename, ".inc"))
1033
+	return cli_loaddbdir(filename, engine, signo, options);
1034
+
1032 1035
     if((fd = fopen(filename, "rb")) == NULL) {
1033 1036
 	cli_errmsg("cli_load(): Can't open file %s\n", filename);
1034 1037
 	return CL_EOPEN;
... ...
@@ -1146,6 +1151,7 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine **engine, unsigne
1146 1146
 	     cli_strbcasestr(dent->d_name, ".zmd")  ||
1147 1147
 	     cli_strbcasestr(dent->d_name, ".rmd")  ||
1148 1148
 	     cli_strbcasestr(dent->d_name, ".hw")  ||
1149
+	     cli_strbcasestr(dent->d_name, ".inc")  ||
1149 1150
 	     cli_strbcasestr(dent->d_name, ".cvd"))) {
1150 1151
 
1151 1152
 		dbfile = (char *) cli_calloc(strlen(dent->d_name) + strlen(dirname) + 2, sizeof(char));
... ...
@@ -1261,6 +1267,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
1261 1261
 	    cli_strbcasestr(dent->d_name, ".zmd")  || 
1262 1262
 	    cli_strbcasestr(dent->d_name, ".rmd")  || 
1263 1263
 	    cli_strbcasestr(dent->d_name, ".hw")   ||
1264
+	    cli_strbcasestr(dent->d_name, ".inc")   ||
1264 1265
 	    cli_strbcasestr(dent->d_name, ".cvd"))) {
1265 1266
 
1266 1267
 		dbstat->no++;
... ...
@@ -1334,6 +1341,7 @@ int cl_statchkdir(const struct cl_stat *dbstat)
1334 1334
 	    cli_strbcasestr(dent->d_name, ".zmd")  || 
1335 1335
 	    cli_strbcasestr(dent->d_name, ".rmd")  || 
1336 1336
 	    cli_strbcasestr(dent->d_name, ".hw")   ||
1337
+	    cli_strbcasestr(dent->d_name, ".inc")   ||
1337 1338
 	    cli_strbcasestr(dent->d_name, ".cvd"))) {
1338 1339
 
1339 1340
                 fname = cli_calloc(strlen(dbstat->dir) + strlen(dent->d_name) + 2, sizeof(char));