git-svn: trunk@1917
Tomasz Kojm authored on 2006/04/21 21:34:19... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Fri Apr 21 14:28:43 CEST 2006 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/readdb.c: load *.hdb, *.fp, *.zmd and *.rmd in hwaccel mode |
|
4 |
+ |
|
1 | 5 |
Fri Apr 21 13:44:44 CEST 2006 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/matcher.c: add support for *.hdb and *.fp databases in hwaccel |
... | ... |
@@ -1006,35 +1006,24 @@ static int cli_load(const char *filename, struct cl_engine **engine, unsigned in |
1006 | 1006 |
{ |
1007 | 1007 |
FILE *fd; |
1008 | 1008 |
int ret = CL_SUCCESS; |
1009 |
+ uint8_t skipped = 0; |
|
1009 | 1010 |
|
1010 | 1011 |
|
1011 |
-#ifdef HAVE_HWACCEL |
|
1012 |
- if(options & CL_DB_HWACCEL) { |
|
1013 |
- if(cli_strbcasestr(filename, ".hw")) { |
|
1014 |
- cli_dbgmsg("Loading %s\n", filename); |
|
1015 |
- ret = cli_loadhw(filename, engine, signo, options); |
|
1016 |
- } else { |
|
1017 |
- cli_dbgmsg("Ignoring %s\n", filename); |
|
1018 |
- } |
|
1019 |
- |
|
1020 |
- return ret; |
|
1021 |
- } |
|
1022 |
-#endif /* HAVE_HWACCEL */ |
|
1023 |
- |
|
1024 | 1012 |
if((fd = fopen(filename, "rb")) == NULL) { |
1025 | 1013 |
cli_errmsg("cli_load(): Can't open file %s\n", filename); |
1026 | 1014 |
return CL_EOPEN; |
1027 | 1015 |
} |
1028 | 1016 |
|
1029 |
- cli_dbgmsg("Loading %s\n", filename); |
|
1030 |
- |
|
1031 |
- if(cli_strbcasestr(filename, ".db") || cli_strbcasestr(filename, ".db2") || cli_strbcasestr(filename, ".db3")) { |
|
1032 |
- ret = cli_loaddb(fd, engine, signo, options); |
|
1017 |
+ if(cli_strbcasestr(filename, ".db")) { |
|
1018 |
+ if(options & CL_DB_HWACCEL) |
|
1019 |
+ skipped = 1; |
|
1020 |
+ else |
|
1021 |
+ ret = cli_loaddb(fd, engine, signo, options); |
|
1033 | 1022 |
|
1034 | 1023 |
} else if(cli_strbcasestr(filename, ".cvd")) { |
1035 | 1024 |
int warn = 0; |
1036 | 1025 |
|
1037 |
- if(!strcmp(filename, "daily.cvd")) |
|
1026 |
+ if(strstr(filename, "daily.cvd")) |
|
1038 | 1027 |
warn = 1; |
1039 | 1028 |
|
1040 | 1029 |
ret = cli_cvdload(fd, engine, signo, warn, options); |
... | ... |
@@ -1046,10 +1035,17 @@ static int cli_load(const char *filename, struct cl_engine **engine, unsigned in |
1046 | 1046 |
ret = cli_loadhdb(fd, engine, signo, 1, options); |
1047 | 1047 |
|
1048 | 1048 |
} else if(cli_strbcasestr(filename, ".ndb")) { |
1049 |
- ret = cli_loadndb(fd, engine, signo, 0, options); |
|
1049 |
+ if(options & CL_DB_HWACCEL) |
|
1050 |
+ skipped = 1; |
|
1051 |
+ else |
|
1052 |
+ ret = cli_loadndb(fd, engine, signo, 0, options); |
|
1050 | 1053 |
|
1051 | 1054 |
} else if(cli_strbcasestr(filename, ".sdb")) { |
1052 |
- ret = cli_loadndb(fd, engine, signo, 1, options); |
|
1055 |
+ /* FIXME: Add support in hwaccel mode */ |
|
1056 |
+ if(options & CL_DB_HWACCEL) |
|
1057 |
+ skipped = 1; |
|
1058 |
+ else |
|
1059 |
+ ret = cli_loadndb(fd, engine, signo, 1, options); |
|
1053 | 1060 |
|
1054 | 1061 |
} else if(cli_strbcasestr(filename, ".zmd")) { |
1055 | 1062 |
ret = cli_loadmd(fd, engine, signo, 1, options); |
... | ... |
@@ -1058,15 +1054,26 @@ static int cli_load(const char *filename, struct cl_engine **engine, unsigned in |
1058 | 1058 |
ret = cli_loadmd(fd, engine, signo, 2, options); |
1059 | 1059 |
|
1060 | 1060 |
} else if(cli_strbcasestr(filename, ".hw")) { |
1061 |
- /* ignore */ |
|
1061 |
+#ifdef HAVE_HWACCEL |
|
1062 |
+ if(options & CL_DB_HWACCEL) |
|
1063 |
+ ret = cli_loadhw(filename, engine, signo, options); |
|
1064 |
+ else |
|
1065 |
+#endif |
|
1066 |
+ skipped = 1; |
|
1062 | 1067 |
|
1063 | 1068 |
} else { |
1064 | 1069 |
cli_dbgmsg("cli_load: unknown extension - assuming old database format\n"); |
1065 | 1070 |
ret = cli_loaddb(fd, engine, signo, options); |
1066 | 1071 |
} |
1067 | 1072 |
|
1068 |
- if(ret) |
|
1073 |
+ if(ret) { |
|
1069 | 1074 |
cli_errmsg("Can't load %s: %s\n", filename, cl_strerror(ret)); |
1075 |
+ } else { |
|
1076 |
+ if(skipped) |
|
1077 |
+ cli_dbgmsg("%s skipped\n", filename); |
|
1078 |
+ else |
|
1079 |
+ cli_dbgmsg("%s loaded\n", filename); |
|
1080 |
+ } |
|
1070 | 1081 |
|
1071 | 1082 |
fclose(fd); |
1072 | 1083 |
return ret; |