Hallo, I wrote a small patch to demonstrate.. The patch is ugly but does not introduce new char[] with fixed size. A real programmer knows to make it better...
> I suggest to transfer the hostid into an X-Subisstion-HostID header as part > of the > http-request and *not* as part of the useragent header. -- Andreas Schulze Internetdienste | P532 DATEV eG 90329 Nürnberg | Telefon +49 911 319-0 | Telefax +49 911 319-3196 E-Mail info @datev.de | Internet www.datev.de Sitz: 90429 Nürnberg, Paumgartnerstr. 6-14 | Registergericht Nürnberg, GenReg Nr.70 Vorstand Prof. Dieter Kempf (Vorsitzender) Dipl.-Kfm. Wolfgang Stegmann (stellvertretender Vorsitzender) Dipl.-Kfm. Michael Leistenschneider Jörg Rabe v. Pappenheim Dipl.-Vw. Eckhard Schwarzer Vorsitzender des Aufsichtsrates: Reinhard Verholen
Index: dv-clamav-0.96rc2/freshclam/manager.c =================================================================== --- dv-clamav-0.96rc2.orig/freshclam/manager.c 2010-03-26 12:50:41.000000000 +0100 +++ dv-clamav-0.96rc2/freshclam/manager.c 2010-03-26 15:13:32.000000000 +0100 @@ -534,10 +534,10 @@ 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(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])) { @@ -615,7 +615,11 @@ strncpy(newstatsdat, line, sizeof(newstatsdat)); } - 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 : ""); + /* like 0.95.3 */ + 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 : ""); uastr[sizeof(uastr) - 1] = 0; if((opt = optget(opts, "HTTPProxyServer"))->enabled) { @@ -700,12 +704,12 @@ query[sizeof(query) - 1] = 0; snprintf(post, sizeof(post), "POST http://stats.clamav.net/submit.php HTTP/1.0\r\n" - "Host: stats.clamav.net\r\n%s" + "Host: stats.clamav.net\r\n%s%s%s%s" "Content-Type: application/x-www-form-urlencoded\r\n" "User-Agent: %s\r\n" "Content-Length: %u\r\n\n" "%s", - auth ? auth : "", uastr, (unsigned int) strlen(query), query); + auth ? auth : "", hostid ? "X-HostID: " : "", hostid ? hostid : "", hostid ? "\r\n" : "", uastr, (unsigned int) strlen(query), query); if(send(sd, post, strlen(post), 0) < 0) { logg("!SubmitDetectionStats: Can't write to socket\n");
GnuPG-Signatur.asc
Description: digitale Signatur dieser Nachricht von Andreas Schulze
_______________________________________________ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://www.clamav.net/support/ml