[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Tomasz Kojm tkojm at clamav.net
Sun Apr 4 01:09:00 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 6ecf300eea90dbf705f867ac709398ad375aebb7
Author: Tomasz Kojm <tkojm at clamav.net>
Date:   Fri Nov 6 12:44:19 2009 +0100

    freshclam: add support for DetectionStatsHostID (bb#1503)

diff --git a/ChangeLog b/ChangeLog
index c08af01..77470ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov  6 12:22:33 CET 2009 (tk)
+---------------------------------
+ * freshclam: add support for DetectionStatsHostID (bb#1503)
+
 Tue Nov  3 22:50:30 CET 2009 (tk)
 ---------------------------------
  * libclamav, freshclam: fix handling of dbs when both daily.cvd and daily.cld
diff --git a/freshclam/manager.c b/freshclam/manager.c
index 91cc6a2..e5925cb 100644
--- a/freshclam/manager.c
+++ b/freshclam/manager.c
@@ -525,7 +525,7 @@ int submitstats(const char *clamdcfg, const struct optstruct *opts)
 	char buff[512], statsdat[512], newstatsdat[512], uastr[128];
 	char logfile[256], fbuff[FILEBUFF];
 	char *pt, *pt2, *auth = NULL;
-	const char *line, *country = NULL, *user, *proxy = NULL;
+	const char *line, *country = NULL, *user, *proxy = NULL, *hostid = NULL;
 	struct optstruct *clamdopt;
 	const struct optstruct *opt;
 	struct stat sb;
@@ -534,6 +534,11 @@ int submitstats(const char *clamdcfg, const struct optstruct *opts)
 	unsigned int qcnt, entries, submitted = 0, permfail = 0, port = 0;
 
 
+    if(optget(opts, "HTTPUserAgent")->enabled) {
+	logg("!SubmitDetectionStats: HTTPUserAgent must be disabled for SubmitDetectionStats to work\n");
+	return 56;
+    }
+
     if((opt = optget(opts, "DetectionStatsCountry"))->enabled) {
 	if(strlen(opt->strarg) != 2 || !isalpha(opt->strarg[0]) || !isalpha(opt->strarg[1])) {
 	    logg("!SubmitDetectionStats: DetectionStatsCountry requires a two-letter country code\n");
@@ -542,6 +547,14 @@ int submitstats(const char *clamdcfg, const struct optstruct *opts)
 	country = opt->strarg;
     }
 
+    if((opt = optget(opts, "DetectionStatsHostID"))->enabled) {
+	if(strlen(opt->strarg) != 32) {
+	    logg("!SubmitDetectionStats: The unique ID must be 32 characters long\n");
+	    return 56;
+	}
+	hostid = opt->strarg;
+    }
+
     if(!(clamdopt = optparse(clamdcfg, 0, NULL, 1, OPT_CLAMD, 0, NULL))) {
 	logg("!SubmitDetectionStats: Can't open or parse configuration file %s\n", clamdcfg);
 	return 56;
@@ -602,10 +615,7 @@ int submitstats(const char *clamdcfg, const struct optstruct *opts)
 	strncpy(newstatsdat, line, sizeof(newstatsdat));
     }
 
-    if((opt = optget(opts, "HTTPUserAgent"))->enabled)
-	strncpy(uastr, opt->strarg, sizeof(uastr));
-    else
-	snprintf(uastr, sizeof(uastr), PACKAGE"/%s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")%s%s", get_version(), country ? ":" : "", country ? country : "");
+    snprintf(uastr, sizeof(uastr), PACKAGE"/%s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE"):%s:%s", get_version(), country ? country : "", hostid ? hostid : "");
     uastr[sizeof(uastr) - 1] = 0;
 
     if((opt = optget(opts, "HTTPProxyServer"))->enabled) {
diff --git a/shared/optparser.c b/shared/optparser.c
index d911f34..53ba535 100644
--- a/shared/optparser.c
+++ b/shared/optparser.c
@@ -356,6 +356,8 @@ const struct clam_option __clam_options[] = {
 
     { "DetectionStatsCountry", NULL, 0, TYPE_STRING, NULL, -1, NULL, 0, OPT_FRESHCLAM, "Country of origin of malware/detection statistics (for statistical\npurposes only). The statistics collector at ClamAV.net will look up\nyour IP address to determine the geographical origin of the malware\nreported by your installation. If this installation is mainly used to\nscan data which comes from a different location, please enable this\noption and enter a two-letter code (see http://www.iana.org/domains/root/db/)\nof the country of origin.", "country-code" },
 
+    { "DetectionStatsHostID", NULL, 0, TYPE_STRING, NULL, -1, NULL, 0, OPT_FRESHCLAM, "FIXME: Add description", "unique-id" },
+
     { "SafeBrowsing", NULL, 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "This option enables support for Google Safe Browsing. When activated for\nthe first time, freshclam will download a new database file (safebrowsing.cvd)\nwhich will be automatically loaded by clamd and clamscan during the next\nreload, provided that the heuristic phishing detection is turned on. This\ndatabase includes information about websites that may be phishing sites or\npossible sources of malware. When using this option, it's mandatory to run\nfreshclam at least every 30 minutes.\nFreshclam uses the ClamAV's mirror infrastructure to distribute the\ndatabase and its updates but all the contents are provided under Google's\nterms of use. See http://code.google.com/support/bin/answer.py?answer=70015\nand http://safebrowsing.clamav.net for more information.", "yes" },
 
     /* Deprecated options */

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list