Browse code

clamdscan: fixed problem with the LocalSocket mode

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

Tomasz Kojm authored on 2004/03/18 22:59:43
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Thu Mar 18 15:04:41 CET 2004 (tk)
2
+---------------------------------
3
+  * clamdscan: in the LocalSocket mode the server2 address struct was not
4
+	       properly initialized. Fixed by "Nemosoft Unv."
5
+	       <nemosoft*smcc.demon.nl>.
6
+
1 7
 Thu Mar 18 09:56:24 GMT 2004 (trog)
2 8
 -----------------------------------
3 9
   * libclamav/vba_extract.c: Simplify the code, and make it work all relevant
... ...
@@ -54,6 +54,8 @@ int client(const struct optstruct *opt)
54 54
 	return 2;
55 55
     }
56 56
 
57
+    /* Set default address to connect to; needed for scanning a stream and no TCP address specified */
58
+    server2.sin_addr.s_addr = inet_addr("127.0.0.1");    
57 59
     if(cfgopt(copt, "ScannerDaemonOutputFormat")) {
58 60
 	mprintf("clamdscan won't work with the ScannerDaemonOutputFormat option\n");
59 61
 	mprintf("enabled. Please disable it in %s\n", clamav_conf);
... ...
@@ -105,7 +107,7 @@ int client(const struct optstruct *opt)
105 105
 	    }
106 106
 	    server2.sin_addr = *(struct in_addr *) he->h_addr_list[0];
107 107
 
108
-	} else server2.sin_addr.s_addr = inet_addr("127.0.0.1");
108
+	}
109 109
 
110 110
 	if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) {
111 111
 	    close(sockd);