Browse code

shared/cfgparser.c, clamdconf: gently deprecate obsolete options (bb#1213)

git-svn: trunk@4231

Tomasz Kojm authored on 2008/10/08 02:02:15
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Oct  7 19:18:16 CEST 2008 (tk)
2
+----------------------------------
3
+  * shared/cfgparser.c, clamdconf: gently deprecate obsolete options (bb#1213)
4
+
1 5
 Tue Oct  7 15:52:06 CEST 2008 (acab)
2 6
 ------------------------------------
3 7
   * misc: add missing EOL to dbg/warn messages - bb#1219
... ...
@@ -50,7 +50,9 @@ static void printopt(const struct cfgoption *opt, const struct cfgstruct *cpt, i
50 50
     }
51 51
 
52 52
     while(cpt) {
53
-	switch(opt->argtype) {
53
+	if(opt->owner & OPT_DEPRECATED) {
54
+	    printf("*** %s is DEPRECATED ***\n", opt->name);
55
+	} else switch(opt->argtype) {
54 56
 	    case OPT_STR:
55 57
 	    case OPT_FULLSTR:
56 58
 	    case OPT_QUOTESTR:
... ...
@@ -129,6 +129,14 @@ struct cfgoption cfg_options[] = {
129 129
     {"DevACOnly", OPT_BOOL, -1, NULL, 0, OPT_CLAMD},
130 130
     {"DevACDepth", OPT_NUM, -1, NULL, 0, OPT_CLAMD},
131 131
 
132
+    /* Deprecated options */
133
+    {"MailMaxRecursion", OPT_NUM, 64, NULL, 0, OPT_CLAMD | OPT_DEPRECATED},
134
+    {"ArchiveMaxFileSize", OPT_COMPSIZE, 10485760, NULL, 0, OPT_CLAMD | OPT_DEPRECATED},
135
+    {"ArchiveMaxRecursion", OPT_NUM, 8, NULL, 0, OPT_CLAMD | OPT_DEPRECATED},
136
+    {"ArchiveMaxFiles", OPT_NUM, 1000, NULL, 0, OPT_CLAMD | OPT_DEPRECATED},
137
+    {"ArchiveMaxCompressionRatio", OPT_NUM, 250, NULL, 0, OPT_CLAMD | OPT_DEPRECATED},
138
+    {"ArchiveBlockMax", OPT_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_DEPRECATED},
139
+
132 140
     {NULL, 0, 0, NULL, 0, 0}
133 141
 };
134 142
 
... ...
@@ -183,6 +191,10 @@ struct cfgstruct *getcfg(const char *cfgfile, int verbose)
183 183
 		if(pt->name) {
184 184
 		    if(!strcmp(name, pt->name)) {
185 185
 			found = 1;
186
+			if(pt->owner & OPT_DEPRECATED) {
187
+			    fprintf(stderr, "WARNING: Ignoring deprecated option %s at line %u\n", pt->name, line);
188
+			    break;
189
+			}
186 190
 			switch(pt->argtype) {
187 191
 			    case OPT_STR:
188 192
 			    	/* deprecated.  Use OPT_QUOTESTR instead since it behaves like this, but supports quotes to allow values to contain whitespace */
... ...
@@ -31,6 +31,7 @@
31 31
 
32 32
 #define OPT_CLAMD 1
33 33
 #define OPT_FRESHCLAM 2
34
+#define OPT_DEPRECATED 4
34 35
 
35 36
 struct cfgoption {
36 37
     const char *name;