Browse code

update

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1833 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2006/01/28 06:38:26
Showing 2 changed files
... ...
@@ -388,7 +388,7 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
388 388
     tempname = cli_gentemp(".");
389 389
 
390 390
     logg("*Retrieving http://%s/%s\n", hostname, remotename);
391
-    if((ret = get_database(remotename, hostfd, tempname, hostname, proxy, user, pass))) {
391
+    if((ret = get_database(remotename, hostfd, tempname, hostname, proxy, user, pass, uas))) {
392 392
         logg("^Can't download %s from %s (IP: %s)\n", remotename, hostname, ipaddr);
393 393
         unlink(tempname);
394 394
         free(tempname);
... ...
@@ -660,7 +660,7 @@ struct cl_cvd *remote_cvdhead(const char *file, int socketfd, const char *hostna
660 660
 	"Connection: close\r\n"
661 661
 	"Range: bytes=0-511\r\n"
662 662
         "If-Modified-Since: %s\r\n"
663
-        "\r\n", (remotename != NULL)?remotename:"", file, hostname, (authorization != NULL)?authorization:"", uas, last_modified);
663
+        "\r\n", (remotename != NULL)?remotename:"", file, hostname, (authorization != NULL)?authorization:"", agent, last_modified);
664 664
 #endif
665 665
     write(socketfd, cmd, strlen(cmd));
666 666
 
... ...
@@ -725,12 +725,12 @@ struct cl_cvd *remote_cvdhead(const char *file, int socketfd, const char *hostna
725 725
     return cvd;
726 726
 }
727 727
 
728
-int get_database(const char *dbfile, int socketfd, const char *file, const char *hostname, const char *proxy, const char *user, const char *pass)
728
+int get_database(const char *dbfile, int socketfd, const char *file, const char *hostname, const char *proxy, const char *user, const char *pass, const char *uas)
729 729
 {
730 730
 	char cmd[512], buffer[FILEBUFF], *ch;
731 731
 	int bread, fd, i, rot = 0;
732 732
 	char *remotename = NULL, *authorization = NULL;
733
-	const char *rotation = "|/-\\";
733
+	const char *rotation = "|/-\\", *agent;
734 734
 
735 735
 
736 736
     if(proxy) {
... ...
@@ -764,20 +764,25 @@ int get_database(const char *dbfile, int socketfd, const char *file, const char
764 764
 	return 57;
765 765
     }
766 766
 
767
+    if(uas)
768
+	agent = uas;
769
+    else
770
+	agent = PACKAGE"/"VERSION;
771
+
767 772
 #ifdef NO_SNPRINTF
768 773
     sprintf(cmd, "GET %s/%s HTTP/1.1\r\n"
769 774
 	     "Host: %s\r\n%s"
770
-	     "User-Agent: "PACKAGE"/"VERSION"\r\n"
775
+	     "User-Agent: %s\r\n"
771 776
 	     "Cache-Control: no-cache\r\n"
772 777
 	     "Connection: close\r\n"
773
-	     "\r\n", (remotename != NULL)?remotename:"", dbfile, hostname, (authorization != NULL)?authorization:"");
778
+	     "\r\n", (remotename != NULL)?remotename:"", dbfile, hostname, (authorization != NULL)?authorization:"", agent);
774 779
 #else
775 780
     snprintf(cmd, sizeof(cmd), "GET %s/%s HTTP/1.1\r\n"
776 781
 	     "Host: %s\r\n%s"
777
-	     "User-Agent: "PACKAGE"/"VERSION"\r\n"
782
+	     "User-Agent: %s\r\n"
778 783
 	     "Cache-Control: no-cache\r\n"
779 784
 	     "Connection: close\r\n"
780
-	     "\r\n", (remotename != NULL)?remotename:"", dbfile, hostname, (authorization != NULL)?authorization:"");
785
+	     "\r\n", (remotename != NULL)?remotename:"", dbfile, hostname, (authorization != NULL)?authorization:"", agent);
781 786
 #endif
782 787
     write(socketfd, cmd, strlen(cmd));
783 788
 
... ...
@@ -30,7 +30,7 @@ int wwwconnect(const char *server, const char *proxy, int pport, char *remoteip,
30 30
 
31 31
 struct cl_cvd *remote_cvdhead(const char *file, int socketfd, const char *hostname, const char *proxy, const char *user, const char *pass, const char *uas, int *ims);
32 32
 
33
-int get_database(const char *dbfile, int socketfd, const char *file, const char *hostname, const char *proxy, const char *user, const char *pass);
33
+int get_database(const char *dbfile, int socketfd, const char *file, const char *hostname, const char *proxy, const char *user, const char *pass, const char *uas);
34 34
 
35 35
 unsigned int fmt_base64(char* dest,const char* src,unsigned int len);
36 36