git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@142 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2003/12/06 08:45:11... | ... |
@@ -45,6 +45,7 @@ Nicholas M. Kirsch <nick*kirsch.org> |
45 | 45 |
Robbert Kouprie <robbert*exx.nl> |
46 | 46 |
Thomas Lamy <Thomas.Lamy*in-online.net> |
47 | 47 |
Peter N Lewis <peter*stairways.com.au> |
48 |
+David S. Madole <david*madole.net> |
|
48 | 49 |
Mark Mielke <mark*mark.mielke.cc> |
49 | 50 |
Arkadiusz Miskiewicz <misiek*pld.org.pl> |
50 | 51 |
Hendrik Muhs <Hendrik.Muhs*student.uni-magdeburg.de> |
... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Sat Dec 6 00:43:08 CET 2003 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * Applied a patch from David S. Madole <david*madole.net>: |
|
4 |
+ + clamd: accept a hostname for the "TCPAddr" parameter |
|
5 |
+ + clamdscan: use the "TCPAddr" parameter |
|
6 |
+ |
|
1 | 7 |
Fri Dec 5 19:16:08 GMT 2003 (njh) |
2 | 8 |
---------------------------------- |
3 | 9 |
* clamav-milter: Added call to umask to ensure that the local socket |
... | ... |
@@ -24,6 +24,7 @@ |
24 | 24 |
#include <arpa/inet.h> |
25 | 25 |
#include <clamav.h> |
26 | 26 |
#include <errno.h> |
27 |
+#include <netdb.h> |
|
27 | 28 |
|
28 | 29 |
|
29 | 30 |
#include "options.h" |
... | ... |
@@ -38,6 +39,7 @@ int tcpserver(const struct optstruct *opt, const struct cfgstruct *copt, struct |
38 | 38 |
int sockfd, backlog; |
39 | 39 |
struct cfgstruct *cpt; |
40 | 40 |
struct cfgstruct *taddr; |
41 |
+ struct hostent *he; |
|
41 | 42 |
char *estr; |
42 | 43 |
int true = 1; |
43 | 44 |
|
... | ... |
@@ -46,13 +48,14 @@ int tcpserver(const struct optstruct *opt, const struct cfgstruct *copt, struct |
46 | 46 |
server.sin_port = htons(cfgopt(copt, "TCPSocket")->numarg); |
47 | 47 |
|
48 | 48 |
|
49 |
- if((taddr = cfgopt(copt, "TCPAddr"))) |
|
50 |
- { |
|
51 |
- server.sin_addr.s_addr = inet_addr( taddr->strarg ); |
|
52 |
- }else |
|
53 |
- { |
|
49 |
+ if((taddr = cfgopt(copt, "TCPAddr"))) { |
|
50 |
+ if ((he = gethostbyname(taddr->strarg)) == 0) { |
|
51 |
+ logg("!gethostbyname(%s) error: %s\n", taddr->strarg, strerror(errno)); |
|
52 |
+ exit(1); |
|
53 |
+ } |
|
54 |
+ server.sin_addr = *(struct in_addr *) he->h_addr_list[0]; |
|
55 |
+ } else |
|
54 | 56 |
server.sin_addr.s_addr = INADDR_ANY; |
55 |
- } |
|
56 | 57 |
|
57 | 58 |
|
58 | 59 |
if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { |
... | ... |
@@ -23,6 +23,7 @@ |
23 | 23 |
#include <sys/un.h> |
24 | 24 |
#include <netinet/in.h> |
25 | 25 |
#include <arpa/inet.h> |
26 |
+#include <netdb.h> |
|
26 | 27 |
|
27 | 28 |
#include "others.h" |
28 | 29 |
#include "cfgfile.h" |
... | ... |
@@ -34,6 +35,7 @@ int client(const struct optstruct *opt) |
34 | 34 |
char buff[4096], cwd[200], *file, *scancmd, *pt; |
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, wsockd, loopw = 60, bread, port; |
39 | 40 |
const char *clamav_conf = getargl(opt, "config-file"); |
... | ... |
@@ -87,9 +89,19 @@ int client(const struct optstruct *opt) |
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
server2.sin_family = AF_INET; |
90 |
- server2.sin_addr.s_addr = inet_addr("127.0.0.1"); |
|
91 | 90 |
server2.sin_port = htons(cpt->numarg); |
92 | 91 |
|
92 |
+ if((cpt = cfgopt(copt, "TCPAddr"))) { |
|
93 |
+ if ((he = gethostbyname(cpt->strarg)) == 0) { |
|
94 |
+ close(sockd); |
|
95 |
+ perror("gethostbyname()"); |
|
96 |
+ mprintf("@Can't lookup clamd hostname.\n"); |
|
97 |
+ return 2; |
|
98 |
+ } |
|
99 |
+ server2.sin_addr = *(struct in_addr *) he->h_addr_list[0]; |
|
100 |
+ |
|
101 |
+ } else server2.sin_addr.s_addr = inet_addr("127.0.0.1"); |
|
102 |
+ |
|
93 | 103 |
if(connect(sockd, (struct sockaddr *) &server2, sizeof(struct sockaddr_in)) < 0) { |
94 | 104 |
close(sockd); |
95 | 105 |
perror("connect()"); |