Browse code

disable load balancing in further download attempts

Tomasz Kojm authored on 2011/09/16 23:20:16
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Sep 16 16:17:52 CEST 2011 (tk)
2
+----------------------------------
3
+ * freshclam: disable load balancing in further download attempts
4
+
1 5
 Fri Sep 16 12:47:10 CEST 2011 (acab)
2 6
 ------------------------------------
3 7
  * libclamav: properly pass custom flag to sigload_cb
... ...
@@ -170,7 +170,7 @@ static void help(void)
170 170
 
171 171
 static int download(const struct optstruct *opts, const char *cfgfile)
172 172
 {
173
-	int ret = 0, try = 0, maxattempts = 0;
173
+	int ret = 0, try = 1, maxattempts = 0;
174 174
 	const struct optstruct *opt;
175 175
 
176 176
 
... ...
@@ -182,12 +182,12 @@ static int download(const struct optstruct *opts, const char *cfgfile)
182 182
 	return 56;
183 183
     } else {
184 184
 	while(opt) {
185
-	    ret = downloadmanager(opts, opt->strarg, try == maxattempts - 1);
185
+	    ret = downloadmanager(opts, opt->strarg, try);
186 186
 #ifndef _WIN32
187 187
 	    alarm(0);
188 188
 #endif
189 189
 	    if(ret == 52 || ret == 54 || ret == 58 || ret == 59) {
190
-		if(try < maxattempts - 1) {
190
+		if(try < maxattempts) {
191 191
 		    logg("Trying again in 5 secs...\n");
192 192
 		    try++;
193 193
 		    sleep(5);
... ...
@@ -198,7 +198,6 @@ static int download(const struct optstruct *opts, const char *cfgfile)
198 198
 		    if(!opt) {
199 199
 			logg("Update failed. Your network may be down or none of the mirrors listed in %s is working. Check http://www.clamav.net/support/mirror-problem for possible reasons.\n", cfgfile);
200 200
 		    }
201
-		    try = 0;
202 201
 		}
203 202
 
204 203
 	    } else {
... ...
@@ -193,7 +193,7 @@ static int qcompare(const void *a, const void *b)
193 193
 }
194 194
 #endif
195 195
 
196
-static int wwwconnect(const char *server, const char *proxy, int pport, char *ip, const char *localip, int ctimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist)
196
+static int wwwconnect(const char *server, const char *proxy, int pport, char *ip, const char *localip, int ctimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, int attempt)
197 197
 {
198 198
 	int socketfd, port, ret;
199 199
 	unsigned int ips = 0, ignored = 0, i;
... ...
@@ -265,6 +265,9 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip
265 265
     if(ipv4end != -1 && ipv4start != -1 && ipv4end - ipv4start + 1 > 1)
266 266
 	qsort(&addrs[ipv4start], ipv4end - ipv4start + 1, sizeof(struct addrinfo *), qcompare);
267 267
 
268
+    if(attempt > 1)
269
+	loadbal = 0;
270
+
268 271
     for(i = 0; i < addrnum; ) {
269 272
 	    void *addr;
270 273
 
... ...
@@ -587,7 +590,7 @@ int submitstats(const char *clamdcfg, const struct optstruct *opts)
587 587
 	entries++;
588 588
 
589 589
 	if(entries == SUBMIT_MIN_ENTRIES) {
590
-	    sd = wwwconnect("stats.clamav.net", proxy, port, NULL, optget(opts, "LocalIPAddress")->strarg, optget(opts, "ConnectTimeout")->numarg, NULL, 0, 0);
590
+	    sd = wwwconnect("stats.clamav.net", proxy, port, NULL, optget(opts, "LocalIPAddress")->strarg, optget(opts, "ConnectTimeout")->numarg, NULL, 0, 0, 1);
591 591
 	    if(sd < 0) {
592 592
 		logg("!SubmitDetectionStats: Can't connect to server\n");
593 593
 		ret = 52;
... ...
@@ -703,7 +706,7 @@ static int Rfc2822DateTime(char *buf, time_t mtime)
703 703
     return strftime(buf, 36, "%a, %d %b %Y %X GMT", gmt);
704 704
 }
705 705
 
706
-static struct cl_cvd *remote_cvdhead(const char *cvdfile, const char *localfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int *ims, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist)
706
+static struct cl_cvd *remote_cvdhead(const char *cvdfile, const char *localfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int *ims, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, int attempt)
707 707
 {
708 708
 	char cmd[512], head[513], buffer[FILEBUFF], ipaddr[46], *ch, *tmp;
709 709
 	int bread, cnt, sd;
... ...
@@ -772,9 +775,9 @@ static struct cl_cvd *remote_cvdhead(const char *cvdfile, const char *localfile,
772 772
     memset(ipaddr, 0, sizeof(ipaddr));
773 773
 
774 774
     if(ip[0]) /* use ip to connect */
775
-	sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist);
775
+	sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist, attempt);
776 776
     else
777
-	sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist);
777
+	sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist, attempt);
778 778
 
779 779
     if(sd < 0) {
780 780
 	return NULL;
... ...
@@ -1066,16 +1069,16 @@ static int getfile_mirman(const char *srcfile, const char *destfile, const char
1066 1066
     return 0;
1067 1067
 }
1068 1068
 
1069
-static int getfile(const char *srcfile, const char *destfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, const char *ims, const struct optstruct *opts)
1069
+static int getfile(const char *srcfile, const char *destfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, const char *ims, const struct optstruct *opts, int attempt)
1070 1070
 {
1071 1071
 	int ret, sd;
1072 1072
 	char ipaddr[46];
1073 1073
 
1074 1074
     memset(ipaddr, 0, sizeof(ipaddr));
1075 1075
     if(ip && ip[0]) /* use ip to connect */
1076
-	sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist);
1076
+	sd = wwwconnect(ip, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist, attempt);
1077 1077
     else
1078
-	sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist);
1078
+	sd = wwwconnect(hostname, proxy, port, ipaddr, localip, ctimeout, mdat, logerr, can_whitelist, attempt);
1079 1079
 
1080 1080
     if(sd < 0)
1081 1081
 	return 52;
... ...
@@ -1096,7 +1099,7 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna
1096 1096
     return ret;
1097 1097
 }
1098 1098
 
1099
-static int getcvd(const char *cvdfile, const char *newfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, unsigned int newver, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, const struct optstruct *opts)
1099
+static int getcvd(const char *cvdfile, const char *newfile, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, unsigned int newver, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, const struct optstruct *opts, int attempt)
1100 1100
 {
1101 1101
 	struct cl_cvd *cvd;
1102 1102
 	int ret;
... ...
@@ -1104,7 +1107,7 @@ static int getcvd(const char *cvdfile, const char *newfile, const char *hostname
1104 1104
 
1105 1105
     logg("*Retrieving http://%s/%s\n", hostname, cvdfile);
1106 1106
 
1107
-    if((ret = getfile(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, logerr, can_whitelist, NULL, opts))) {
1107
+    if((ret = getfile(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, logerr, can_whitelist, NULL, opts, attempt))) {
1108 1108
         logg("%cCan't download %s from %s\n", logerr ? '!' : '^', cvdfile, hostname);
1109 1109
         unlink(newfile);
1110 1110
         return ret;
... ...
@@ -1169,7 +1172,7 @@ static int chdir_tmp(const char *dbname, const char *tmpdir)
1169 1169
     return 0;
1170 1170
 }
1171 1171
 
1172
-static int getpatch(const char *dbname, const char *tmpdir, int version, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, const struct optstruct *opts)
1172
+static int getpatch(const char *dbname, const char *tmpdir, int version, const char *hostname, char *ip, const char *localip, const char *proxy, int port, const char *user, const char *pass, const char *uas, int ctimeout, int rtimeout, struct mirdat *mdat, int logerr, unsigned int can_whitelist, const struct optstruct *opts, int attempt)
1173 1173
 {
1174 1174
 	char *tempname, patch[32], olddir[512];
1175 1175
 	int ret, fd;
... ...
@@ -1187,7 +1190,7 @@ static int getpatch(const char *dbname, const char *tmpdir, int version, const c
1187 1187
     snprintf(patch, sizeof(patch), "%s-%d.cdiff", dbname, version);
1188 1188
 
1189 1189
     logg("*Retrieving http://%s/%s\n", hostname, patch);
1190
-    if((ret = getfile(patch, tempname, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, logerr, can_whitelist, NULL, opts))) {
1190
+    if((ret = getfile(patch, tempname, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, logerr, can_whitelist, NULL, opts, attempt))) {
1191 1191
 	if(ret == 53)
1192 1192
 	    logg("Empty script %s, need to download entire database\n", patch);
1193 1193
 	else
... ...
@@ -1553,7 +1556,7 @@ static int checkdbdir(void)
1553 1553
 
1554 1554
 extern int sigchld_wait;
1555 1555
 
1556
-static int updatedb(const char *dbname, const char *hostname, char *ip, int *signo, const struct optstruct *opts, const char *dnsreply, char *localip, int outdated, struct mirdat *mdat, int logerr, int extra)
1556
+static int updatedb(const char *dbname, const char *hostname, char *ip, int *signo, const struct optstruct *opts, const char *dnsreply, char *localip, int outdated, struct mirdat *mdat, int logerr, int extra, int attempt)
1557 1557
 {
1558 1558
 	struct cl_cvd *current, *remote;
1559 1559
 	const struct optstruct *opt;
... ...
@@ -1690,13 +1693,13 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
1690 1690
 
1691 1691
     if(!nodb && !newver) {
1692 1692
 	if(optget(opts, "PrivateMirror")->enabled) {
1693
-	    remote = remote_cvdhead(cldfile, localname, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr, can_whitelist);
1693
+	    remote = remote_cvdhead(cldfile, localname, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr, can_whitelist, attempt);
1694 1694
 	    if(remote)
1695 1695
 		hascld = 1;
1696 1696
 	    else
1697
-		remote = remote_cvdhead(cvdfile, localname, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr, can_whitelist);
1697
+		remote = remote_cvdhead(cvdfile, localname, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr, can_whitelist, attempt);
1698 1698
 	} else
1699
-	    remote = remote_cvdhead(cvdfile, localname, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr, can_whitelist);
1699
+	    remote = remote_cvdhead(cvdfile, localname, hostname, ip, localip, proxy, port, user, pass, uas, &ims, ctimeout, rtimeout, mdat, logerr, can_whitelist, attempt);
1700 1700
 
1701 1701
 	if(!nodb && !ims) {
1702 1702
 	    logg("%s is up to date (version: %d, sigs: %d, f-level: %d, builder: %s)\n", localname, current->version, current->sigs, current->fl, current->builder);
... ...
@@ -1743,24 +1746,6 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
1743 1743
 	cl_cvdfree(current);
1744 1744
     }
1745 1745
 
1746
-    /*
1747
-    if(ipaddr[0]) {
1748
-	hostfd = wwwconnect(ipaddr, proxy, port, NULL, localip);
1749
-    } else {
1750
-	hostfd = wwwconnect(hostname, proxy, port, ipaddr, localip);
1751
-	if(!ip[0])
1752
-	    strcpy(ip, ipaddr);
1753
-    }
1754
-
1755
-    if(hostfd < 0) {
1756
-	if(ipaddr[0])
1757
-	    logg("Connection with %s (IP: %s) failed.\n", hostname, ipaddr);
1758
-	else
1759
-	    logg("Connection with %s failed.\n", hostname);
1760
-	return 52;
1761
-    };
1762
-    */
1763
-
1764 1746
     if(!optget(opts, "ScriptedUpdates")->enabled)
1765 1747
 	nodb = 1;
1766 1748
 
... ...
@@ -1769,11 +1754,11 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
1769 1769
 	if(optget(opts, "PrivateMirror")->enabled) {
1770 1770
 	    ret = 0;
1771 1771
 	    if(hascld)
1772
-		ret = getcvd(cldfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts);
1772
+		ret = getcvd(cldfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts, attempt);
1773 1773
 	    if(ret || !hascld)
1774
-		ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts);
1774
+		ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts, attempt);
1775 1775
 	} else
1776
-	    ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts);
1776
+	    ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts, attempt);
1777 1777
 
1778 1778
 	if(ret) {
1779 1779
 	    if(mirror_stats && strlen(ip)) {
... ...
@@ -1792,11 +1777,11 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
1792 1792
 	tmpdir = cli_gentemp(updtmpdir);
1793 1793
 	maxattempts = optget(opts, "MaxAttempts")->numarg;
1794 1794
 	for(i = currver + 1; i <= newver; i++) {
1795
-	    for(j = 0; j < maxattempts; j++) {
1795
+	    for(j = 1; j <= maxattempts; j++) {
1796 1796
 		    int llogerr = logerr;
1797 1797
 		if(logerr)
1798
-		    llogerr = (j == maxattempts - 1);
1799
-		ret = getpatch(dbname, tmpdir, i, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, llogerr, can_whitelist, opts);
1798
+		    llogerr = (j == maxattempts);
1799
+		ret = getpatch(dbname, tmpdir, i, hostname, ip, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, mdat, llogerr, can_whitelist, opts, attempt == 1 ? j : attempt);
1800 1800
 		if(ret == 52 || ret == 58) {
1801 1801
 		    if(mirror_stats && strlen(ip)) {
1802 1802
 			snprintf(squery, sizeof(squery), "%s.%u.%u.%u.%u.%s.ping.clamav.net", dbname, i, flevel, 0, w32, ip);
... ...
@@ -1818,7 +1803,7 @@ static int updatedb(const char *dbname, const char *hostname, char *ip, int *sig
1818 1818
 	    if(ret != 53)
1819 1819
 		logg("^Incremental update failed, trying to download %s\n", cvdfile);
1820 1820
 	    mirman_whitelist(mdat, 2);
1821
-	    ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts);
1821
+	    ret = getcvd(cvdfile, newfile, hostname, ip, localip, proxy, port, user, pass, uas, newver, ctimeout, rtimeout, mdat, logerr, can_whitelist, opts, attempt);
1822 1822
 	    if(ret) {
1823 1823
 		if(mirror_stats && strlen(ip)) {
1824 1824
 		    snprintf(squery, sizeof(squery), "%s.%u.%u.%u.%u.%s.ping.clamav.net", dbname, 0, flevel, 0, w32, ip);
... ...
@@ -1984,7 +1969,7 @@ static int updatecustomdb(const char *url, int *signo, const struct optstruct *o
1984 1984
 	    Rfc2822DateTime(mtime, sb.st_mtime);
1985 1985
 
1986 1986
 	newfile = cli_gentemp(updtmpdir);
1987
-	ret = getfile(rpath, newfile, host, NULL, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, NULL, logerr, 0, *mtime ? mtime : NULL, opts);
1987
+	ret = getfile(rpath, newfile, host, NULL, localip, proxy, port, user, pass, uas, ctimeout, rtimeout, NULL, logerr, 0, *mtime ? mtime : NULL, opts, 1);
1988 1988
 	if(ret == 1) {
1989 1989
 	    logg("%s is up to date (version: custom database)\n", dbname);
1990 1990
 	    unlink(newfile);
... ...
@@ -2087,10 +2072,10 @@ static int updatecustomdb(const char *url, int *signo, const struct optstruct *o
2087 2087
     return 0;
2088 2088
 }
2089 2089
 
2090
-int downloadmanager(const struct optstruct *opts, const char *hostname, int logerr)
2090
+int downloadmanager(const struct optstruct *opts, const char *hostname, int attempt)
2091 2091
 {
2092 2092
 	time_t currtime;
2093
-	int ret, updated = 0, outdated = 0, signo = 0;
2093
+	int ret, updated = 0, outdated = 0, signo = 0, logerr;
2094 2094
 	unsigned int ttl;
2095 2095
 	char ipaddr[46], *dnsreply = NULL, *pt, *localip = NULL, *newver = NULL;
2096 2096
 	const struct optstruct *opt;
... ...
@@ -2099,6 +2084,8 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2099 2099
 	const char *dnsdbinfo;
2100 2100
 #endif
2101 2101
 
2102
+    logerr = (optget(opts, "MaxAttempts")->numarg == attempt);
2103
+
2102 2104
     pt = cli_gentemp(dbdir);
2103 2105
     if(!pt)
2104 2106
 	return 57;
... ...
@@ -2200,7 +2187,7 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2200 2200
 		u_dnsreply = NULL;
2201 2201
 		u_extra = 1;
2202 2202
 	    }
2203
-	    if((ret = updatedb(opt->strarg, hostname, ipaddr, &signo, opts, u_dnsreply, localip, outdated, &mdat, logerr, u_extra)) > 50) {
2203
+	    if((ret = updatedb(opt->strarg, hostname, ipaddr, &signo, opts, u_dnsreply, localip, outdated, &mdat, logerr, u_extra, attempt)) > 50) {
2204 2204
 		if(dnsreply)
2205 2205
 		    free(dnsreply);
2206 2206
 		if(newver)
... ...
@@ -2216,7 +2203,7 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2216 2216
 	}
2217 2217
 
2218 2218
     } else {
2219
-	if((ret = updatedb("main", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0)) > 50) {
2219
+	if((ret = updatedb("main", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0, attempt)) > 50) {
2220 2220
 	    if(dnsreply)
2221 2221
 		free(dnsreply);
2222 2222
 	    if(newver)
... ...
@@ -2229,7 +2216,7 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2229 2229
 	    updated = 1;
2230 2230
 
2231 2231
 	/* if ipaddr[0] != 0 it will use it to connect to the web host */
2232
-	if((ret = updatedb("daily", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0)) > 50) {
2232
+	if((ret = updatedb("daily", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0, attempt)) > 50) {
2233 2233
 	    if(dnsreply)
2234 2234
 		free(dnsreply);
2235 2235
 	    if(newver)
... ...
@@ -2255,7 +2242,7 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2255 2255
 		else
2256 2256
 		    logg("*%s removed\n", safedb);
2257 2257
 	    }
2258
-	} else if((ret = updatedb("safebrowsing", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0)) > 50) {
2258
+	} else if((ret = updatedb("safebrowsing", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0, attempt)) > 50) {
2259 2259
 	    if(dnsreply)
2260 2260
 		free(dnsreply);
2261 2261
 	    if(newver)
... ...
@@ -2281,7 +2268,7 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2281 2281
 		else
2282 2282
 		    logg("*%s removed\n", dbname);
2283 2283
 	    }
2284
-	} else if((ret = updatedb("bytecode", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0)) > 50) {
2284
+	} else if((ret = updatedb("bytecode", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr, 0, attempt)) > 50) {
2285 2285
 	    if(dnsreply)
2286 2286
 		free(dnsreply);
2287 2287
 	    if(newver)
... ...
@@ -2296,7 +2283,7 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, int loge
2296 2296
 	/* handle extra dbs */
2297 2297
 	if((opt = optget(opts, "ExtraDatabase"))->enabled) {
2298 2298
 	    while(opt) {
2299
-		if((ret = updatedb(opt->strarg, hostname, ipaddr, &signo, opts, NULL, localip, outdated, &mdat, logerr, 1)) > 50) {
2299
+		if((ret = updatedb(opt->strarg, hostname, ipaddr, &signo, opts, NULL, localip, outdated, &mdat, logerr, 1, attempt)) > 50) {
2300 2300
 		    if(dnsreply)
2301 2301
 			free(dnsreply);
2302 2302
 		    if(newver)
... ...
@@ -25,7 +25,7 @@
25 25
 
26 26
 #include "shared/optparser.h"
27 27
 
28
-int downloadmanager(const struct optstruct *opts, const char *hostname, int logerr);
28
+int downloadmanager(const struct optstruct *opts, const char *hostname, int attempt);
29 29
 
30 30
 int submitstats(const char *clamdcfg, const struct optstruct *opts);
31 31