Browse code

Guess version if daily.cvd doesn't exist

git-svn: trunk@2176

Nigel Horne authored on 2006/08/07 02:35:30
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sun Aug  6 18:32:04 BST 2006 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Guess the version information if daily.cvd doesn't
4
+				exist
5
+
1 6
 Sat Aug  5 21:10:32 CEST 2006 (tk)
2 7
 ----------------------------------
3 8
   * libclamav/vba_extract.c: add another Office 2000 signature
... ...
@@ -23,9 +23,9 @@
23 23
  *
24 24
  * For installation instructions see the file INSTALL that came with this file
25 25
  */
26
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.274 2006/08/03 08:32:14 njh Exp $";
26
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.275 2006/08/06 17:35:30 njh Exp $";
27 27
 
28
-#define	CM_VERSION	"devel-030806"
28
+#define	CM_VERSION	"devel-060806"
29 29
 
30 30
 #if HAVE_CONFIG_H
31 31
 #include "clamav-config.h"
... ...
@@ -5204,10 +5204,9 @@ static int
5204 5204
 loadDatabase(void)
5205 5205
 {
5206 5206
 	/*extern const char *cl_retdbdir(void);	/* FIXME: should be included */
5207
-	int ret, v;
5207
+	int ret;
5208 5208
 	unsigned int signatures, dboptions;
5209
-	time_t t;
5210
-	char *daily, *ptr;
5209
+	char *daily;
5211 5210
 	struct cl_cvd *d;
5212 5211
 	const struct cfgstruct *cpt;
5213 5212
 	struct cl_node *newroot, *oldroot;
... ...
@@ -5233,14 +5232,20 @@ loadDatabase(void)
5233 5233
 
5234 5234
 	d = cl_cvdhead(daily);
5235 5235
 
5236
-	if(d == NULL) {
5237
-		cli_errmsg("Can't find %s\n", daily);
5238
-		free(daily);
5239
-		return -1;
5240
-	}
5236
+	if(d) {
5237
+		char *ptr;
5238
+		time_t t = d->stime;
5241 5239
 
5242
-	t = d->stime;
5243
-	v = d->version;
5240
+		snprintf(clamav_version, VERSION_LENGTH,
5241
+			"ClamAV %s/%d/%s", VERSION, d->version, ctime(&t));
5242
+
5243
+		/* Remove ctime's trailing \n */
5244
+		if((ptr = strchr(clamav_version, '\n')) != NULL)
5245
+			*ptr = '\0';
5246
+	} else
5247
+		snprintf(clamav_version, VERSION_LENGTH,
5248
+			"ClamAV version %s, clamav-milter version %s",
5249
+			VERSION, CM_VERSION);
5244 5250
 
5245 5251
 	cl_cvdfree(d);
5246 5252
 	free(daily);
... ...
@@ -5263,12 +5268,6 @@ loadDatabase(void)
5263 5263
 	}
5264 5264
 	pthread_mutex_unlock(&version_mutex);
5265 5265
 #endif
5266
-	snprintf(clamav_version, VERSION_LENGTH,
5267
-		"ClamAV %s/%d/%s", VERSION, v, ctime(&t));
5268
-	/* Remove ctime's trailing \n */
5269
-	if((ptr = strchr(clamav_version, '\n')) != NULL)
5270
-		*ptr = '\0';
5271
-
5272 5266
 	signatures = 0;
5273 5267
 	newroot = NULL;
5274 5268
 	dboptions = 0;