Browse code

freshclam/manager.c: automatically remove safebrowsing.cvd when SafeBrowsing gets turned off

git-svn: trunk@4956

Tomasz Kojm authored on 2009/03/17 01:27:28
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Mar 16 17:23:07 CET 2009 (tk)
2
+---------------------------------
3
+ * freshclam/manager.c: automatically remove safebrowsing.cvd when SafeBrowsing
4
+			gets turned off
5
+
1 6
 Mon Mar 16 15:53:52 EET 2009 (edwin)
2 7
 ------------------------------------
3 8
  * libclamav/phishcheck.c: add comments, no functionality change.
... ...
@@ -1832,7 +1832,14 @@ int downloadmanager(const struct optstruct *opts, const char *hostname, const ch
1832 1832
 	updated = 1;
1833 1833
 
1834 1834
     /* if ipaddr[0] != 0 it will use it to connect to the web host */
1835
-    if(optget(opts, "SafeBrowsing")->enabled && (ret = updatedb("safebrowsing", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr)) > 50) {
1835
+    if(!optget(opts, "SafeBrowsing")->enabled) {
1836
+	if(!access("safebrowsing.cvd", R_OK)) {
1837
+	    if(unlink("safebrowsing.cvd"))
1838
+		logg("^SafeBrowsing is disabled but can't remove old safebrowsing.cvd\n");
1839
+	    else
1840
+		logg("*safebrowsing.cvd removed\n");
1841
+	}
1842
+    } else if((ret = updatedb("safebrowsing", hostname, ipaddr, &signo, opts, dnsreply, localip, outdated, &mdat, logerr)) > 50) {
1836 1843
 	if(dnsreply)
1837 1844
 	    free(dnsreply);
1838 1845