git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@145 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2003/12/08 06:47:59... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Sun Dec 7 22:46:15 CET 2003 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * freshclam: use the TCPAddr parameter (patch from David S. Madole) |
|
4 |
+ |
|
1 | 5 |
Sat Dec 6 04:04:00 GMT 2003 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav: Handle hand crafted emails that incorrectly set multipart headers |
... | ... |
@@ -25,6 +25,7 @@ |
25 | 25 |
#include <sys/un.h> |
26 | 26 |
#include <netinet/in.h> |
27 | 27 |
#include <arpa/inet.h> |
28 |
+#include <netdb.h> |
|
28 | 29 |
|
29 | 30 |
#include "others.h" |
30 | 31 |
#include "cfgfile.h" |
... | ... |
@@ -34,6 +35,7 @@ int notify(const char *cfgfile) |
34 | 34 |
char buff[20]; |
35 | 35 |
struct sockaddr_un server; |
36 | 36 |
struct sockaddr_in server2; |
37 |
+ struct hostent *he; |
|
37 | 38 |
struct cfgstruct *copt, *cpt; |
38 | 39 |
int sockd, bread; |
39 | 40 |
|
... | ... |
@@ -77,9 +79,19 @@ int notify(const char *cfgfile) |
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
server2.sin_family = AF_INET; |
80 |
- server2.sin_addr.s_addr = inet_addr("127.0.0.1"); |
|
81 | 80 |
server2.sin_port = htons(cpt->numarg); |
82 | 81 |
|
82 |
+ if ((cpt = cfgopt(copt, "TCPAddr"))) { |
|
83 |
+ if ((he = gethostbyname(cpt->strarg)) == 0) { |
|
84 |
+ perror("gethostbyname()"); |
|
85 |
+ mprintf("@Can't lookup hostname.\n"); |
|
86 |
+ return 1; |
|
87 |
+ } |
|
88 |
+ server2.sin_addr = *(struct in_addr *) he->h_addr_list[0]; |
|
89 |
+ } else |
|
90 |
+ server2.sin_addr.s_addr = inet_addr("127.0.0.1"); |
|
91 |
+ |
|
92 |
+ |
|
83 | 93 |
if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) { |
84 | 94 |
close(sockd); |
85 | 95 |
perror("connect()"); |