git-svn: trunk@4628
Tomasz Kojm authored on 2009/01/22 23:19:47... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Thu Jan 22 15:39:06 CET 2009 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * shared/optparser.c, clamconf: new clamconf (bb#1215, bb#1316) |
|
4 |
+ |
|
1 | 5 |
Mon Jan 19 21:01:33 CET 2009 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* shared/optparser.c: improve cmdline args handling |
... | ... |
@@ -16,19 +16,18 @@ |
16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | 17 |
# MA 02110-1301, USA. |
18 | 18 |
|
19 |
-#bin_PROGRAMS = clamconf |
|
19 |
+bin_PROGRAMS = clamconf |
|
20 | 20 |
|
21 |
-#clamconf_SOURCES = \ |
|
22 |
-# $(top_srcdir)/shared/cfgparser.c \ |
|
23 |
-# $(top_srcdir)/shared/cfgparser.h \ |
|
24 |
-# $(top_srcdir)/shared/misc.c \ |
|
25 |
-# $(top_srcdir)/shared/misc.h \ |
|
26 |
-# $(top_srcdir)/shared/getopt.c \ |
|
27 |
-# $(top_srcdir)/shared/getopt.h \ |
|
28 |
-# clamconf.c |
|
29 |
- |
|
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 @THREAD_LIBS@ |
|
21 |
+clamconf_SOURCES = \ |
|
22 |
+ $(top_srcdir)/shared/optparser.c \ |
|
23 |
+ $(top_srcdir)/shared/optparser.h \ |
|
24 |
+ $(top_srcdir)/shared/getopt.c \ |
|
25 |
+ $(top_srcdir)/shared/getopt.h \ |
|
26 |
+ $(top_srcdir)/shared/misc.c \ |
|
27 |
+ $(top_srcdir)/shared/misc.h \ |
|
28 |
+ clamconf.c |
|
33 | 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.la |
|
34 | 33 |
CLEANFILES=*.gcda *.gcno |
... | ... |
@@ -32,16 +32,6 @@ |
32 | 32 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
33 | 33 |
# MA 02110-1301, USA. |
34 | 34 |
|
35 |
-#bin_PROGRAMS = clamconf |
|
36 |
- |
|
37 |
-#clamconf_SOURCES = \ |
|
38 |
-# $(top_srcdir)/shared/cfgparser.c \ |
|
39 |
-# $(top_srcdir)/shared/cfgparser.h \ |
|
40 |
-# $(top_srcdir)/shared/misc.c \ |
|
41 |
-# $(top_srcdir)/shared/misc.h \ |
|
42 |
-# $(top_srcdir)/shared/getopt.c \ |
|
43 |
-# $(top_srcdir)/shared/getopt.h \ |
|
44 |
-# clamconf.c |
|
45 | 35 |
VPATH = @srcdir@ |
46 | 36 |
pkgdatadir = $(datadir)/@PACKAGE@ |
47 | 37 |
pkglibdir = $(libdir)/@PACKAGE@ |
... | ... |
@@ -61,6 +51,7 @@ POST_UNINSTALL = : |
61 | 61 |
build_triplet = @build@ |
62 | 62 |
host_triplet = @host@ |
63 | 63 |
target_triplet = @target@ |
64 |
+bin_PROGRAMS = clamconf$(EXEEXT) |
|
64 | 65 |
subdir = clamconf |
65 | 66 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
66 | 67 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
... | ... |
@@ -77,8 +68,29 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
77 | 77 |
mkinstalldirs = $(install_sh) -d |
78 | 78 |
CONFIG_HEADER = $(top_builddir)/clamav-config.h |
79 | 79 |
CONFIG_CLEAN_FILES = |
80 |
-SOURCES = |
|
81 |
-DIST_SOURCES = |
|
80 |
+am__installdirs = "$(DESTDIR)$(bindir)" |
|
81 |
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) |
|
82 |
+PROGRAMS = $(bin_PROGRAMS) |
|
83 |
+am_clamconf_OBJECTS = optparser.$(OBJEXT) getopt.$(OBJEXT) \ |
|
84 |
+ misc.$(OBJEXT) clamconf.$(OBJEXT) |
|
85 |
+clamconf_OBJECTS = $(am_clamconf_OBJECTS) |
|
86 |
+clamconf_LDADD = $(LDADD) |
|
87 |
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) |
|
88 |
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp |
|
89 |
+am__depfiles_maybe = depfiles |
|
90 |
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
|
91 |
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
|
92 |
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
|
93 |
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ |
|
94 |
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
|
95 |
+CCLD = $(CC) |
|
96 |
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
|
97 |
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ |
|
98 |
+ $(LDFLAGS) -o $@ |
|
99 |
+SOURCES = $(clamconf_SOURCES) |
|
100 |
+DIST_SOURCES = $(clamconf_SOURCES) |
|
101 |
+ETAGS = etags |
|
102 |
+CTAGS = ctags |
|
82 | 103 |
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
83 | 104 |
ACLOCAL = @ACLOCAL@ |
84 | 105 |
AMTAR = @AMTAR@ |
... | ... |
@@ -102,7 +114,7 @@ CPP = @CPP@ |
102 | 102 |
CPPFLAGS = @CPPFLAGS@ |
103 | 103 |
CYGPATH_W = @CYGPATH_W@ |
104 | 104 |
DBDIR = @DBDIR@ |
105 |
-DEFS = @DEFS@ -DCL_NOTHREADS |
|
105 |
+DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
|
106 | 106 |
DEPDIR = @DEPDIR@ |
107 | 107 |
DSYMUTIL = @DSYMUTIL@ |
108 | 108 |
DUMPBIN = @DUMPBIN@ |
... | ... |
@@ -140,7 +152,7 @@ LIBGMP = @LIBGMP@ |
140 | 140 |
LIBGMP_PREFIX = @LIBGMP_PREFIX@ |
141 | 141 |
LIBLTDL = @LIBLTDL@ |
142 | 142 |
LIBOBJS = @LIBOBJS@ |
143 |
-LIBS = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@ |
|
143 |
+LIBS = $(top_builddir)/libclamav/libclamav_internal_utils.la |
|
144 | 144 |
LIBTOOL = @LIBTOOL@ |
145 | 145 |
LIPO = @LIPO@ |
146 | 146 |
LN_S = @LN_S@ |
... | ... |
@@ -236,11 +248,21 @@ target_os = @target_os@ |
236 | 236 |
target_vendor = @target_vendor@ |
237 | 237 |
top_builddir = @top_builddir@ |
238 | 238 |
top_srcdir = @top_srcdir@ |
239 |
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
|
239 |
+clamconf_SOURCES = \ |
|
240 |
+ $(top_srcdir)/shared/optparser.c \ |
|
241 |
+ $(top_srcdir)/shared/optparser.h \ |
|
242 |
+ $(top_srcdir)/shared/getopt.c \ |
|
243 |
+ $(top_srcdir)/shared/getopt.h \ |
|
244 |
+ $(top_srcdir)/shared/misc.c \ |
|
245 |
+ $(top_srcdir)/shared/misc.h \ |
|
246 |
+ clamconf.c |
|
247 |
+ |
|
248 |
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared |
|
240 | 249 |
CLEANFILES = *.gcda *.gcno |
241 | 250 |
all: all-am |
242 | 251 |
|
243 | 252 |
.SUFFIXES: |
253 |
+.SUFFIXES: .c .lo .o .obj |
|
244 | 254 |
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) |
245 | 255 |
@for dep in $?; do \ |
246 | 256 |
case '$(am__configure_deps)' in \ |
... | ... |
@@ -270,18 +292,180 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) |
270 | 270 |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
271 | 271 |
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) |
272 | 272 |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
273 |
+install-binPROGRAMS: $(bin_PROGRAMS) |
|
274 |
+ @$(NORMAL_INSTALL) |
|
275 |
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" |
|
276 |
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \ |
|
277 |
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ |
|
278 |
+ if test -f $$p \ |
|
279 |
+ || test -f $$p1 \ |
|
280 |
+ ; then \ |
|
281 |
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ |
|
282 |
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ |
|
283 |
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ |
|
284 |
+ else :; fi; \ |
|
285 |
+ done |
|
286 |
+ |
|
287 |
+uninstall-binPROGRAMS: |
|
288 |
+ @$(NORMAL_UNINSTALL) |
|
289 |
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \ |
|
290 |
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ |
|
291 |
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ |
|
292 |
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \ |
|
293 |
+ done |
|
294 |
+ |
|
295 |
+clean-binPROGRAMS: |
|
296 |
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \ |
|
297 |
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ |
|
298 |
+ echo " rm -f $$p $$f"; \ |
|
299 |
+ rm -f $$p $$f ; \ |
|
300 |
+ done |
|
301 |
+ |
|
302 |
+installcheck-binPROGRAMS: $(bin_PROGRAMS) |
|
303 |
+ bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ |
|
304 |
+ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ |
|
305 |
+ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ |
|
306 |
+ esac; \ |
|
307 |
+ f=`echo "$$p" | \ |
|
308 |
+ sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ |
|
309 |
+ for opt in --help --version; do \ |
|
310 |
+ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ |
|
311 |
+ 2>c$${pid}_.err </dev/null \ |
|
312 |
+ && test -n "`cat c$${pid}_.out`" \ |
|
313 |
+ && test -z "`cat c$${pid}_.err`"; then :; \ |
|
314 |
+ else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ |
|
315 |
+ done; \ |
|
316 |
+ done; rm -f c$${pid}_.???; exit $$bad |
|
317 |
+clamconf$(EXEEXT): $(clamconf_OBJECTS) $(clamconf_DEPENDENCIES) |
|
318 |
+ @rm -f clamconf$(EXEEXT) |
|
319 |
+ $(LINK) $(clamconf_OBJECTS) $(clamconf_LDADD) $(LIBS) |
|
320 |
+ |
|
321 |
+mostlyclean-compile: |
|
322 |
+ -rm -f *.$(OBJEXT) |
|
323 |
+ |
|
324 |
+distclean-compile: |
|
325 |
+ -rm -f *.tab.c |
|
326 |
+ |
|
327 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clamconf.Po@am__quote@ |
|
328 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ |
|
329 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ |
|
330 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optparser.Po@am__quote@ |
|
331 |
+ |
|
332 |
+.c.o: |
|
333 |
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< |
|
334 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po |
|
335 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ |
|
336 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
337 |
+@am__fastdepCC_FALSE@ $(COMPILE) -c $< |
|
338 |
+ |
|
339 |
+.c.obj: |
|
340 |
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` |
|
341 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po |
|
342 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ |
|
343 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
344 |
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` |
|
345 |
+ |
|
346 |
+.c.lo: |
|
347 |
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< |
|
348 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo |
|
349 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ |
|
350 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
351 |
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< |
|
352 |
+ |
|
353 |
+optparser.o: $(top_srcdir)/shared/optparser.c |
|
354 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT optparser.o -MD -MP -MF $(DEPDIR)/optparser.Tpo -c -o optparser.o `test -f '$(top_srcdir)/shared/optparser.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/optparser.c |
|
355 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/optparser.Tpo $(DEPDIR)/optparser.Po |
|
356 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/optparser.c' object='optparser.o' libtool=no @AMDEPBACKSLASH@ |
|
357 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
358 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o optparser.o `test -f '$(top_srcdir)/shared/optparser.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/optparser.c |
|
359 |
+ |
|
360 |
+optparser.obj: $(top_srcdir)/shared/optparser.c |
|
361 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT optparser.obj -MD -MP -MF $(DEPDIR)/optparser.Tpo -c -o optparser.obj `if test -f '$(top_srcdir)/shared/optparser.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/optparser.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/optparser.c'; fi` |
|
362 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/optparser.Tpo $(DEPDIR)/optparser.Po |
|
363 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/optparser.c' object='optparser.obj' libtool=no @AMDEPBACKSLASH@ |
|
364 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
365 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o optparser.obj `if test -f '$(top_srcdir)/shared/optparser.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/optparser.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/optparser.c'; fi` |
|
366 |
+ |
|
367 |
+getopt.o: $(top_srcdir)/shared/getopt.c |
|
368 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.o -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.o `test -f '$(top_srcdir)/shared/getopt.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/getopt.c |
|
369 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po |
|
370 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/getopt.c' object='getopt.o' libtool=no @AMDEPBACKSLASH@ |
|
371 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
372 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.o `test -f '$(top_srcdir)/shared/getopt.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/getopt.c |
|
373 |
+ |
|
374 |
+getopt.obj: $(top_srcdir)/shared/getopt.c |
|
375 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.obj -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.obj `if test -f '$(top_srcdir)/shared/getopt.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/getopt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/getopt.c'; fi` |
|
376 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po |
|
377 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/getopt.c' object='getopt.obj' libtool=no @AMDEPBACKSLASH@ |
|
378 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
379 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.obj `if test -f '$(top_srcdir)/shared/getopt.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/getopt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/getopt.c'; fi` |
|
380 |
+ |
|
381 |
+misc.o: $(top_srcdir)/shared/misc.c |
|
382 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misc.o -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.o `test -f '$(top_srcdir)/shared/misc.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/misc.c |
|
383 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po |
|
384 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/misc.c' object='misc.o' libtool=no @AMDEPBACKSLASH@ |
|
385 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
386 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misc.o `test -f '$(top_srcdir)/shared/misc.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/misc.c |
|
387 |
+ |
|
388 |
+misc.obj: $(top_srcdir)/shared/misc.c |
|
389 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misc.obj -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.obj `if test -f '$(top_srcdir)/shared/misc.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/misc.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/misc.c'; fi` |
|
390 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po |
|
391 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/misc.c' object='misc.obj' libtool=no @AMDEPBACKSLASH@ |
|
392 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
393 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misc.obj `if test -f '$(top_srcdir)/shared/misc.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/misc.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/misc.c'; fi` |
|
273 | 394 |
|
274 | 395 |
mostlyclean-libtool: |
275 | 396 |
-rm -f *.lo |
276 | 397 |
|
277 | 398 |
clean-libtool: |
278 | 399 |
-rm -rf .libs _libs |
400 |
+ |
|
401 |
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) |
|
402 |
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
|
403 |
+ unique=`for i in $$list; do \ |
|
404 |
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
|
405 |
+ done | \ |
|
406 |
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ |
|
407 |
+ END { if (nonempty) { for (i in files) print i; }; }'`; \ |
|
408 |
+ mkid -fID $$unique |
|
279 | 409 |
tags: TAGS |
280 |
-TAGS: |
|
281 | 410 |
|
411 |
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
|
412 |
+ $(TAGS_FILES) $(LISP) |
|
413 |
+ tags=; \ |
|
414 |
+ here=`pwd`; \ |
|
415 |
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
|
416 |
+ unique=`for i in $$list; do \ |
|
417 |
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
|
418 |
+ done | \ |
|
419 |
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
|
420 |
+ END { if (nonempty) { for (i in files) print i; }; }'`; \ |
|
421 |
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ |
|
422 |
+ test -n "$$unique" || unique=$$empty_fix; \ |
|
423 |
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
|
424 |
+ $$tags $$unique; \ |
|
425 |
+ fi |
|
282 | 426 |
ctags: CTAGS |
283 |
-CTAGS: |
|
284 |
- |
|
427 |
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
|
428 |
+ $(TAGS_FILES) $(LISP) |
|
429 |
+ tags=; \ |
|
430 |
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
|
431 |
+ unique=`for i in $$list; do \ |
|
432 |
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
|
433 |
+ done | \ |
|
434 |
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
|
435 |
+ END { if (nonempty) { for (i in files) print i; }; }'`; \ |
|
436 |
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \ |
|
437 |
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ |
|
438 |
+ $$tags $$unique |
|
439 |
+ |
|
440 |
+GTAGS: |
|
441 |
+ here=`$(am__cd) $(top_builddir) && pwd` \ |
|
442 |
+ && cd $(top_srcdir) \ |
|
443 |
+ && gtags -i $(GTAGS_ARGS) $$here |
|
444 |
+ |
|
445 |
+distclean-tags: |
|
446 |
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
|
285 | 447 |
|
286 | 448 |
distdir: $(DISTFILES) |
287 | 449 |
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
... | ... |
@@ -311,8 +495,11 @@ distdir: $(DISTFILES) |
311 | 311 |
done |
312 | 312 |
check-am: all-am |
313 | 313 |
check: check-am |
314 |
-all-am: Makefile |
|
314 |
+all-am: Makefile $(PROGRAMS) |
|
315 | 315 |
installdirs: |
316 |
+ for dir in "$(DESTDIR)$(bindir)"; do \ |
|
317 |
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ |
|
318 |
+ done |
|
316 | 319 |
install: install-am |
317 | 320 |
install-exec: install-exec-am |
318 | 321 |
install-data: install-data-am |
... | ... |
@@ -340,11 +527,13 @@ maintainer-clean-generic: |
340 | 340 |
@echo "it deletes files that may require special tools to rebuild." |
341 | 341 |
clean: clean-am |
342 | 342 |
|
343 |
-clean-am: clean-generic clean-libtool mostlyclean-am |
|
343 |
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am |
|
344 | 344 |
|
345 | 345 |
distclean: distclean-am |
346 |
+ -rm -rf ./$(DEPDIR) |
|
346 | 347 |
-rm -f Makefile |
347 |
-distclean-am: clean-am distclean-generic |
|
348 |
+distclean-am: clean-am distclean-compile distclean-generic \ |
|
349 |
+ distclean-tags |
|
348 | 350 |
|
349 | 351 |
dvi: dvi-am |
350 | 352 |
|
... | ... |
@@ -360,7 +549,7 @@ install-data-am: |
360 | 360 |
|
361 | 361 |
install-dvi: install-dvi-am |
362 | 362 |
|
363 |
-install-exec-am: |
|
363 |
+install-exec-am: install-binPROGRAMS |
|
364 | 364 |
|
365 | 365 |
install-html: install-html-am |
366 | 366 |
|
... | ... |
@@ -372,15 +561,17 @@ install-pdf: install-pdf-am |
372 | 372 |
|
373 | 373 |
install-ps: install-ps-am |
374 | 374 |
|
375 |
-installcheck-am: |
|
375 |
+installcheck-am: installcheck-binPROGRAMS |
|
376 | 376 |
|
377 | 377 |
maintainer-clean: maintainer-clean-am |
378 |
+ -rm -rf ./$(DEPDIR) |
|
378 | 379 |
-rm -f Makefile |
379 | 380 |
maintainer-clean-am: distclean-am maintainer-clean-generic |
380 | 381 |
|
381 | 382 |
mostlyclean: mostlyclean-am |
382 | 383 |
|
383 |
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool |
|
384 |
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \ |
|
385 |
+ mostlyclean-libtool |
|
384 | 386 |
|
385 | 387 |
pdf: pdf-am |
386 | 388 |
|
... | ... |
@@ -390,20 +581,23 @@ ps: ps-am |
390 | 390 |
|
391 | 391 |
ps-am: |
392 | 392 |
|
393 |
-uninstall-am: |
|
393 |
+uninstall-am: uninstall-binPROGRAMS |
|
394 | 394 |
|
395 | 395 |
.MAKE: install-am install-strip |
396 | 396 |
|
397 |
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \ |
|
398 |
- distclean distclean-generic distclean-libtool distdir dvi \ |
|
397 |
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ |
|
398 |
+ clean-generic clean-libtool ctags distclean distclean-compile \ |
|
399 |
+ distclean-generic distclean-libtool distclean-tags distdir dvi \ |
|
399 | 400 |
dvi-am html html-am info info-am install install-am \ |
400 |
- install-data install-data-am install-dvi install-dvi-am \ |
|
401 |
- install-exec install-exec-am install-html install-html-am \ |
|
402 |
- install-info install-info-am install-man install-pdf \ |
|
403 |
- install-pdf-am install-ps install-ps-am install-strip \ |
|
404 |
- installcheck installcheck-am installdirs maintainer-clean \ |
|
405 |
- maintainer-clean-generic mostlyclean mostlyclean-generic \ |
|
406 |
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am |
|
401 |
+ install-binPROGRAMS install-data install-data-am install-dvi \ |
|
402 |
+ install-dvi-am install-exec install-exec-am install-html \ |
|
403 |
+ install-html-am install-info install-info-am install-man \ |
|
404 |
+ install-pdf install-pdf-am install-ps install-ps-am \ |
|
405 |
+ install-strip installcheck installcheck-am \ |
|
406 |
+ installcheck-binPROGRAMS installdirs maintainer-clean \ |
|
407 |
+ maintainer-clean-generic mostlyclean mostlyclean-compile \ |
|
408 |
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ |
|
409 |
+ tags uninstall uninstall-am uninstall-binPROGRAMS |
|
407 | 410 |
|
408 | 411 |
# Tell versions [3.59,3.63) of GNU make to not export all variables. |
409 | 412 |
# Otherwise a system limit (for SysV at least) may be exceeded. |
410 | 413 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,148 @@ |
0 |
+/* |
|
1 |
+ * Copyright (C) 2009 Sourcefire, Inc. |
|
2 |
+ * Author: Tomasz Kojm <tkojm@clamav.net> |
|
3 |
+ * |
|
4 |
+ * This program is free software; you can redistribute it and/or modify |
|
5 |
+ * it under the terms of the GNU General Public License version 2 as |
|
6 |
+ * published by the Free Software Foundation. |
|
7 |
+ * |
|
8 |
+ * This program is distributed in the hope that it will be useful, |
|
9 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 |
+ * GNU General Public License for more details. |
|
12 |
+ * |
|
13 |
+ * You should have received a copy of the GNU General Public License |
|
14 |
+ * along with this program; if not, write to the Free Software |
|
15 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
16 |
+ * MA 02110-1301, USA. |
|
17 |
+ */ |
|
18 |
+ |
|
19 |
+#if HAVE_CONFIG_H |
|
20 |
+#include "clamav-config.h" |
|
21 |
+#endif |
|
22 |
+ |
|
23 |
+#include <stdio.h> |
|
24 |
+#include <string.h> |
|
25 |
+#include <unistd.h> |
|
26 |
+ |
|
27 |
+#include "shared/optparser.h" |
|
28 |
+#include "shared/misc.h" |
|
29 |
+ |
|
30 |
+static struct _cfgfile { |
|
31 |
+ const char *name; |
|
32 |
+ int tool; |
|
33 |
+} cfgfile[] = { |
|
34 |
+ { "clamd.conf", OPT_CLAMD }, |
|
35 |
+ { "freshclam.conf", OPT_FRESHCLAM }, |
|
36 |
+ { "clamav-milter.conf", OPT_MILTER }, |
|
37 |
+ { NULL, 0 } |
|
38 |
+}; |
|
39 |
+ |
|
40 |
+static void printopts(struct optstruct *opts, int nondef) |
|
41 |
+{ |
|
42 |
+ const struct optstruct *opt; |
|
43 |
+ |
|
44 |
+ while(opts) { |
|
45 |
+ if(!opts->name) { |
|
46 |
+ opts = opts->next; |
|
47 |
+ continue; |
|
48 |
+ } |
|
49 |
+ if(clam_options[opts->idx].owner & OPT_DEPRECATED) { |
|
50 |
+ if(opts->active) |
|
51 |
+ printf("*** %s is DEPRECATED ***\n", opts->name); |
|
52 |
+ opts = opts->next; |
|
53 |
+ continue; |
|
54 |
+ } |
|
55 |
+ if(nondef && (opts->numarg == clam_options[opts->idx].numarg) && ((opts->strarg == clam_options[opts->idx].strarg) || (opts->strarg && clam_options[opts->idx].strarg && !strcmp(opts->strarg, clam_options[opts->idx].strarg)))) { |
|
56 |
+ opts = opts->next; |
|
57 |
+ continue; |
|
58 |
+ } |
|
59 |
+ if(!opts->enabled) |
|
60 |
+ printf("%s disabled\n", opts->name); |
|
61 |
+ else switch(clam_options[opts->idx].argtype) { |
|
62 |
+ case TYPE_STRING: |
|
63 |
+ printf("%s = \"%s\"", opts->name, opts->strarg); |
|
64 |
+ opt = opts; |
|
65 |
+ while((opt = opt->nextarg)) |
|
66 |
+ printf(", \"%s\"", opt->strarg); |
|
67 |
+ printf("\n"); |
|
68 |
+ break; |
|
69 |
+ |
|
70 |
+ case TYPE_NUMBER: |
|
71 |
+ case TYPE_SIZE: |
|
72 |
+ printf("%s = \"%d\"", opts->name, opts->numarg); |
|
73 |
+ opt = opts; |
|
74 |
+ while((opt = opt->nextarg)) |
|
75 |
+ printf(", \"%d\"", opt->numarg); |
|
76 |
+ printf("\n"); |
|
77 |
+ break; |
|
78 |
+ |
|
79 |
+ case TYPE_BOOL: |
|
80 |
+ printf("%s = \"yes\"\n", opts->name); |
|
81 |
+ break; |
|
82 |
+ |
|
83 |
+ default: |
|
84 |
+ printf("!!! %s: UNKNOWN INTERNAL TYPE !!!\n", opts->name); |
|
85 |
+ } |
|
86 |
+ opts = opts->next; |
|
87 |
+ } |
|
88 |
+} |
|
89 |
+ |
|
90 |
+static void help(void) |
|
91 |
+{ |
|
92 |
+ printf("\n"); |
|
93 |
+ printf(" Clam AntiVirus: Configuration Tool %s\n", get_version()); |
|
94 |
+ printf(" (C) 2009 Sourcefire, Inc.\n\n"); |
|
95 |
+ |
|
96 |
+ printf(" --help -h Show help\n"); |
|
97 |
+ printf(" --config-dir=DIR -c DIR Read configuration files from DIR\n"); |
|
98 |
+ printf(" --non-default -n Only display non-default settings\n"); |
|
99 |
+ printf("\n"); |
|
100 |
+ return; |
|
101 |
+} |
|
102 |
+ |
|
103 |
+int main(int argc, char **argv) |
|
104 |
+{ |
|
105 |
+ const char *dir; |
|
106 |
+ char path[512]; |
|
107 |
+ struct optstruct *opts, *toolopts; |
|
108 |
+ unsigned int i, j; |
|
109 |
+ |
|
110 |
+ |
|
111 |
+ opts = optparse(NULL, argc, argv, 1, OPT_CLAMCONF, 0, NULL); |
|
112 |
+ if(!opts) { |
|
113 |
+ printf("ERROR: Can't parse command line options\n"); |
|
114 |
+ return 1; |
|
115 |
+ } |
|
116 |
+ |
|
117 |
+ if(optget(opts, "help")->enabled) { |
|
118 |
+ help(); |
|
119 |
+ optfree(opts); |
|
120 |
+ return 0; |
|
121 |
+ } |
|
122 |
+ |
|
123 |
+ printf("ClamAV engine version: %s\n", get_version()); |
|
124 |
+ /* TODO: db information */ |
|
125 |
+ |
|
126 |
+ dir = optget(opts, "config-dir")->strarg; |
|
127 |
+ printf("Checking configuration files in %s\n", dir); |
|
128 |
+ for(i = 0; cfgfile[i].name; i++) { |
|
129 |
+ snprintf(path, sizeof(path), "%s/%s", dir, cfgfile[i].name); |
|
130 |
+ path[511] = 0; |
|
131 |
+ if(access(path, R_OK)) { |
|
132 |
+ printf("\n%s not found\n", cfgfile[i].name); |
|
133 |
+ continue; |
|
134 |
+ } |
|
135 |
+ printf("\nConfig file: %s\n", cfgfile[i].name); |
|
136 |
+ for(j = 0; j < strlen(cfgfile[i].name) + 13; j++) |
|
137 |
+ printf("-"); |
|
138 |
+ printf("\n"); |
|
139 |
+ toolopts = optparse(path, 0, NULL, 1, cfgfile[i].tool | OPT_DEPRECATED, 0, NULL); |
|
140 |
+ if(!toolopts) |
|
141 |
+ continue; |
|
142 |
+ printopts(toolopts, optget(opts, "non-default")->enabled); |
|
143 |
+ optfree(toolopts); |
|
144 |
+ } |
|
145 |
+ optfree(opts); |
|
146 |
+ return 0; |
|
147 |
+} |
... | ... |
@@ -41,6 +41,7 @@ |
41 | 41 |
#include "shared/misc.h" |
42 | 42 |
|
43 | 43 |
#include "libclamav/regex/regex.h" |
44 |
+#include "libclamav/default.h" |
|
44 | 45 |
|
45 | 46 |
#include "getopt.h" |
46 | 47 |
|
... | ... |
@@ -51,31 +52,14 @@ |
51 | 51 |
#define MATCH_SIZE "^[0-9]+[kKmM]?$" |
52 | 52 |
#define MATCH_BOOL "^([yY]es|[tT]rue|1|[nN]o|[fF]alse|0)$" |
53 | 53 |
|
54 |
-#define TYPE_STRING 1 /* quoted/regular string */ |
|
55 |
-#define TYPE_NUMBER 2 /* raw number */ |
|
56 |
-#define TYPE_SIZE 3 /* number possibly followed by modifers (M/m or K/k) */ |
|
57 |
-#define TYPE_BOOL 4 /* boolean */ |
|
58 |
- |
|
59 | 54 |
#define FLAG_MULTIPLE 1 /* option can be used multiple times */ |
60 | 55 |
#define FLAG_REQUIRED 2 /* arg is required, even if there's a default value */ |
61 | 56 |
|
62 |
-static const struct clam_option { |
|
63 |
- const char *name; |
|
64 |
- const char *longopt; |
|
65 |
- char shortopt; |
|
66 |
- int argtype; |
|
67 |
- const char *regex; |
|
68 |
- int numarg; |
|
69 |
- const char *strarg; |
|
70 |
- int flags; |
|
71 |
- int owner; |
|
72 |
- const char *description; |
|
73 |
- const char *suggested; |
|
74 |
-} clam_options[] = { |
|
57 |
+const struct clam_option clam_options[] = { |
|
75 | 58 |
/* name, longopt, sopt, argtype, regex, num, str, mul, owner, description, suggested */ |
76 | 59 |
|
77 | 60 |
/* cmdline only */ |
78 |
- { NULL, "help", 'h', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER, "", "" }, |
|
61 |
+ { NULL, "help", 'h', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER | OPT_CLAMCONF, "", "" }, |
|
79 | 62 |
{ NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamd.conf", FLAG_REQUIRED, OPT_CLAMD | OPT_CLAMDSCAN, "", "" }, |
80 | 63 |
{ NULL, "config-file", 0, TYPE_STRING, NULL, 0, CONFDIR"/freshclam.conf", FLAG_REQUIRED, OPT_FRESHCLAM, "", "" }, |
81 | 64 |
{ NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamav-milter.conf", FLAG_REQUIRED, OPT_MILTER, "", "" }, |
... | ... |
@@ -123,6 +107,9 @@ static const struct clam_option { |
123 | 123 |
{ NULL, "run-cdiff", 'r', TYPE_STRING, NULL, -1, NULL, 0, OPT_SIGTOOL, "", "" }, |
124 | 124 |
{ NULL, "verify-cdiff", 0, TYPE_STRING, NULL, -1, NULL, 0, OPT_SIGTOOL, "", "" }, |
125 | 125 |
|
126 |
+ { NULL, "config-dir", 'c', TYPE_STRING, NULL, 0, CONFDIR, FLAG_REQUIRED, OPT_CLAMCONF, "", "" }, |
|
127 |
+ { NULL, "non-default", 'n', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMCONF, "", "" }, |
|
128 |
+ |
|
126 | 129 |
/* cmdline only - deprecated */ |
127 | 130 |
{ NULL, "http-proxy", 0, TYPE_STRING, NULL, 0, NULL, 0, OPT_FRESHCLAM | OPT_DEPRECATED, "", "" }, |
128 | 131 |
{ NULL, "proxy-user", 0, TYPE_STRING, NULL, 0, NULL, 0, OPT_FRESHCLAM | OPT_DEPRECATED, "", "" }, |
... | ... |
@@ -257,9 +244,9 @@ static const struct clam_option { |
257 | 257 |
|
258 | 258 |
{ "StructuredDataDetection", "detect-structured", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Enable the Data Loss Prevention module.", "no" }, |
259 | 259 |
|
260 |
- { "StructuredMinCreditCardCount", "structured-cc-count", 0, TYPE_NUMBER, MATCH_NUMBER, 3, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "This option sets the lowest number of Credit Card numbers found in a file\nto generate a detect.", "5" }, |
|
260 |
+ { "StructuredMinCreditCardCount", "structured-cc-count", 0, TYPE_NUMBER, MATCH_NUMBER, CLI_DEFAULT_MIN_CC_COUNT, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "This option sets the lowest number of Credit Card numbers found in a file\nto generate a detect.", "5" }, |
|
261 | 261 |
|
262 |
- { "StructuredMinSSNCount", "structured-ssn-count", 0, TYPE_NUMBER, MATCH_NUMBER, 3, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "This option sets the lowest number of Social Security Numbers found\nin a file to generate a detect.", "5" }, |
|
262 |
+ { "StructuredMinSSNCount", "structured-ssn-count", 0, TYPE_NUMBER, MATCH_NUMBER, CLI_DEFAULT_MIN_SSN_COUNT, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "This option sets the lowest number of Social Security Numbers found\nin a file to generate a detect.", "5" }, |
|
263 | 263 |
|
264 | 264 |
{ "StructuredSSNFormatNormal", NULL, 0, TYPE_BOOL, MATCH_BOOL, 1, NULL, 0, OPT_CLAMD, "With this option enabled the DLP module will search for valid\nSSNs formatted as xxx-yy-zzzz.", "yes" }, |
265 | 265 |
|
... | ... |
@@ -275,13 +262,13 @@ static const struct clam_option { |
275 | 275 |
|
276 | 276 |
{ "ArchiveBlockEncrypted", "block-encrypted", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Mark encrypted archives as viruses (Encrypted.Zip, Encrypted.RAR).", "no" }, |
277 | 277 |
|
278 |
- { "MaxScanSize", "max-scansize", 0, TYPE_SIZE, MATCH_SIZE, -1, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "This option sets the maximum amount of data to be scanned for each input file.\nArchives and other containers are recursively extracted and scanned up to this\nvalue.\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage.", "100M" }, |
|
278 |
+ { "MaxScanSize", "max-scansize", 0, TYPE_SIZE, MATCH_SIZE, CLI_DEFAULT_MAXSCANSIZE, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "This option sets the maximum amount of data to be scanned for each input file.\nArchives and other containers are recursively extracted and scanned up to this\nvalue.\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage.", "100M" }, |
|
279 | 279 |
|
280 |
- { "MaxFileSize", "max-filesize", 0, TYPE_SIZE, MATCH_SIZE, -1, NULL, 0, OPT_CLAMD | OPT_MILTER | OPT_CLAMSCAN, "Files larger than this limit won't be scanned. Affects the input file itself\nas well as files contained inside it (when the input file is an archive, a\ndocument or some other kind of container).\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage to the system.", "25M" }, |
|
280 |
+ { "MaxFileSize", "max-filesize", 0, TYPE_SIZE, MATCH_SIZE, CLI_DEFAULT_MAXFILESIZE, NULL, 0, OPT_CLAMD | OPT_MILTER | OPT_CLAMSCAN, "Files larger than this limit won't be scanned. Affects the input file itself\nas well as files contained inside it (when the input file is an archive, a\ndocument or some other kind of container).\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage to the system.", "25M" }, |
|
281 | 281 |
|
282 |
- { "MaxRecursion", "max-recursion", 0, TYPE_NUMBER, MATCH_NUMBER, -1, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR\nfile, all files within it will also be scanned. This option specifies how\ndeeply the process should be continued.\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage to the system.", "16" }, |
|
282 |
+ { "MaxRecursion", "max-recursion", 0, TYPE_NUMBER, MATCH_NUMBER, CLI_DEFAULT_MAXRECLEVEL, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR\nfile, all files within it will also be scanned. This option specifies how\ndeeply the process should be continued.\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage to the system.", "16" }, |
|
283 | 283 |
|
284 |
- { "MaxFiles", "max-files", 0, TYPE_NUMBER, MATCH_NUMBER, -1, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Number of files to be scanned within an archive, a document, or any other\ncontainer file.\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage to the system.", "10000" }, |
|
284 |
+ { "MaxFiles", "max-files", 0, TYPE_NUMBER, MATCH_NUMBER, CLI_DEFAULT_MAXFILES, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Number of files to be scanned within an archive, a document, or any other\ncontainer file.\nThe value of 0 disables the limit.\nWARNING: disabling this limit or setting it too high may result in severe damage to the system.", "10000" }, |
|
285 | 285 |
|
286 | 286 |
{ "ClamukoScanOnAccess", NULL, 0, TYPE_BOOL, MATCH_BOOL, -1, NULL, 0, OPT_CLAMD, "This option enables Clamuko. Dazuko needs to be already configured and\nrunning.", "no" }, |
287 | 287 |
|
... | ... |
@@ -453,7 +440,7 @@ static void optprint(const struct optstruct *opts) |
453 | 453 |
} |
454 | 454 |
*/ |
455 | 455 |
|
456 |
-static int optadd(struct optstruct **opts, const char *name, const char *cmd, const char *strarg, int numarg, int flags, int idx) |
|
456 |
+static int optadd(struct optstruct **opts, struct optstruct **opts_last, const char *name, const char *cmd, const char *strarg, int numarg, int flags, int idx) |
|
457 | 457 |
{ |
458 | 458 |
struct optstruct *newnode; |
459 | 459 |
|
... | ... |
@@ -507,8 +494,14 @@ static int optadd(struct optstruct **opts, const char *name, const char *cmd, co |
507 | 507 |
newnode->idx = idx; |
508 | 508 |
newnode->filename = NULL; |
509 | 509 |
|
510 |
- newnode->next = *opts; |
|
511 |
- *opts = newnode; |
|
510 |
+ if(!*opts_last) { |
|
511 |
+ newnode->next = *opts; |
|
512 |
+ *opts = newnode; |
|
513 |
+ *opts_last = *opts; |
|
514 |
+ } else { |
|
515 |
+ (*opts_last)->next = newnode; |
|
516 |
+ *opts_last = newnode; |
|
517 |
+ } |
|
512 | 518 |
return 0; |
513 | 519 |
} |
514 | 520 |
|
... | ... |
@@ -617,7 +610,7 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo |
617 | 617 |
char *pt; |
618 | 618 |
const char *name = NULL, *arg; |
619 | 619 |
int i, err = 0, lc = 0, sc = 0, opt_index, line = 0, ret, numarg; |
620 |
- struct optstruct *opts = NULL, *opt; |
|
620 |
+ struct optstruct *opts = NULL, *opts_last = NULL, *opt; |
|
621 | 621 |
char buff[512]; |
622 | 622 |
struct option longopts[MAXCMDOPTS]; |
623 | 623 |
char shortopts[MAXCMDOPTS]; |
... | ... |
@@ -633,8 +626,8 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo |
633 | 633 |
if(!optentry->name && !optentry->longopt) |
634 | 634 |
break; |
635 | 635 |
|
636 |
- if((optentry->owner & toolmask) || (ignore && (optentry->owner & ignore))) { |
|
637 |
- if(!oldopts && optadd(&opts, optentry->name, optentry->longopt, optentry->strarg, optentry->numarg, optentry->flags, i) < 0) { |
|
636 |
+ if(((optentry->owner & toolmask) && ((optentry->owner & toolmask) != OPT_DEPRECATED)) || (ignore && (optentry->owner & ignore))) { |
|
637 |
+ if(!oldopts && optadd(&opts, &opts_last, optentry->name, optentry->longopt, optentry->strarg, optentry->numarg, optentry->flags, i) < 0) { |
|
638 | 638 |
fprintf(stderr, "ERROR: optparse: Can't register new option (not enough memory)\n"); |
639 | 639 |
optfree(opts); |
640 | 640 |
return NULL; |
... | ... |
@@ -811,7 +804,14 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo |
811 | 811 |
|
812 | 812 |
if(optentry->owner & OPT_DEPRECATED) { |
813 | 813 |
if(toolmask & OPT_DEPRECATED) { |
814 |
- /* FIXME: optadd() -- needed for clamconf */ |
|
814 |
+ if(optaddarg(opts, name, "foo", 1) < 0) { |
|
815 |
+ if(cfgfile) |
|
816 |
+ fprintf(stderr, "ERROR: Can't register argument for option %s\n", name); |
|
817 |
+ else |
|
818 |
+ fprintf(stderr, "ERROR: Can't register argument for option --%s\n", optentry->longopt); |
|
819 |
+ err = 1; |
|
820 |
+ break; |
|
821 |
+ } |
|
815 | 822 |
} else { |
816 | 823 |
if(cfgfile) { |
817 | 824 |
if(verbose) |
... | ... |
@@ -824,8 +824,8 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo |
824 | 824 |
fprintf(stderr, "WARNING: Ignoring deprecated option --%s\n", optentry->longopt); |
825 | 825 |
} |
826 | 826 |
} |
827 |
- continue; |
|
828 | 827 |
} |
828 |
+ continue; |
|
829 | 829 |
} |
830 | 830 |
|
831 | 831 |
if(!cfgfile && !arg && optentry->argtype == TYPE_BOOL) { |
... | ... |
@@ -28,7 +28,13 @@ |
28 | 28 |
#define OPT_CLAMSCAN 8 |
29 | 29 |
#define OPT_CLAMDSCAN 16 |
30 | 30 |
#define OPT_SIGTOOL 32 |
31 |
-#define OPT_DEPRECATED 64 |
|
31 |
+#define OPT_CLAMCONF 64 |
|
32 |
+#define OPT_DEPRECATED 128 |
|
33 |
+ |
|
34 |
+#define TYPE_STRING 1 /* quoted/regular string */ |
|
35 |
+#define TYPE_NUMBER 2 /* raw number */ |
|
36 |
+#define TYPE_SIZE 3 /* number possibly followed by modifers (M/m or K/k) */ |
|
37 |
+#define TYPE_BOOL 4 /* boolean */ |
|
32 | 38 |
|
33 | 39 |
struct optstruct { |
34 | 40 |
char *name; |
... | ... |
@@ -45,6 +51,22 @@ struct optstruct { |
45 | 45 |
char **filename; /* cmdline */ |
46 | 46 |
}; |
47 | 47 |
|
48 |
+struct clam_option { |
|
49 |
+ const char *name; |
|
50 |
+ const char *longopt; |
|
51 |
+ char shortopt; |
|
52 |
+ int argtype; |
|
53 |
+ const char *regex; |
|
54 |
+ int numarg; |
|
55 |
+ const char *strarg; |
|
56 |
+ int flags; |
|
57 |
+ int owner; |
|
58 |
+ const char *description; |
|
59 |
+ const char *suggested; |
|
60 |
+}; |
|
61 |
+ |
|
62 |
+extern const struct clam_option clam_options[]; |
|
63 |
+ |
|
48 | 64 |
const struct optstruct *optget(const struct optstruct *opts, const char *name); |
49 | 65 |
|
50 | 66 |
void optfree(struct optstruct *opts); |