git-svn: trunk@5056
Tomasz Kojm authored on 2009/04/28 00:42:35... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon Apr 27 17:41:08 CEST 2009 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamconf: display info on software & dbs (bb#1461) |
|
4 |
+ |
|
1 | 5 |
Fri Apr 24 15:20:48 CEST 2009 (acab) |
2 | 6 |
.................................... |
3 | 7 |
* clamav-milter: drop support for QuarantineReject: it's a bad idea and |
... | ... |
@@ -27,7 +27,7 @@ clamconf_SOURCES = \ |
27 | 27 |
$(top_srcdir)/shared/misc.h \ |
28 | 28 |
clamconf.c |
29 | 29 |
|
30 |
-DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
|
31 |
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared |
|
32 |
-LIBS = $(top_builddir)/libclamav/libclamav_internal_utils_nothreads.la |
|
30 |
+DEFS = @DEFS@ -DCL_NOTHREADS |
|
31 |
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
|
32 |
+LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMD_LIBS@ @THREAD_LIBS@ |
|
33 | 33 |
CLEANFILES=*.gcda *.gcno |
... | ... |
@@ -117,7 +117,7 @@ CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
117 | 117 |
CURSES_LIBS = @CURSES_LIBS@ |
118 | 118 |
CYGPATH_W = @CYGPATH_W@ |
119 | 119 |
DBDIR = @DBDIR@ |
120 |
-DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
|
120 |
+DEFS = @DEFS@ -DCL_NOTHREADS |
|
121 | 121 |
DEPDIR = @DEPDIR@ |
122 | 122 |
DSYMUTIL = @DSYMUTIL@ |
123 | 123 |
DUMPBIN = @DUMPBIN@ |
... | ... |
@@ -152,7 +152,7 @@ LIBCLAMAV_LIBS = @LIBCLAMAV_LIBS@ |
152 | 152 |
LIBCLAMAV_VERSION = @LIBCLAMAV_VERSION@ |
153 | 153 |
LIBLTDL = @LIBLTDL@ |
154 | 154 |
LIBOBJS = @LIBOBJS@ |
155 |
-LIBS = $(top_builddir)/libclamav/libclamav_internal_utils_nothreads.la |
|
155 |
+LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMD_LIBS@ @THREAD_LIBS@ |
|
156 | 156 |
LIBTOOL = @LIBTOOL@ |
157 | 157 |
LIPO = @LIPO@ |
158 | 158 |
LN_S = @LN_S@ |
... | ... |
@@ -257,7 +257,7 @@ clamconf_SOURCES = \ |
257 | 257 |
$(top_srcdir)/shared/misc.h \ |
258 | 258 |
clamconf.c |
259 | 259 |
|
260 |
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared |
|
260 |
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
|
261 | 261 |
CLEANFILES = *.gcda *.gcno |
262 | 262 |
all: all-am |
263 | 263 |
|
... | ... |
@@ -26,11 +26,14 @@ |
26 | 26 |
#ifdef HAVE_UNISTD_H |
27 | 27 |
#include <unistd.h> |
28 | 28 |
#endif |
29 |
+#include <time.h> |
|
29 | 30 |
|
30 | 31 |
#include "shared/optparser.h" |
31 | 32 |
#include "shared/misc.h" |
32 | 33 |
|
33 | 34 |
#include "libclamav/str.h" |
35 |
+#include "libclamav/clamav.h" |
|
36 |
+#include "libclamav/others.h" |
|
34 | 37 |
|
35 | 38 |
static struct _cfgfile { |
36 | 39 |
const char *name; |
... | ... |
@@ -42,6 +45,10 @@ static struct _cfgfile { |
42 | 42 |
{ NULL, 0 } |
43 | 43 |
}; |
44 | 44 |
|
45 |
+static const char *dbnames[] = { "main.cvd", "main.cld", "daily.cvd", |
|
46 |
+ "daily.cld", "safebrowsing.cvd", |
|
47 |
+ "safebrowsing.cld", NULL }; |
|
48 |
+ |
|
45 | 49 |
static void printopts(struct optstruct *opts, int nondef) |
46 | 50 |
{ |
47 | 51 |
const struct optstruct *opt; |
... | ... |
@@ -194,10 +201,12 @@ static void help(void) |
194 | 194 |
int main(int argc, char **argv) |
195 | 195 |
{ |
196 | 196 |
const char *dir; |
197 |
- char path[512]; |
|
197 |
+ char path[512], dbdir[512], *pt; |
|
198 | 198 |
struct optstruct *opts, *toolopts; |
199 | 199 |
const struct optstruct *opt; |
200 | 200 |
unsigned int i, j; |
201 |
+ struct cl_cvd *cvd; |
|
202 |
+ unsigned int flevel; |
|
201 | 203 |
|
202 | 204 |
|
203 | 205 |
opts = optparse(NULL, argc, argv, 1, OPT_CLAMCONF, 0, NULL); |
... | ... |
@@ -224,9 +233,7 @@ int main(int argc, char **argv) |
224 | 224 |
return 0; |
225 | 225 |
} |
226 | 226 |
|
227 |
- printf("ClamAV engine version: %s\n", get_version()); |
|
228 |
- /* TODO: db information */ |
|
229 |
- |
|
227 |
+ dbdir[0] = 0; |
|
230 | 228 |
dir = optget(opts, "config-dir")->strarg; |
231 | 229 |
printf("Checking configuration files in %s\n", dir); |
232 | 230 |
for(i = 0; cfgfile[i].name; i++) { |
... | ... |
@@ -244,8 +251,72 @@ int main(int argc, char **argv) |
244 | 244 |
if(!toolopts) |
245 | 245 |
continue; |
246 | 246 |
printopts(toolopts, optget(opts, "non-default")->enabled); |
247 |
+ if(cfgfile[i].tool == OPT_FRESHCLAM) { |
|
248 |
+ opt = optget(toolopts, "DatabaseDirectory"); |
|
249 |
+ strncpy(dbdir, opt->strarg, sizeof(dbdir)); |
|
250 |
+ dbdir[sizeof(dbdir) - 1] = 0; |
|
251 |
+ } |
|
247 | 252 |
optfree(toolopts); |
248 | 253 |
} |
249 | 254 |
optfree(opts); |
255 |
+ |
|
256 |
+ printf("\nSoftware settings\n-----------------\n"); |
|
257 |
+ printf("Version: %s\n", cl_retver()); |
|
258 |
+ if(strcmp(cl_retver(), get_version())) |
|
259 |
+ printf("WARNING: Version mismatch: libclamav=%s, clamconf=%s\n", cl_retver(), get_version()); |
|
260 |
+ cl_init(CL_INIT_DEFAULT); |
|
261 |
+ printf("Optional features supported: "); |
|
262 |
+#ifdef USE_MPOOL |
|
263 |
+ printf("MEMPOOL "); |
|
264 |
+#endif |
|
265 |
+#ifdef SUPPORT_IPv6 |
|
266 |
+ printf("IPv6 "); |
|
267 |
+#endif |
|
268 |
+#ifdef CLAMUKO |
|
269 |
+ printf("CLAMUKO "); |
|
270 |
+#endif |
|
271 |
+#ifdef C_BIGSTACK |
|
272 |
+ printf("BIGSTACK "); |
|
273 |
+#endif |
|
274 |
+#ifdef FRESHCLAM_DNS_FIX |
|
275 |
+ printf("FRESHCLAM_DNS_FIX "); |
|
276 |
+#endif |
|
277 |
+#ifdef FPU_WORDS_BIGENDIAN |
|
278 |
+ printf("AUTOIT_EA06 "); |
|
279 |
+#endif |
|
280 |
+#ifdef HAVE_BZLIB_H |
|
281 |
+ printf("BZIP2 "); |
|
282 |
+#endif |
|
283 |
+ if(have_rar) |
|
284 |
+ printf("RAR"); |
|
285 |
+ printf("\n"); |
|
286 |
+ |
|
287 |
+ if(!strlen(dbdir)) { |
|
288 |
+ pt = freshdbdir(); |
|
289 |
+ if(pt) { |
|
290 |
+ strncpy(dbdir, pt, sizeof(dbdir)); |
|
291 |
+ free(pt); |
|
292 |
+ } else { |
|
293 |
+ strncpy(dbdir, DATADIR, sizeof(dbdir)); |
|
294 |
+ } |
|
295 |
+ dbdir[sizeof(dbdir) - 1] = 0; |
|
296 |
+ } |
|
297 |
+ printf("Database directory: %s\n", dbdir); |
|
298 |
+ flevel = cl_retflevel(); |
|
299 |
+ for(i = 0; dbnames[i]; i++) { |
|
300 |
+ snprintf(path, sizeof(path), "%s/%s", dbdir, dbnames[i]); |
|
301 |
+ path[511] = 0; |
|
302 |
+ if(!access(path, R_OK)) { |
|
303 |
+ cvd = cl_cvdhead(path); |
|
304 |
+ if(!cvd) { |
|
305 |
+ printf("%s: Can't get information about the database\n", dbnames[i]); |
|
306 |
+ } else { |
|
307 |
+ printf("%s: version %u, sigs: %u, built on %s", dbnames[i], cvd->version, cvd->sigs, ctime((const time_t *) &cvd->stime)); |
|
308 |
+ if(cvd->fl > flevel) |
|
309 |
+ printf("%s: WARNING: This database requires f-level %u (current f-level: %u)\n", dbnames[i], cvd->fl, flevel); |
|
310 |
+ cl_cvdfree(cvd); |
|
311 |
+ } |
|
312 |
+ } |
|
313 |
+ } |
|
250 | 314 |
return 0; |
251 | 315 |
} |
... | ... |
@@ -33,6 +33,7 @@ CLAMAV_PUBLIC { |
33 | 33 |
CLAMAV_PRIVATE { |
34 | 34 |
global: |
35 | 35 |
cli_strtok; |
36 |
+ cli_strtokenize; |
|
36 | 37 |
cli_cvdunpack; |
37 | 38 |
cli_regcomp; |
38 | 39 |
cli_regexec; |
... | ... |
@@ -142,6 +143,7 @@ CLAMAV_PRIVATE { |
142 | 142 |
messageCreate; |
143 | 143 |
messageDestroy; |
144 | 144 |
base64Flush; |
145 |
+ have_rar; |
|
145 | 146 |
local: |
146 | 147 |
*; |
147 | 148 |
}; |