git-svn: trunk@3849
Török Edvin authored on 2008/05/10 06:12:28... | ... |
@@ -1,3 +1,13 @@ |
1 |
+Fri May 9 23:11:51 EEST 2008 (edwin) |
|
2 |
+------------------------------------- |
|
3 |
+ * build system: add configure checks for FD passing |
|
4 |
+ * m4/fdpassing.m4: move all FD passing checks here |
|
5 |
+ * clamd/session.[ch], scanner.[ch]: |
|
6 |
+ * contrib/clamd_fdscan: |
|
7 |
+ add rfc2292/bsd4.4 style file descriptor passing support |
|
8 |
+ this code is from Marc Balmer <marc*msys.ch>, with some portability |
|
9 |
+ fixes applied |
|
10 |
+ |
|
1 | 11 |
Fri May 9 14:46:57 EEST 2008 (edwin) |
2 | 12 |
------------------------------------- |
3 | 13 |
* contrib/init/RedHat: check for already running clamav-milter (bb #823) |
... | ... |
@@ -71,8 +71,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ |
71 | 71 |
config/ltmain.sh config/missing mkinstalldirs |
72 | 72 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
73 | 73 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
74 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
75 |
- $(top_srcdir)/configure.in |
|
74 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
75 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
76 | 76 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
77 | 77 |
$(ACLOCAL_M4) |
78 | 78 |
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ |
... | ... |
@@ -132,7 +132,7 @@ AC_LIB_PROG_LD_GNU |
132 | 132 |
|
133 | 133 |
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- |
134 | 134 |
|
135 |
-# serial 52 Debian 1.5.26-3 AC_PROG_LIBTOOL |
|
135 |
+# serial 52 Debian 1.5.26-4 AC_PROG_LIBTOOL |
|
136 | 136 |
|
137 | 137 |
|
138 | 138 |
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) |
... | ... |
@@ -7630,5 +7630,6 @@ AC_SUBST([am__untar]) |
7630 | 7630 |
]) # _AM_PROG_TAR |
7631 | 7631 |
|
7632 | 7632 |
m4_include([m4/acinclude.m4]) |
7633 |
+m4_include([m4/fdpassing.m4]) |
|
7633 | 7634 |
m4_include([m4/lib-link.m4]) |
7634 | 7635 |
m4_include([m4/lib-prefix.m4]) |
... | ... |
@@ -84,6 +84,9 @@ |
84 | 84 |
/* "build unrar code" */ |
85 | 85 |
#undef ENABLE_UNRAR |
86 | 86 |
|
87 |
+/* whether _XOPEN_SOURCE needs to be defined for fd passing to work */ |
|
88 |
+#undef FDPASS_NEED_XOPEN |
|
89 |
+ |
|
87 | 90 |
/* file i/o buffer size */ |
88 | 91 |
#undef FILEBUFF |
89 | 92 |
|
... | ... |
@@ -96,9 +99,6 @@ |
96 | 96 |
/* use "Cache-Control: no-cache" in freshclam */ |
97 | 97 |
#undef FRESHCLAM_NO_CACHE |
98 | 98 |
|
99 |
-/* access rights in msghdr */ |
|
100 |
-#undef HAVE_ACCRIGHTS_IN_MSGHDR |
|
101 |
- |
|
102 | 99 |
/* attrib aligned */ |
103 | 100 |
#undef HAVE_ATTRIB_ALIGNED |
104 | 101 |
|
... | ... |
@@ -129,6 +129,9 @@ |
129 | 129 |
/* Define to 1 if you have the <dlfcn.h> header file. */ |
130 | 130 |
#undef HAVE_DLFCN_H |
131 | 131 |
|
132 |
+/* have working file descriptor passing support */ |
|
133 |
+#undef HAVE_FD_PASSING |
|
134 |
+ |
|
132 | 135 |
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ |
133 | 136 |
#undef HAVE_FSEEKO |
134 | 137 |
|
... | ... |
@@ -306,9 +309,6 @@ |
306 | 306 |
/* zlib installed */ |
307 | 307 |
#undef HAVE_ZLIB_H |
308 | 308 |
|
309 |
-/* Early Linux doesn't set cmsg fields */ |
|
310 |
-#undef INCOMPLETE_CMSG |
|
311 |
- |
|
312 | 309 |
/* bzip funtions do not have bz2 prefix */ |
313 | 310 |
#undef NOBZ2PREFIX |
314 | 311 |
|
... | ... |
@@ -57,8 +57,8 @@ subdir = clamav-milter |
57 | 57 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in INSTALL |
58 | 58 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
59 | 59 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
60 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
61 |
- $(top_srcdir)/configure.in |
|
60 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
61 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
62 | 62 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
63 | 63 |
$(ACLOCAL_M4) |
64 | 64 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -56,8 +56,8 @@ subdir = clamconf |
56 | 56 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
57 | 57 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
58 | 58 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
59 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
60 |
- $(top_srcdir)/configure.in |
|
59 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
60 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
61 | 61 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
62 | 62 |
$(ACLOCAL_M4) |
63 | 63 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -56,8 +56,8 @@ subdir = clamd |
56 | 56 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
57 | 57 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
58 | 58 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
59 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
60 |
- $(top_srcdir)/configure.in |
|
59 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
60 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
61 | 61 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
62 | 62 |
$(ACLOCAL_M4) |
63 | 63 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -373,6 +373,45 @@ int scan(const char *filename, unsigned long int *scanned, const struct cl_engin |
373 | 373 |
return ret; |
374 | 374 |
} |
375 | 375 |
|
376 |
+/* |
|
377 |
+ * This function was readded by mbalmer@openbsd.org. That is the reason |
|
378 |
+ * why it is so nicely formatted. |
|
379 |
+ */ |
|
380 |
+int scanfd(const int fd, unsigned long int *scanned, |
|
381 |
+ const struct cl_engine *engine, const struct cl_limits *limits, |
|
382 |
+ unsigned int options, const struct cfgstruct *copt, int odesc) |
|
383 |
+{ |
|
384 |
+ int ret; |
|
385 |
+ const char *virname; |
|
386 |
+ struct stat statbuf; |
|
387 |
+ char fdstr[32]; |
|
388 |
+ |
|
389 |
+ |
|
390 |
+ if(fstat(fd, &statbuf) == -1) |
|
391 |
+ return -1; |
|
392 |
+ |
|
393 |
+ if(!S_ISREG(statbuf.st_mode)) |
|
394 |
+ return -1; |
|
395 |
+ |
|
396 |
+ snprintf(fdstr, sizeof(fdstr), "fd[%d]", fd); |
|
397 |
+ |
|
398 |
+ ret = cl_scandesc(fd, &virname, scanned, engine, limits, options); |
|
399 |
+ |
|
400 |
+ if(ret == CL_VIRUS) { |
|
401 |
+ mdprintf(odesc, "%s: %s FOUND\n", fdstr, virname); |
|
402 |
+ logg("%s: %s FOUND\n", fdstr, virname); |
|
403 |
+ virusaction(fdstr, virname, copt); |
|
404 |
+ } else if(ret != CL_CLEAN) { |
|
405 |
+ mdprintf(odesc, "%s: %s ERROR\n", fdstr, cl_strerror(ret)); |
|
406 |
+ logg("%s: %s ERROR\n", fdstr, cl_strerror(ret)); |
|
407 |
+ } else { |
|
408 |
+ mdprintf(odesc, "%s: OK\n", fdstr); |
|
409 |
+ if(logok) |
|
410 |
+ logg("%s: OK\n", fdstr); |
|
411 |
+ } |
|
412 |
+ return ret; |
|
413 |
+} |
|
414 |
+ |
|
376 | 415 |
int scanstream(int odesc, unsigned long int *scanned, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt) |
377 | 416 |
{ |
378 | 417 |
int ret, sockfd, acceptd; |
... | ... |
@@ -28,6 +28,8 @@ |
28 | 28 |
|
29 | 29 |
int scan(const char *filename, unsigned long int *scanned, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt, int odesc, unsigned int type); |
30 | 30 |
|
31 |
+int scanfd(const int fd, unsigned long int *scanned, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt, int odesc); |
|
32 |
+ |
|
31 | 33 |
int scanstream(int odesc, unsigned long int *scanned, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt); |
32 | 34 |
|
33 | 35 |
#endif |
... | ... |
@@ -24,6 +24,11 @@ |
24 | 24 |
#include "clamav-config.h" |
25 | 25 |
#endif |
26 | 26 |
|
27 |
+#if defined HAVE_FD_PASSING && defined FDPASS_NEED_XOPEN |
|
28 |
+/* to expose BSD 4.4/Unix98 semantics instead of BSD 4.3 semantics */ |
|
29 |
+#define _XOPEN_SOURCE 500 |
|
30 |
+#endif |
|
31 |
+ |
|
27 | 32 |
#include <stdio.h> |
28 | 33 |
#include <stdlib.h> |
29 | 34 |
#include <string.h> |
... | ... |
@@ -33,7 +38,12 @@ |
33 | 33 |
#include <sys/types.h> |
34 | 34 |
#ifndef C_WINDOWS |
35 | 35 |
#include <dirent.h> |
36 |
+ |
|
36 | 37 |
#include <sys/socket.h> |
38 |
+#ifdef HAVE_FD_PASSING |
|
39 |
+#include <sys/uio.h> |
|
40 |
+#endif |
|
41 |
+ |
|
37 | 42 |
#include <sys/time.h> |
38 | 43 |
#endif |
39 | 44 |
#include <pthread.h> |
... | ... |
@@ -54,12 +64,57 @@ |
54 | 54 |
#include "server.h" |
55 | 55 |
#include "session.h" |
56 | 56 |
|
57 |
+#ifdef HAVE_FD_PASSING |
|
58 |
+static int recvfd_and_scan(int desc, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt) |
|
59 |
+{ |
|
60 |
+ struct msghdr msg; |
|
61 |
+ struct cmsghdr *cmsg; |
|
62 |
+ unsigned char buf[CMSG_SPACE(sizeof(int))]; |
|
63 |
+ struct iovec iov[1]; |
|
64 |
+ char dummy; |
|
65 |
+ int ret=-1; |
|
66 |
+ |
|
67 |
+ memset(&msg, 0, sizeof(msg)); |
|
68 |
+ iov[0].iov_base = &dummy; |
|
69 |
+ iov[0].iov_len = 1; |
|
70 |
+ msg.msg_iov = iov; |
|
71 |
+ msg.msg_iovlen = 1; |
|
72 |
+ msg.msg_control = buf; |
|
73 |
+ msg.msg_controllen = sizeof(buf); |
|
74 |
+ |
|
75 |
+ if (recvmsg(desc, &msg, 0) == -1) { |
|
76 |
+ logg("recvmsg failed: %s!", strerror(errno)); |
|
77 |
+ return -1; |
|
78 |
+ } |
|
79 |
+ if ((msg.msg_flags & MSG_TRUNC) || (msg.msg_flags & MSG_CTRUNC)) { |
|
80 |
+ logg("control message truncated"); |
|
81 |
+ return -1; |
|
82 |
+ } |
|
83 |
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; |
|
84 |
+ cmsg = CMSG_NXTHDR(&msg, cmsg)) { |
|
85 |
+ if (cmsg->cmsg_len == CMSG_LEN(sizeof(int)) && |
|
86 |
+ cmsg->cmsg_level == SOL_SOCKET && |
|
87 |
+ cmsg->cmsg_type == SCM_RIGHTS) { |
|
88 |
+ int fd = *(int *)CMSG_DATA(cmsg); |
|
89 |
+ ret = scanfd(fd, NULL, engine, limits, options, copt, desc); |
|
90 |
+ close(fd); |
|
91 |
+ } |
|
92 |
+ } |
|
93 |
+ return ret; |
|
94 |
+} |
|
95 |
+ |
|
96 |
+#else |
|
97 |
+static int recvfd_and_scan(int desc) |
|
98 |
+{ |
|
99 |
+ mdprintf(desc, "ERROR: FILDES support not compiled in\n"); |
|
100 |
+} |
|
101 |
+#endif |
|
102 |
+ |
|
57 | 103 |
int command(int desc, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt, int timeout) |
58 | 104 |
{ |
59 | 105 |
char buff[1025]; |
60 | 106 |
int bread, opt; |
61 | 107 |
|
62 |
- |
|
63 | 108 |
bread = readsock(desc, buff, sizeof(buff)-1, '\n', timeout, 0, 1); |
64 | 109 |
if(bread == -2) /* timeout */ |
65 | 110 |
return -2; |
... | ... |
@@ -140,6 +195,10 @@ int command(int desc, const struct cl_engine *engine, const struct cl_limits *li |
140 | 140 |
if(cfgopt(copt, "ExitOnOOM")->enabled) |
141 | 141 |
return COMMAND_SHUTDOWN; |
142 | 142 |
|
143 |
+ } else if(!strncmp(buff, CMD14, strlen(CMD14))) { /* FILDES */ |
|
144 |
+ if(recvfd_and_scan(desc, engine, limits, options, copt) == -2) |
|
145 |
+ if(cfgopt(copt, "ExitOnOOM")->enabled) |
|
146 |
+ return COMMAND_SHUTDOWN; |
|
143 | 147 |
} else { |
144 | 148 |
mdprintf(desc, "UNKNOWN COMMAND\n"); |
145 | 149 |
} |
... | ... |
@@ -56,8 +56,8 @@ subdir = clamdscan |
56 | 56 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
57 | 57 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
58 | 58 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
59 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
60 |
- $(top_srcdir)/configure.in |
|
59 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
60 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
61 | 61 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
62 | 62 |
$(ACLOCAL_M4) |
63 | 63 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -57,8 +57,8 @@ subdir = clamscan |
57 | 57 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
58 | 58 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
59 | 59 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
60 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
61 |
- $(top_srcdir)/configure.in |
|
60 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
61 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
62 | 62 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
63 | 63 |
$(ACLOCAL_M4) |
64 | 64 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -43,7 +43,7 @@ EXIT_FAILURE=1 |
43 | 43 |
|
44 | 44 |
PROGRAM=ltmain.sh |
45 | 45 |
PACKAGE=libtool |
46 |
-VERSION="1.5.26 Debian 1.5.26-3" |
|
46 |
+VERSION="1.5.26 Debian 1.5.26-4" |
|
47 | 47 |
TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" |
48 | 48 |
|
49 | 49 |
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). |
... | ... |
@@ -1520,6 +1520,7 @@ Optional Features: |
1520 | 1520 |
--enable-bigstack increase thread stack size |
1521 | 1521 |
--disable-gethostbyname_r disable support for gethostbyname_r |
1522 | 1522 |
--enable-readdir_r enable support for readdir_r |
1523 |
+ --disable-fdpassing don't build file descriptor passing support |
|
1523 | 1524 |
|
1524 | 1525 |
Optional Packages: |
1525 | 1526 |
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
... | ... |
@@ -4766,7 +4767,7 @@ ia64-*-hpux*) |
4766 | 4766 |
;; |
4767 | 4767 |
*-*-irix6*) |
4768 | 4768 |
# Find out which ABI we are using. |
4769 |
- echo '#line 4769 "configure"' > conftest.$ac_ext |
|
4769 |
+ echo '#line 4770 "configure"' > conftest.$ac_ext |
|
4770 | 4770 |
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 |
4771 | 4771 |
(eval $ac_compile) 2>&5 |
4772 | 4772 |
ac_status=$? |
... | ... |
@@ -6856,11 +6857,11 @@ else |
6856 | 6856 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
6857 | 6857 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
6858 | 6858 |
-e 's:$: $lt_compiler_flag:'` |
6859 |
- (eval echo "\"\$as_me:6859: $lt_compile\"" >&5) |
|
6859 |
+ (eval echo "\"\$as_me:6860: $lt_compile\"" >&5) |
|
6860 | 6860 |
(eval "$lt_compile" 2>conftest.err) |
6861 | 6861 |
ac_status=$? |
6862 | 6862 |
cat conftest.err >&5 |
6863 |
- echo "$as_me:6863: \$? = $ac_status" >&5 |
|
6863 |
+ echo "$as_me:6864: \$? = $ac_status" >&5 |
|
6864 | 6864 |
if (exit $ac_status) && test -s "$ac_outfile"; then |
6865 | 6865 |
# The compiler can only warn and ignore the option if not recognized |
6866 | 6866 |
# So say no if there are warnings other than the usual output. |
... | ... |
@@ -7146,11 +7147,11 @@ else |
7146 | 7146 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7147 | 7147 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7148 | 7148 |
-e 's:$: $lt_compiler_flag:'` |
7149 |
- (eval echo "\"\$as_me:7149: $lt_compile\"" >&5) |
|
7149 |
+ (eval echo "\"\$as_me:7150: $lt_compile\"" >&5) |
|
7150 | 7150 |
(eval "$lt_compile" 2>conftest.err) |
7151 | 7151 |
ac_status=$? |
7152 | 7152 |
cat conftest.err >&5 |
7153 |
- echo "$as_me:7153: \$? = $ac_status" >&5 |
|
7153 |
+ echo "$as_me:7154: \$? = $ac_status" >&5 |
|
7154 | 7154 |
if (exit $ac_status) && test -s "$ac_outfile"; then |
7155 | 7155 |
# The compiler can only warn and ignore the option if not recognized |
7156 | 7156 |
# So say no if there are warnings other than the usual output. |
... | ... |
@@ -7250,11 +7251,11 @@ else |
7250 | 7250 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7251 | 7251 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7252 | 7252 |
-e 's:$: $lt_compiler_flag:'` |
7253 |
- (eval echo "\"\$as_me:7253: $lt_compile\"" >&5) |
|
7253 |
+ (eval echo "\"\$as_me:7254: $lt_compile\"" >&5) |
|
7254 | 7254 |
(eval "$lt_compile" 2>out/conftest.err) |
7255 | 7255 |
ac_status=$? |
7256 | 7256 |
cat out/conftest.err >&5 |
7257 |
- echo "$as_me:7257: \$? = $ac_status" >&5 |
|
7257 |
+ echo "$as_me:7258: \$? = $ac_status" >&5 |
|
7258 | 7258 |
if (exit $ac_status) && test -s out/conftest2.$ac_objext |
7259 | 7259 |
then |
7260 | 7260 |
# The compiler can only warn and ignore the option if not recognized |
... | ... |
@@ -9627,7 +9628,7 @@ else |
9627 | 9627 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
9628 | 9628 |
lt_status=$lt_dlunknown |
9629 | 9629 |
cat > conftest.$ac_ext <<EOF |
9630 |
-#line 9630 "configure" |
|
9630 |
+#line 9631 "configure" |
|
9631 | 9631 |
#include "confdefs.h" |
9632 | 9632 |
|
9633 | 9633 |
#if HAVE_DLFCN_H |
... | ... |
@@ -9727,7 +9728,7 @@ else |
9727 | 9727 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
9728 | 9728 |
lt_status=$lt_dlunknown |
9729 | 9729 |
cat > conftest.$ac_ext <<EOF |
9730 |
-#line 9730 "configure" |
|
9730 |
+#line 9731 "configure" |
|
9731 | 9731 |
#include "confdefs.h" |
9732 | 9732 |
|
9733 | 9733 |
#if HAVE_DLFCN_H |
... | ... |
@@ -16329,15 +16330,6 @@ _ACEOF |
16329 | 16329 |
|
16330 | 16330 |
fi |
16331 | 16331 |
fi |
16332 |
- case `uname -r` in |
|
16333 |
- 1.*|2.0.*) |
|
16334 |
- |
|
16335 |
-cat >>confdefs.h <<\_ACEOF |
|
16336 |
-#define INCOMPLETE_CMSG 1 |
|
16337 |
-_ACEOF |
|
16338 |
- |
|
16339 |
- ;; |
|
16340 |
- esac |
|
16341 | 16332 |
;; |
16342 | 16333 |
kfreebsd*-gnu) |
16343 | 16334 |
|
... | ... |
@@ -16507,11 +16499,9 @@ _ACEOF |
16507 | 16507 |
;; |
16508 | 16508 |
openbsd*) |
16509 | 16509 |
if test "$have_pthreads" = "yes"; then |
16510 |
- if test "$use_cr" = "no"; then |
|
16511 |
- THREAD_LIBS="-pthread" |
|
16512 |
- else |
|
16513 |
- THREAD_LIBS="-pthread -lc_r" |
|
16514 |
- fi |
|
16510 |
+ THREAD_LIBS="-pthread" |
|
16511 |
+ CLAMD_LIBS="$CLAMD_LIBS -pthread" |
|
16512 |
+ CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread" |
|
16515 | 16513 |
TH_SAFE="-thread-safe" |
16516 | 16514 |
|
16517 | 16515 |
cat >>confdefs.h <<\_ACEOF |
... | ... |
@@ -17238,241 +17228,6 @@ fi |
17238 | 17238 |
|
17239 | 17239 |
|
17240 | 17240 |
|
17241 |
-for ac_func in recvmsg sendmsg |
|
17242 |
-do |
|
17243 |
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` |
|
17244 |
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5 |
|
17245 |
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } |
|
17246 |
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then |
|
17247 |
- echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
17248 |
-else |
|
17249 |
- cat >conftest.$ac_ext <<_ACEOF |
|
17250 |
-/* confdefs.h. */ |
|
17251 |
-_ACEOF |
|
17252 |
-cat confdefs.h >>conftest.$ac_ext |
|
17253 |
-cat >>conftest.$ac_ext <<_ACEOF |
|
17254 |
-/* end confdefs.h. */ |
|
17255 |
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. |
|
17256 |
- For example, HP-UX 11i <limits.h> declares gettimeofday. */ |
|
17257 |
-#define $ac_func innocuous_$ac_func |
|
17258 |
- |
|
17259 |
-/* System header to define __stub macros and hopefully few prototypes, |
|
17260 |
- which can conflict with char $ac_func (); below. |
|
17261 |
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since |
|
17262 |
- <limits.h> exists even on freestanding compilers. */ |
|
17263 |
- |
|
17264 |
-#ifdef __STDC__ |
|
17265 |
-# include <limits.h> |
|
17266 |
-#else |
|
17267 |
-# include <assert.h> |
|
17268 |
-#endif |
|
17269 |
- |
|
17270 |
-#undef $ac_func |
|
17271 |
- |
|
17272 |
-/* Override any GCC internal prototype to avoid an error. |
|
17273 |
- Use char because int might match the return type of a GCC |
|
17274 |
- builtin and then its argument prototype would still apply. */ |
|
17275 |
-#ifdef __cplusplus |
|
17276 |
-extern "C" |
|
17277 |
-#endif |
|
17278 |
-char $ac_func (); |
|
17279 |
-/* The GNU C library defines this for functions which it implements |
|
17280 |
- to always fail with ENOSYS. Some functions are actually named |
|
17281 |
- something starting with __ and the normal name is an alias. */ |
|
17282 |
-#if defined __stub_$ac_func || defined __stub___$ac_func |
|
17283 |
-choke me |
|
17284 |
-#endif |
|
17285 |
- |
|
17286 |
-int |
|
17287 |
-main () |
|
17288 |
-{ |
|
17289 |
-return $ac_func (); |
|
17290 |
- ; |
|
17291 |
- return 0; |
|
17292 |
-} |
|
17293 |
-_ACEOF |
|
17294 |
-rm -f conftest.$ac_objext conftest$ac_exeext |
|
17295 |
-if { (ac_try="$ac_link" |
|
17296 |
-case "(($ac_try" in |
|
17297 |
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
17298 |
- *) ac_try_echo=$ac_try;; |
|
17299 |
-esac |
|
17300 |
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
17301 |
- (eval "$ac_link") 2>conftest.er1 |
|
17302 |
- ac_status=$? |
|
17303 |
- grep -v '^ *+' conftest.er1 >conftest.err |
|
17304 |
- rm -f conftest.er1 |
|
17305 |
- cat conftest.err >&5 |
|
17306 |
- echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
17307 |
- (exit $ac_status); } && { |
|
17308 |
- test -z "$ac_c_werror_flag" || |
|
17309 |
- test ! -s conftest.err |
|
17310 |
- } && test -s conftest$ac_exeext && |
|
17311 |
- $as_test_x conftest$ac_exeext; then |
|
17312 |
- eval "$as_ac_var=yes" |
|
17313 |
-else |
|
17314 |
- echo "$as_me: failed program was:" >&5 |
|
17315 |
-sed 's/^/| /' conftest.$ac_ext >&5 |
|
17316 |
- |
|
17317 |
- eval "$as_ac_var=no" |
|
17318 |
-fi |
|
17319 |
- |
|
17320 |
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
|
17321 |
- conftest$ac_exeext conftest.$ac_ext |
|
17322 |
-fi |
|
17323 |
-ac_res=`eval echo '${'$as_ac_var'}'` |
|
17324 |
- { echo "$as_me:$LINENO: result: $ac_res" >&5 |
|
17325 |
-echo "${ECHO_T}$ac_res" >&6; } |
|
17326 |
-if test `eval echo '${'$as_ac_var'}'` = yes; then |
|
17327 |
- cat >>confdefs.h <<_ACEOF |
|
17328 |
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 |
|
17329 |
-_ACEOF |
|
17330 |
- |
|
17331 |
-fi |
|
17332 |
-done |
|
17333 |
- |
|
17334 |
-{ echo "$as_me:$LINENO: checking for msg_accrights field in struct msghdr" >&5 |
|
17335 |
-echo $ECHO_N "checking for msg_accrights field in struct msghdr... $ECHO_C" >&6; } |
|
17336 |
-if test "${ac_cv_have_accrights_in_msghdr+set}" = set; then |
|
17337 |
- echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
17338 |
-else |
|
17339 |
- |
|
17340 |
- cat >conftest.$ac_ext <<_ACEOF |
|
17341 |
-/* confdefs.h. */ |
|
17342 |
-_ACEOF |
|
17343 |
-cat confdefs.h >>conftest.$ac_ext |
|
17344 |
-cat >>conftest.$ac_ext <<_ACEOF |
|
17345 |
-/* end confdefs.h. */ |
|
17346 |
- |
|
17347 |
-#include <sys/types.h> |
|
17348 |
-#include <sys/socket.h> |
|
17349 |
-#include <sys/uio.h> |
|
17350 |
- |
|
17351 |
-int |
|
17352 |
-main () |
|
17353 |
-{ |
|
17354 |
- |
|
17355 |
-#ifdef msg_accrights |
|
17356 |
-#error msg_accrights defined |
|
17357 |
-#endif |
|
17358 |
-struct msghdr m; |
|
17359 |
-m.msg_accrights = 0; |
|
17360 |
-return 0; |
|
17361 |
- |
|
17362 |
- |
|
17363 |
- ; |
|
17364 |
- return 0; |
|
17365 |
-} |
|
17366 |
-_ACEOF |
|
17367 |
-rm -f conftest.$ac_objext |
|
17368 |
-if { (ac_try="$ac_compile" |
|
17369 |
-case "(($ac_try" in |
|
17370 |
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
17371 |
- *) ac_try_echo=$ac_try;; |
|
17372 |
-esac |
|
17373 |
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
17374 |
- (eval "$ac_compile") 2>conftest.er1 |
|
17375 |
- ac_status=$? |
|
17376 |
- grep -v '^ *+' conftest.er1 >conftest.err |
|
17377 |
- rm -f conftest.er1 |
|
17378 |
- cat conftest.err >&5 |
|
17379 |
- echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
17380 |
- (exit $ac_status); } && { |
|
17381 |
- test -z "$ac_c_werror_flag" || |
|
17382 |
- test ! -s conftest.err |
|
17383 |
- } && test -s conftest.$ac_objext; then |
|
17384 |
- ac_cv_have_accrights_in_msghdr="yes" |
|
17385 |
-else |
|
17386 |
- echo "$as_me: failed program was:" >&5 |
|
17387 |
-sed 's/^/| /' conftest.$ac_ext >&5 |
|
17388 |
- |
|
17389 |
- ac_cv_have_accrights_in_msghdr="no" |
|
17390 |
-fi |
|
17391 |
- |
|
17392 |
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
17393 |
- |
|
17394 |
-fi |
|
17395 |
-{ echo "$as_me:$LINENO: result: $ac_cv_have_accrights_in_msghdr" >&5 |
|
17396 |
-echo "${ECHO_T}$ac_cv_have_accrights_in_msghdr" >&6; } |
|
17397 |
-if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then |
|
17398 |
- |
|
17399 |
-cat >>confdefs.h <<\_ACEOF |
|
17400 |
-#define HAVE_ACCRIGHTS_IN_MSGHDR 1 |
|
17401 |
-_ACEOF |
|
17402 |
- |
|
17403 |
-fi |
|
17404 |
- |
|
17405 |
-{ echo "$as_me:$LINENO: checking for msg_control field in struct msghdr" >&5 |
|
17406 |
-echo $ECHO_N "checking for msg_control field in struct msghdr... $ECHO_C" >&6; } |
|
17407 |
-if test "${ac_cv_have_control_in_msghdr+set}" = set; then |
|
17408 |
- echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
17409 |
-else |
|
17410 |
- |
|
17411 |
- cat >conftest.$ac_ext <<_ACEOF |
|
17412 |
-/* confdefs.h. */ |
|
17413 |
-_ACEOF |
|
17414 |
-cat confdefs.h >>conftest.$ac_ext |
|
17415 |
-cat >>conftest.$ac_ext <<_ACEOF |
|
17416 |
-/* end confdefs.h. */ |
|
17417 |
- |
|
17418 |
-#include <sys/types.h> |
|
17419 |
-#include <sys/socket.h> |
|
17420 |
-#include <sys/uio.h> |
|
17421 |
- |
|
17422 |
-int |
|
17423 |
-main () |
|
17424 |
-{ |
|
17425 |
- |
|
17426 |
-#ifdef msg_control |
|
17427 |
-#error msg_control defined |
|
17428 |
-#endif |
|
17429 |
-struct msghdr m; |
|
17430 |
-m.msg_control = 0; |
|
17431 |
-return 0; |
|
17432 |
- |
|
17433 |
- ; |
|
17434 |
- return 0; |
|
17435 |
-} |
|
17436 |
-_ACEOF |
|
17437 |
-rm -f conftest.$ac_objext |
|
17438 |
-if { (ac_try="$ac_compile" |
|
17439 |
-case "(($ac_try" in |
|
17440 |
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
17441 |
- *) ac_try_echo=$ac_try;; |
|
17442 |
-esac |
|
17443 |
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
17444 |
- (eval "$ac_compile") 2>conftest.er1 |
|
17445 |
- ac_status=$? |
|
17446 |
- grep -v '^ *+' conftest.er1 >conftest.err |
|
17447 |
- rm -f conftest.er1 |
|
17448 |
- cat conftest.err >&5 |
|
17449 |
- echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
17450 |
- (exit $ac_status); } && { |
|
17451 |
- test -z "$ac_c_werror_flag" || |
|
17452 |
- test ! -s conftest.err |
|
17453 |
- } && test -s conftest.$ac_objext; then |
|
17454 |
- ac_cv_have_control_in_msghdr="yes" |
|
17455 |
-else |
|
17456 |
- echo "$as_me: failed program was:" >&5 |
|
17457 |
-sed 's/^/| /' conftest.$ac_ext >&5 |
|
17458 |
- |
|
17459 |
- ac_cv_have_control_in_msghdr="no" |
|
17460 |
-fi |
|
17461 |
- |
|
17462 |
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
17463 |
- |
|
17464 |
-fi |
|
17465 |
-{ echo "$as_me:$LINENO: result: $ac_cv_have_control_in_msghdr" >&5 |
|
17466 |
-echo "${ECHO_T}$ac_cv_have_control_in_msghdr" >&6; } |
|
17467 |
-if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then |
|
17468 |
- |
|
17469 |
-cat >>confdefs.h <<\_ACEOF |
|
17470 |
-#define HAVE_CONTROL_IN_MSGHDR 1 |
|
17471 |
-_ACEOF |
|
17472 |
- |
|
17473 |
-fi |
|
17474 |
- |
|
17475 |
- |
|
17476 | 17241 |
# Check whether --with-tcpwrappers was given. |
17477 | 17242 |
if test "${with_tcpwrappers+set}" = set; then |
17478 | 17243 |
withval=$with_tcpwrappers; case "$withval" in |
... | ... |
@@ -17639,6 +17394,9 @@ cat confdefs.h >>conftest.$ac_ext |
17639 | 17639 |
cat >>conftest.$ac_ext <<_ACEOF |
17640 | 17640 |
/* end confdefs.h. */ |
17641 | 17641 |
|
17642 |
+#ifdef HAVE_SYS_TYPES_H |
|
17643 |
+#include <sys/types.h> |
|
17644 |
+#endif |
|
17642 | 17645 |
#include <tcpd.h> |
17643 | 17646 |
int allow_severity = 0; |
17644 | 17647 |
int deny_severity = 0; |
... | ... |
@@ -17691,6 +17449,9 @@ cat confdefs.h >>conftest.$ac_ext |
17691 | 17691 |
cat >>conftest.$ac_ext <<_ACEOF |
17692 | 17692 |
/* end confdefs.h. */ |
17693 | 17693 |
|
17694 |
+#ifdef HAVE_SYS_TYPES_H |
|
17695 |
+#include <sys/types.h> |
|
17696 |
+#endif |
|
17694 | 17697 |
#include <tcpd.h> |
17695 | 17698 |
int allow_severity = 0; |
17696 | 17699 |
int deny_severity = 0; |
... | ... |
@@ -18900,6 +18661,565 @@ fi |
18900 | 18900 |
{ echo "$as_me:$LINENO: result: $have_signed_rightshift_extended" >&5 |
18901 | 18901 |
echo "${ECHO_T}$have_signed_rightshift_extended" >&6; }; |
18902 | 18902 |
|
18903 |
+ |
|
18904 |
+ |
|
18905 |
+ |
|
18906 |
+for ac_func in recvmsg sendmsg |
|
18907 |
+do |
|
18908 |
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` |
|
18909 |
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5 |
|
18910 |
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } |
|
18911 |
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then |
|
18912 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
18913 |
+else |
|
18914 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
18915 |
+/* confdefs.h. */ |
|
18916 |
+_ACEOF |
|
18917 |
+cat confdefs.h >>conftest.$ac_ext |
|
18918 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
18919 |
+/* end confdefs.h. */ |
|
18920 |
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. |
|
18921 |
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */ |
|
18922 |
+#define $ac_func innocuous_$ac_func |
|
18923 |
+ |
|
18924 |
+/* System header to define __stub macros and hopefully few prototypes, |
|
18925 |
+ which can conflict with char $ac_func (); below. |
|
18926 |
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since |
|
18927 |
+ <limits.h> exists even on freestanding compilers. */ |
|
18928 |
+ |
|
18929 |
+#ifdef __STDC__ |
|
18930 |
+# include <limits.h> |
|
18931 |
+#else |
|
18932 |
+# include <assert.h> |
|
18933 |
+#endif |
|
18934 |
+ |
|
18935 |
+#undef $ac_func |
|
18936 |
+ |
|
18937 |
+/* Override any GCC internal prototype to avoid an error. |
|
18938 |
+ Use char because int might match the return type of a GCC |
|
18939 |
+ builtin and then its argument prototype would still apply. */ |
|
18940 |
+#ifdef __cplusplus |
|
18941 |
+extern "C" |
|
18942 |
+#endif |
|
18943 |
+char $ac_func (); |
|
18944 |
+/* The GNU C library defines this for functions which it implements |
|
18945 |
+ to always fail with ENOSYS. Some functions are actually named |
|
18946 |
+ something starting with __ and the normal name is an alias. */ |
|
18947 |
+#if defined __stub_$ac_func || defined __stub___$ac_func |
|
18948 |
+choke me |
|
18949 |
+#endif |
|
18950 |
+ |
|
18951 |
+int |
|
18952 |
+main () |
|
18953 |
+{ |
|
18954 |
+return $ac_func (); |
|
18955 |
+ ; |
|
18956 |
+ return 0; |
|
18957 |
+} |
|
18958 |
+_ACEOF |
|
18959 |
+rm -f conftest.$ac_objext conftest$ac_exeext |
|
18960 |
+if { (ac_try="$ac_link" |
|
18961 |
+case "(($ac_try" in |
|
18962 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
18963 |
+ *) ac_try_echo=$ac_try;; |
|
18964 |
+esac |
|
18965 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
18966 |
+ (eval "$ac_link") 2>conftest.er1 |
|
18967 |
+ ac_status=$? |
|
18968 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
18969 |
+ rm -f conftest.er1 |
|
18970 |
+ cat conftest.err >&5 |
|
18971 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
18972 |
+ (exit $ac_status); } && { |
|
18973 |
+ test -z "$ac_c_werror_flag" || |
|
18974 |
+ test ! -s conftest.err |
|
18975 |
+ } && test -s conftest$ac_exeext && |
|
18976 |
+ $as_test_x conftest$ac_exeext; then |
|
18977 |
+ eval "$as_ac_var=yes" |
|
18978 |
+else |
|
18979 |
+ echo "$as_me: failed program was:" >&5 |
|
18980 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
18981 |
+ |
|
18982 |
+ eval "$as_ac_var=no" |
|
18983 |
+fi |
|
18984 |
+ |
|
18985 |
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
|
18986 |
+ conftest$ac_exeext conftest.$ac_ext |
|
18987 |
+fi |
|
18988 |
+ac_res=`eval echo '${'$as_ac_var'}'` |
|
18989 |
+ { echo "$as_me:$LINENO: result: $ac_res" >&5 |
|
18990 |
+echo "${ECHO_T}$ac_res" >&6; } |
|
18991 |
+if test `eval echo '${'$as_ac_var'}'` = yes; then |
|
18992 |
+ cat >>confdefs.h <<_ACEOF |
|
18993 |
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 |
|
18994 |
+_ACEOF |
|
18995 |
+ |
|
18996 |
+fi |
|
18997 |
+done |
|
18998 |
+ |
|
18999 |
+{ echo "$as_me:$LINENO: checking for msg_control field in struct msghdr" >&5 |
|
19000 |
+echo $ECHO_N "checking for msg_control field in struct msghdr... $ECHO_C" >&6; } |
|
19001 |
+if test "${ac_cv_have_control_in_msghdr+set}" = set; then |
|
19002 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
19003 |
+else |
|
19004 |
+ |
|
19005 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
19006 |
+/* confdefs.h. */ |
|
19007 |
+_ACEOF |
|
19008 |
+cat confdefs.h >>conftest.$ac_ext |
|
19009 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
19010 |
+/* end confdefs.h. */ |
|
19011 |
+ |
|
19012 |
+#define _XOPEN_SOURCE 500 |
|
19013 |
+#include <sys/types.h> |
|
19014 |
+#include <sys/socket.h> |
|
19015 |
+#include <sys/uio.h> |
|
19016 |
+ |
|
19017 |
+int |
|
19018 |
+main () |
|
19019 |
+{ |
|
19020 |
+ |
|
19021 |
+#ifdef msg_control |
|
19022 |
+#error msg_control defined |
|
19023 |
+#endif |
|
19024 |
+struct msghdr m; |
|
19025 |
+m.msg_control = 0; |
|
19026 |
+return 0; |
|
19027 |
+ |
|
19028 |
+ ; |
|
19029 |
+ return 0; |
|
19030 |
+} |
|
19031 |
+_ACEOF |
|
19032 |
+rm -f conftest.$ac_objext |
|
19033 |
+if { (ac_try="$ac_compile" |
|
19034 |
+case "(($ac_try" in |
|
19035 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
19036 |
+ *) ac_try_echo=$ac_try;; |
|
19037 |
+esac |
|
19038 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
19039 |
+ (eval "$ac_compile") 2>conftest.er1 |
|
19040 |
+ ac_status=$? |
|
19041 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
19042 |
+ rm -f conftest.er1 |
|
19043 |
+ cat conftest.err >&5 |
|
19044 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
19045 |
+ (exit $ac_status); } && { |
|
19046 |
+ test -z "$ac_c_werror_flag" || |
|
19047 |
+ test ! -s conftest.err |
|
19048 |
+ } && test -s conftest.$ac_objext; then |
|
19049 |
+ ac_cv_have_control_in_msghdr="yes" |
|
19050 |
+else |
|
19051 |
+ echo "$as_me: failed program was:" >&5 |
|
19052 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
19053 |
+ |
|
19054 |
+ ac_cv_have_control_in_msghdr="no" |
|
19055 |
+fi |
|
19056 |
+ |
|
19057 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
19058 |
+ |
|
19059 |
+fi |
|
19060 |
+{ echo "$as_me:$LINENO: result: $ac_cv_have_control_in_msghdr" >&5 |
|
19061 |
+echo "${ECHO_T}$ac_cv_have_control_in_msghdr" >&6; } |
|
19062 |
+if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then |
|
19063 |
+ |
|
19064 |
+cat >>confdefs.h <<\_ACEOF |
|
19065 |
+#define HAVE_CONTROL_IN_MSGHDR 1 |
|
19066 |
+_ACEOF |
|
19067 |
+ |
|
19068 |
+ |
|
19069 |
+ { echo "$as_me:$LINENO: checking BSD 4.4 / RFC2292 style fd passing" >&5 |
|
19070 |
+echo $ECHO_N "checking BSD 4.4 / RFC2292 style fd passing... $ECHO_C" >&6; } |
|
19071 |
+ # Check whether --enable-fdpassing was given. |
|
19072 |
+if test "${enable_fdpassing+set}" = set; then |
|
19073 |
+ enableval=$enable_fdpassing; want_fdpassing=$enableval |
|
19074 |
+else |
|
19075 |
+ want_fdpassing="yes" |
|
19076 |
+fi |
|
19077 |
+ |
|
19078 |
+ |
|
19079 |
+ if test "x$want_fdpassing" = "xyes"; then |
|
19080 |
+ if test "$cross_compiling" = yes; then |
|
19081 |
+ have_fdpass=0 |
|
19082 |
+else |
|
19083 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
19084 |
+ |
|
19085 |
+/* confdefs.h. */ |
|
19086 |
+_ACEOF |
|
19087 |
+cat confdefs.h >>conftest.$ac_ext |
|
19088 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
19089 |
+/* end confdefs.h. */ |
|
19090 |
+ |
|
19091 |
+ |
|
19092 |
+#include <sys/types.h> |
|
19093 |
+#include <sys/wait.h> |
|
19094 |
+#include <stdio.h> |
|
19095 |
+#include <stdlib.h> |
|
19096 |
+#include <unistd.h> |
|
19097 |
+#include <string.h> |
|
19098 |
+#include <sys/uio.h> |
|
19099 |
+#include <signal.h> |
|
19100 |
+#include <sys/socket.h> |
|
19101 |
+ |
|
19102 |
+ |
|
19103 |
+#define TEST "test" |
|
19104 |
+ |
|
19105 |
+int send_fd(int s, int fd) |
|
19106 |
+{ |
|
19107 |
+ struct msghdr msg; |
|
19108 |
+ struct cmsghdr *cmsg; |
|
19109 |
+ unsigned char fdbuf[CMSG_SPACE(sizeof(int))]; |
|
19110 |
+ struct iovec iov[1]; |
|
19111 |
+ |
|
19112 |
+ iov[0].iov_base = ""; |
|
19113 |
+ iov[0].iov_len = 1; |
|
19114 |
+ |
|
19115 |
+ memset(&msg, 0, sizeof(msg)); |
|
19116 |
+ msg.msg_control = fdbuf; |
|
19117 |
+ /* must send/receive at least one byte */ |
|
19118 |
+ msg.msg_iov = iov; |
|
19119 |
+ msg.msg_iovlen = 1; |
|
19120 |
+ msg.msg_controllen = CMSG_LEN(sizeof(int)); |
|
19121 |
+ |
|
19122 |
+ cmsg = CMSG_FIRSTHDR(&msg); |
|
19123 |
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int)); |
|
19124 |
+ cmsg->cmsg_level = SOL_SOCKET; |
|
19125 |
+ cmsg->cmsg_type = SCM_RIGHTS; |
|
19126 |
+ *(int *)CMSG_DATA(cmsg) = fd; |
|
19127 |
+ |
|
19128 |
+ if (sendmsg(s, &msg, 0) == -1) { |
|
19129 |
+ perror("sendmsg"); |
|
19130 |
+ close(s); |
|
19131 |
+ return -1; |
|
19132 |
+ } |
|
19133 |
+ return 0; |
|
19134 |
+} |
|
19135 |
+ |
|
19136 |
+int testfd(int desc) |
|
19137 |
+{ |
|
19138 |
+ char buf[256]; |
|
19139 |
+ if(read(desc, buf, sizeof(buf)) != sizeof(TEST)) { |
|
19140 |
+ fprintf(stderr, "test data not received correctly!"); |
|
19141 |
+ return 1; |
|
19142 |
+ } |
|
19143 |
+ return memcmp(buf, TEST, sizeof(TEST)); |
|
19144 |
+} |
|
19145 |
+ |
|
19146 |
+int recv_fd(int desc) |
|
19147 |
+{ |
|
19148 |
+ unsigned char buf[CMSG_SPACE(sizeof(int))]; |
|
19149 |
+ struct msghdr msg; |
|
19150 |
+ struct cmsghdr *cmsg; |
|
19151 |
+ struct iovec iov[1]; |
|
19152 |
+ char dummy; |
|
19153 |
+ int ret=2; |
|
19154 |
+ |
|
19155 |
+ memset(&msg, 0, sizeof(msg)); |
|
19156 |
+ iov[0].iov_base = &dummy; |
|
19157 |
+ iov[0].iov_len = 1; |
|
19158 |
+ msg.msg_iov = iov; |
|
19159 |
+ msg.msg_iovlen = 1; |
|
19160 |
+ msg.msg_control = buf; |
|
19161 |
+ msg.msg_controllen = sizeof(buf); |
|
19162 |
+ |
|
19163 |
+ if (recvmsg(desc, &msg, 0) == -1) { |
|
19164 |
+ perror("recvmsg failed!"); |
|
19165 |
+ return -1; |
|
19166 |
+ } |
|
19167 |
+ if ((msg.msg_flags & MSG_TRUNC) || (msg.msg_flags & MSG_CTRUNC)) { |
|
19168 |
+ fprintf(stderr, "control message truncated"); |
|
19169 |
+ return -1; |
|
19170 |
+ } |
|
19171 |
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; |
|
19172 |
+ cmsg = CMSG_NXTHDR(&msg, cmsg)) { |
|
19173 |
+ if (cmsg->cmsg_len == CMSG_LEN(sizeof(int)) && |
|
19174 |
+ cmsg->cmsg_level == SOL_SOCKET && |
|
19175 |
+ cmsg->cmsg_type == SCM_RIGHTS) { |
|
19176 |
+ int fd = *(int *)CMSG_DATA(cmsg); |
|
19177 |
+ ret = testfd(fd); |
|
19178 |
+ close(fd); |
|
19179 |
+ } |
|
19180 |
+ } |
|
19181 |
+ return ret; |
|
19182 |
+} |
|
19183 |
+ |
|
19184 |
+int main(void) |
|
19185 |
+{ |
|
19186 |
+ int fd[2]; |
|
19187 |
+ int pip[2]; |
|
19188 |
+ pid_t pid; |
|
19189 |
+ int status; |
|
19190 |
+ |
|
19191 |
+ if(pipe(pip)) { |
|
19192 |
+ perror("pipe"); |
|
19193 |
+ return 1; |
|
19194 |
+ } |
|
19195 |
+ |
|
19196 |
+ if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) { |
|
19197 |
+ perror("socketpair"); |
|
19198 |
+ return 1; |
|
19199 |
+ } |
|
19200 |
+ |
|
19201 |
+ if((pid=fork()) < 0) { |
|
19202 |
+ perror("fork"); |
|
19203 |
+ } else if (!pid) { |
|
19204 |
+ exit( recv_fd(fd[1]) ); |
|
19205 |
+ } else { |
|
19206 |
+ /* parent */ |
|
19207 |
+ if(send_fd(fd[0], pip[0]) == -1) { |
|
19208 |
+ kill(pid, 9); |
|
19209 |
+ waitpid(pid, NULL, 0); |
|
19210 |
+ return 2; |
|
19211 |
+ } |
|
19212 |
+ write(pip[1], TEST, sizeof(TEST)); |
|
19213 |
+ close(pip[1]); |
|
19214 |
+ waitpid(pid, &status, 0); |
|
19215 |
+ } |
|
19216 |
+ return status; |
|
19217 |
+} |
|
19218 |
+ |
|
19219 |
+ |
|
19220 |
+_ACEOF |
|
19221 |
+rm -f conftest$ac_exeext |
|
19222 |
+if { (ac_try="$ac_link" |
|
19223 |
+case "(($ac_try" in |
|
19224 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
19225 |
+ *) ac_try_echo=$ac_try;; |
|
19226 |
+esac |
|
19227 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
19228 |
+ (eval "$ac_link") 2>&5 |
|
19229 |
+ ac_status=$? |
|
19230 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
19231 |
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' |
|
19232 |
+ { (case "(($ac_try" in |
|
19233 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
19234 |
+ *) ac_try_echo=$ac_try;; |
|
19235 |
+esac |
|
19236 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
19237 |
+ (eval "$ac_try") 2>&5 |
|
19238 |
+ ac_status=$? |
|
19239 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
19240 |
+ (exit $ac_status); }; }; then |
|
19241 |
+ have_fdpass=1; fdpass_need_xopen=0 |
|
19242 |
+else |
|
19243 |
+ echo "$as_me: program exited with status $ac_status" >&5 |
|
19244 |
+echo "$as_me: failed program was:" >&5 |
|
19245 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
19246 |
+ |
|
19247 |
+( exit $ac_status ) |
|
19248 |
+have_fdpass=0 |
|
19249 |
+fi |
|
19250 |
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext |
|
19251 |
+fi |
|
19252 |
+ |
|
19253 |
+ |
|
19254 |
+ |
|
19255 |
+ if test $have_fdpass = 0; then |
|
19256 |
+ if test "$cross_compiling" = yes; then |
|
19257 |
+ have_fdpass=0 |
|
19258 |
+else |
|
19259 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
19260 |
+ |
|
19261 |
+/* confdefs.h. */ |
|
19262 |
+_ACEOF |
|
19263 |
+cat confdefs.h >>conftest.$ac_ext |
|
19264 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
19265 |
+/* end confdefs.h. */ |
|
19266 |
+ |
|
19267 |
+#define _XOPEN_SOURCE 500 |
|
19268 |
+#include <sys/types.h> |
|
19269 |
+#include <sys/wait.h> |
|
19270 |
+#include <stdio.h> |
|
19271 |
+#include <stdlib.h> |
|
19272 |
+#include <unistd.h> |
|
19273 |
+#include <string.h> |
|
19274 |
+#include <sys/uio.h> |
|
19275 |
+#include <signal.h> |
|
19276 |
+#include <sys/socket.h> |
|
19277 |
+ |
|
19278 |
+ |
|
19279 |
+#define TEST "test" |
|
19280 |
+ |
|
19281 |
+int send_fd(int s, int fd) |
|
19282 |
+{ |
|
19283 |
+ struct msghdr msg; |
|
19284 |
+ struct cmsghdr *cmsg; |
|
19285 |
+ unsigned char fdbuf[CMSG_SPACE(sizeof(int))]; |
|
19286 |
+ struct iovec iov[1]; |
|
19287 |
+ |
|
19288 |
+ iov[0].iov_base = ""; |
|
19289 |
+ iov[0].iov_len = 1; |
|
19290 |
+ |
|
19291 |
+ memset(&msg, 0, sizeof(msg)); |
|
19292 |
+ msg.msg_control = fdbuf; |
|
19293 |
+ /* must send/receive at least one byte */ |
|
19294 |
+ msg.msg_iov = iov; |
|
19295 |
+ msg.msg_iovlen = 1; |
|
19296 |
+ msg.msg_controllen = CMSG_LEN(sizeof(int)); |
|
19297 |
+ |
|
19298 |
+ cmsg = CMSG_FIRSTHDR(&msg); |
|
19299 |
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int)); |
|
19300 |
+ cmsg->cmsg_level = SOL_SOCKET; |
|
19301 |
+ cmsg->cmsg_type = SCM_RIGHTS; |
|
19302 |
+ *(int *)CMSG_DATA(cmsg) = fd; |
|
19303 |
+ |
|
19304 |
+ if (sendmsg(s, &msg, 0) == -1) { |
|
19305 |
+ perror("sendmsg"); |
|
19306 |
+ close(s); |
|
19307 |
+ return -1; |
|
19308 |
+ } |
|
19309 |
+ return 0; |
|
19310 |
+} |
|
19311 |
+ |
|
19312 |
+int testfd(int desc) |
|
19313 |
+{ |
|
19314 |
+ char buf[256]; |
|
19315 |
+ if(read(desc, buf, sizeof(buf)) != sizeof(TEST)) { |
|
19316 |
+ fprintf(stderr, "test data not received correctly!"); |
|
19317 |
+ return 1; |
|
19318 |
+ } |
|
19319 |
+ return memcmp(buf, TEST, sizeof(TEST)); |
|
19320 |
+} |
|
19321 |
+ |
|
19322 |
+int recv_fd(int desc) |
|
19323 |
+{ |
|
19324 |
+ unsigned char buf[CMSG_SPACE(sizeof(int))]; |
|
19325 |
+ struct msghdr msg; |
|
19326 |
+ struct cmsghdr *cmsg; |
|
19327 |
+ struct iovec iov[1]; |
|
19328 |
+ char dummy; |
|
19329 |
+ int ret=2; |
|
19330 |
+ |
|
19331 |
+ memset(&msg, 0, sizeof(msg)); |
|
19332 |
+ iov[0].iov_base = &dummy; |
|
19333 |
+ iov[0].iov_len = 1; |
|
19334 |
+ msg.msg_iov = iov; |
|
19335 |
+ msg.msg_iovlen = 1; |
|
19336 |
+ msg.msg_control = buf; |
|
19337 |
+ msg.msg_controllen = sizeof(buf); |
|
19338 |
+ |
|
19339 |
+ if (recvmsg(desc, &msg, 0) == -1) { |
|
19340 |
+ perror("recvmsg failed!"); |
|
19341 |
+ return -1; |
|
19342 |
+ } |
|
19343 |
+ if ((msg.msg_flags & MSG_TRUNC) || (msg.msg_flags & MSG_CTRUNC)) { |
|
19344 |
+ fprintf(stderr, "control message truncated"); |
|
19345 |
+ return -1; |
|
19346 |
+ } |
|
19347 |
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; |
|
19348 |
+ cmsg = CMSG_NXTHDR(&msg, cmsg)) { |
|
19349 |
+ if (cmsg->cmsg_len == CMSG_LEN(sizeof(int)) && |
|
19350 |
+ cmsg->cmsg_level == SOL_SOCKET && |
|
19351 |
+ cmsg->cmsg_type == SCM_RIGHTS) { |
|
19352 |
+ int fd = *(int *)CMSG_DATA(cmsg); |
|
19353 |
+ ret = testfd(fd); |
|
19354 |
+ close(fd); |
|
19355 |
+ } |
|
19356 |
+ } |
|
19357 |
+ return ret; |
|
19358 |
+} |
|
19359 |
+ |
|
19360 |
+int main(void) |
|
19361 |
+{ |
|
19362 |
+ int fd[2]; |
|
19363 |
+ int pip[2]; |
|
19364 |
+ pid_t pid; |
|
19365 |
+ int status; |
|
19366 |
+ |
|
19367 |
+ if(pipe(pip)) { |
|
19368 |
+ perror("pipe"); |
|
19369 |
+ return 1; |
|
19370 |
+ } |
|
19371 |
+ |
|
19372 |
+ if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) { |
|
19373 |
+ perror("socketpair"); |
|
19374 |
+ return 1; |
|
19375 |
+ } |
|
19376 |
+ |
|
19377 |
+ if((pid=fork()) < 0) { |
|
19378 |
+ perror("fork"); |
|
19379 |
+ } else if (!pid) { |
|
19380 |
+ exit( recv_fd(fd[1]) ); |
|
19381 |
+ } else { |
|
19382 |
+ /* parent */ |
|
19383 |
+ if(send_fd(fd[0], pip[0]) == -1) { |
|
19384 |
+ kill(pid, 9); |
|
19385 |
+ waitpid(pid, NULL, 0); |
|
19386 |
+ return 2; |
|
19387 |
+ } |
|
19388 |
+ write(pip[1], TEST, sizeof(TEST)); |
|
19389 |
+ close(pip[1]); |
|
19390 |
+ waitpid(pid, &status, 0); |
|
19391 |
+ } |
|
19392 |
+ return status; |
|
19393 |
+} |
|
19394 |
+ |
|
19395 |
+ |
|
19396 |
+_ACEOF |
|
19397 |
+rm -f conftest$ac_exeext |
|
19398 |
+if { (ac_try="$ac_link" |
|
19399 |
+case "(($ac_try" in |
|
19400 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
19401 |
+ *) ac_try_echo=$ac_try;; |
|
19402 |
+esac |
|
19403 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
19404 |
+ (eval "$ac_link") 2>&5 |
|
19405 |
+ ac_status=$? |
|
19406 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
19407 |
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' |
|
19408 |
+ { (case "(($ac_try" in |
|
19409 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
19410 |
+ *) ac_try_echo=$ac_try;; |
|
19411 |
+esac |
|
19412 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
19413 |
+ (eval "$ac_try") 2>&5 |
|
19414 |
+ ac_status=$? |
|
19415 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
19416 |
+ (exit $ac_status); }; }; then |
|
19417 |
+ have_fdpass=1; fdpass_need_xopen=1 |
|
19418 |
+else |
|
19419 |
+ echo "$as_me: program exited with status $ac_status" >&5 |
|
19420 |
+echo "$as_me: failed program was:" >&5 |
|
19421 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
19422 |
+ |
|
19423 |
+( exit $ac_status ) |
|
19424 |
+have_fdpass=0 |
|
19425 |
+fi |
|
19426 |
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext |
|
19427 |
+fi |
|
19428 |
+ |
|
19429 |
+ |
|
19430 |
+ fi |
|
19431 |
+ |
|
19432 |
+ if test $have_fdpass = 1; then |
|
19433 |
+ |
|
19434 |
+cat >>confdefs.h <<\_ACEOF |
|
19435 |
+#define HAVE_FD_PASSING 1 |
|
19436 |
+_ACEOF |
|
19437 |
+ |
|
19438 |
+ if test $fdpass_need_xopen = 1; then |
|
19439 |
+ |
|
19440 |
+cat >>confdefs.h <<\_ACEOF |
|
19441 |
+#define FDPASS_NEED_XOPEN 1 |
|
19442 |
+_ACEOF |
|
19443 |
+ |
|
19444 |
+ { echo "$as_me:$LINENO: result: yes, by defining _XOPEN_SOURCE" >&5 |
|
19445 |
+echo "${ECHO_T}yes, by defining _XOPEN_SOURCE" >&6; } |
|
19446 |
+ else |
|
19447 |
+ { echo "$as_me:$LINENO: result: yes" >&5 |
|
19448 |
+echo "${ECHO_T}yes" >&6; } |
|
19449 |
+ fi |
|
19450 |
+ else |
|
19451 |
+ { echo "$as_me:$LINENO: result: no" >&5 |
|
19452 |
+echo "${ECHO_T}no" >&6; } |
|
19453 |
+ fi |
|
19454 |
+ |
|
19455 |
+ else |
|
19456 |
+ { echo "$as_me:$LINENO: result: disabled" >&5 |
|
19457 |
+echo "${ECHO_T}disabled" >&6; } |
|
19458 |
+ fi |
|
19459 |
+fi |
|
19460 |
+ |
|
19461 |
+ |
|
18903 | 19462 |
ac_config_files="$ac_config_files libclamunrar/Makefile libclamunrar_iface/Makefile libclamav/Makefile libclamav/lzma/Makefile clamscan/Makefile database/Makefile docs/Makefile clamd/Makefile clamdscan/Makefile clamav-milter/Makefile freshclam/Makefile sigtool/Makefile clamconf/Makefile etc/Makefile test/Makefile unit_tests/Makefile Makefile clamav-config libclamav.pc docs/man/clamav-milter.8 docs/man/clamconf.1 docs/man/clamd.8 docs/man/clamd.conf.5 docs/man/clamdscan.1 docs/man/clamscan.1 docs/man/freshclam.1 docs/man/freshclam.conf.5 docs/man/sigtool.1" |
18904 | 19463 |
|
18905 | 19464 |
cat >confcache <<\_ACEOF |
... | ... |
@@ -1,4 +1,3 @@ |
1 |
- |
|
2 | 1 |
dnl Copyright (C) 2002 - 2006 Tomasz Kojm <tkojm@clamav.net> |
3 | 2 |
dnl gethostbyname_r and readdir_r checks (c) COPYRIGHT MIT 1995 |
4 | 3 |
dnl socklen_t check (c) Alexander V. Lukyanov <lav@yars.free.net> |
... | ... |
@@ -705,11 +704,6 @@ linux*) |
705 | 705 |
AC_DEFINE([CLAMUKO],1,[enable clamuko]) |
706 | 706 |
fi |
707 | 707 |
fi |
708 |
- case `uname -r` in |
|
709 |
- 1.*|2.0.*) |
|
710 |
- AC_DEFINE([INCOMPLETE_CMSG],1,[Early Linux doesn't set cmsg fields]) |
|
711 |
- ;; |
|
712 |
- esac |
|
713 | 708 |
;; |
714 | 709 |
kfreebsd*-gnu) |
715 | 710 |
AC_DEFINE([C_KFREEBSD_GNU],1,[target is kfreebsd-gnu]) |
... | ... |
@@ -791,11 +785,9 @@ dragonfly*) |
791 | 791 |
;; |
792 | 792 |
openbsd*) |
793 | 793 |
if test "$have_pthreads" = "yes"; then |
794 |
- if test "$use_cr" = "no"; then |
|
795 |
- THREAD_LIBS="-pthread" |
|
796 |
- else |
|
797 |
- THREAD_LIBS="-pthread -lc_r" |
|
798 |
- fi |
|
794 |
+ THREAD_LIBS="-pthread" |
|
795 |
+ CLAMD_LIBS="$CLAMD_LIBS -pthread" |
|
796 |
+ CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread" |
|
799 | 797 |
TH_SAFE="-thread-safe" |
800 | 798 |
AC_DEFINE([CL_THREAD_SAFE],1,[thread safe]) |
801 | 799 |
AC_DEFINE([_REENTRANT],1,[thread safe]) |
... | ... |
@@ -978,51 +970,6 @@ then |
978 | 978 |
AC_DEFINE([ENABLE_UNRAR], 1, "build unrar code") |
979 | 979 |
fi |
980 | 980 |
|
981 |
-dnl Check if we can do fd passing |
|
982 |
-dnl Submitted by Richard Lyons <frob-clamav@webcentral.com.au> |
|
983 |
-AC_CHECK_FUNCS([recvmsg sendmsg]) |
|
984 |
-AC_CACHE_CHECK([for msg_accrights field in struct msghdr], |
|
985 |
- [ac_cv_have_accrights_in_msghdr], [ |
|
986 |
- AC_TRY_COMPILE( |
|
987 |
-[ |
|
988 |
-#include <sys/types.h> |
|
989 |
-#include <sys/socket.h> |
|
990 |
-#include <sys/uio.h> |
|
991 |
-], |
|
992 |
-[ |
|
993 |
-#ifdef msg_accrights |
|
994 |
-#error msg_accrights defined |
|
995 |
-#endif |
|
996 |
-struct msghdr m; |
|
997 |
-m.msg_accrights = 0; |
|
998 |
-return 0; |
|
999 |
-] |
|
1000 |
-, [ac_cv_have_accrights_in_msghdr="yes"],[ac_cv_have_accrights_in_msghdr="no"]) |
|
1001 |
-]) |
|
1002 |
-if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then |
|
1003 |
- AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR],1,[access rights in msghdr]) |
|
1004 |
-fi |
|
1005 |
- |
|
1006 |
-AC_CACHE_CHECK([for msg_control field in struct msghdr], |
|
1007 |
- [ac_cv_have_control_in_msghdr], [ |
|
1008 |
- AC_TRY_COMPILE( |
|
1009 |
-[ |
|
1010 |
-#include <sys/types.h> |
|
1011 |
-#include <sys/socket.h> |
|
1012 |
-#include <sys/uio.h> |
|
1013 |
-], |
|
1014 |
-[ |
|
1015 |
-#ifdef msg_control |
|
1016 |
-#error msg_control defined |
|
1017 |
-#endif |
|
1018 |
-struct msghdr m; |
|
1019 |
-m.msg_control = 0; |
|
1020 |
-return 0; |
|
1021 |
-], [ ac_cv_have_control_in_msghdr="yes" ], [ ac_cv_have_control_in_msghdr="no" ]) |
|
1022 |
-]) |
|
1023 |
-if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then |
|
1024 |
- AC_DEFINE([HAVE_CONTROL_IN_MSGHDR],1,[ancillary data style fd pass]) |
|
1025 |
-fi |
|
1026 | 981 |
|
1027 | 982 |
dnl tcpwrappers support |
1028 | 983 |
dnl rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html |
... | ... |
@@ -1040,6 +987,9 @@ if test "$tcpw" != "no" && test "$have_milter" = "yes" ; then |
1040 | 1040 |
save_LIBS="$LIBS" |
1041 | 1041 |
LIBS="$LIBS -lwrap $FRESHCLAM_LIBS" |
1042 | 1042 |
AC_TRY_LINK([ |
1043 |
+#ifdef HAVE_SYS_TYPES_H |
|
1044 |
+#include <sys/types.h> |
|
1045 |
+#endif |
|
1043 | 1046 |
#include <tcpd.h> |
1044 | 1047 |
int allow_severity = 0; |
1045 | 1048 |
int deny_severity = 0; |
... | ... |
@@ -1054,6 +1004,9 @@ hosts_access(req) |
1054 | 1054 |
dnl try with -lnsl |
1055 | 1055 |
LIBS="$LIBS -lnsl $FRESHCLAM_LIBS" |
1056 | 1056 |
AC_TRY_LINK([ |
1057 |
+#ifdef HAVE_SYS_TYPES_H |
|
1058 |
+#include <sys/types.h> |
|
1059 |
+#endif |
|
1057 | 1060 |
#include <tcpd.h> |
1058 | 1061 |
int allow_severity = 0; |
1059 | 1062 |
int deny_severity = 0; |
... | ... |
@@ -1438,6 +1391,8 @@ if test $have_signed_rightshift_extended = yes; then |
1438 | 1438 |
fi |
1439 | 1439 |
AC_MSG_RESULT([$have_signed_rightshift_extended]); |
1440 | 1440 |
|
1441 |
+AC_C_FDPASSING |
|
1442 |
+ |
|
1441 | 1443 |
AC_OUTPUT([ |
1442 | 1444 |
libclamunrar/Makefile |
1443 | 1445 |
libclamunrar_iface/Makefile |
1444 | 1446 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
0 |
+CC=cc |
|
1 |
+ |
|
2 |
+# Solaris needs these: |
|
3 |
+#CFLAGS=-D_XOPEN_SOURCE=500 |
|
4 |
+#LDFLAGS=-lsocket |
|
5 |
+ |
|
6 |
+CFLAGS= |
|
7 |
+LDFLAGS= |
|
8 |
+all: clamd_fdscan |
|
9 |
+ |
|
10 |
+strlcpy.o: strlcpy.c |
|
11 |
+ $(CC) $(CFLAGS) -c -o $@ $< |
|
12 |
+ |
|
13 |
+clamd_fdscan.o: clamd_fdscan.c clamd_fdscan.h |
|
14 |
+ $(CC) $(CFLAGS) -c -o $@ $< |
|
15 |
+ |
|
16 |
+clamd_fdscan: clamd_fdscan.o strlcpy.o |
|
17 |
+ $(CC) -o $@ clamd_fdscan.o strlcpy.o |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,132 @@ |
0 |
+/* $Id: clamd_fdscan.c,v 1.2 2007/01/18 16:59:50 mbalmer Exp $ */ |
|
1 |
+ |
|
2 |
+/* |
|
3 |
+ * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> |
|
4 |
+ * |
|
5 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
6 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
7 |
+ * copyright notice and this permission notice appear in all copies. |
|
8 |
+ * |
|
9 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
10 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
11 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
12 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
13 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
14 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
15 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+#include <sys/types.h> |
|
19 |
+#include <sys/socket.h> |
|
20 |
+#include <sys/un.h> |
|
21 |
+#include <sys/uio.h> |
|
22 |
+#include <string.h> |
|
23 |
+ |
|
24 |
+#include <stdio.h> |
|
25 |
+#include <err.h> |
|
26 |
+#include <unistd.h> |
|
27 |
+ |
|
28 |
+#include "clamd_fdscan.h" |
|
29 |
+ |
|
30 |
+#define CLAMD_BUFSIZ 256 |
|
31 |
+ |
|
32 |
+size_t strlcpy(char *dst, const char *src, size_t siz); |
|
33 |
+/* |
|
34 |
+ * clamd_fdscan lets a running clamd process scan the contents of an open |
|
35 |
+ * filedescriptor by passing the filedescriptor to clamd. The parameters |
|
36 |
+ * are as follows: |
|
37 |
+ * fd the open filedescriptor to pass for scanning |
|
38 |
+ * soname the path to the local clamd listening socket |
|
39 |
+ * name virus name, if a virus is found |
|
40 |
+ * len max len of the virus name |
|
41 |
+ * |
|
42 |
+ * The functions returns 0 if the file was scanned and contains no virus, |
|
43 |
+ * -1 if an error occurs and 1 if a virus is found. |
|
44 |
+ */ |
|
45 |
+int |
|
46 |
+clamd_fdscan(int fd, char *soname, char *name, size_t len) |
|
47 |
+{ |
|
48 |
+ struct sockaddr_un addr; |
|
49 |
+ struct msghdr msg; |
|
50 |
+ struct cmsghdr *cmsg; |
|
51 |
+ unsigned char fdbuf[CMSG_SPACE(sizeof(int))]; |
|
52 |
+ FILE *sp; |
|
53 |
+ char buf[CLAMD_BUFSIZ], *p, *q; |
|
54 |
+ off_t pos; |
|
55 |
+ int s; |
|
56 |
+ struct iovec iov[1]; |
|
57 |
+ |
|
58 |
+ iov[0].iov_base = ""; |
|
59 |
+ iov[0].iov_len = 1; |
|
60 |
+ |
|
61 |
+ pos = lseek(fd, 0, SEEK_CUR); |
|
62 |
+ s = socket(AF_UNIX, SOCK_STREAM, 0); |
|
63 |
+ memset(&addr, 0, sizeof(addr)); |
|
64 |
+ addr.sun_family = AF_UNIX; |
|
65 |
+ strlcpy(addr.sun_path, soname, sizeof(addr.sun_path)); |
|
66 |
+ if (connect(s, (struct sockaddr *)&addr, sizeof(addr))) { |
|
67 |
+ perror("connect"); |
|
68 |
+ return -1; |
|
69 |
+ } |
|
70 |
+ |
|
71 |
+ memset(&msg, 0, sizeof(msg)); |
|
72 |
+ msg.msg_control = fdbuf; |
|
73 |
+ /* must send/receive at least one byte */ |
|
74 |
+ msg.msg_iov = iov; |
|
75 |
+ msg.msg_iovlen = 1; |
|
76 |
+ msg.msg_controllen = CMSG_LEN(sizeof(int)); |
|
77 |
+ |
|
78 |
+ cmsg = CMSG_FIRSTHDR(&msg); |
|
79 |
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int)); |
|
80 |
+ cmsg->cmsg_level = SOL_SOCKET; |
|
81 |
+ cmsg->cmsg_type = SCM_RIGHTS; |
|
82 |
+ *(int *)CMSG_DATA(cmsg) = fd; |
|
83 |
+ |
|
84 |
+ write(s, "FILDES\n", sizeof("FILDES\n")-1); |
|
85 |
+ if (sendmsg(s, &msg, 0) == -1) { |
|
86 |
+ perror("sendmsg"); |
|
87 |
+ close(s); |
|
88 |
+ return -1; |
|
89 |
+ } |
|
90 |
+ |
|
91 |
+ sp = fdopen(s,"r"); |
|
92 |
+ fgets(buf, sizeof(buf), sp); |
|
93 |
+ fclose(sp); |
|
94 |
+ close(s); |
|
95 |
+ |
|
96 |
+ if (pos != -1) |
|
97 |
+ lseek(fd, pos, SEEK_SET); |
|
98 |
+ if ((p = strrchr(buf, ' ')) != NULL) { |
|
99 |
+ ++p; |
|
100 |
+ if (!strncmp(p, "OK", 2)) |
|
101 |
+ return 0; |
|
102 |
+ else if (!strncmp(p, "FOUND", 5)) { |
|
103 |
+ if (name != NULL) { |
|
104 |
+ *--p = '\0'; |
|
105 |
+ q = strrchr(buf, ' ') + 1; |
|
106 |
+ strlcpy(name, q, len); |
|
107 |
+ } |
|
108 |
+ return 1; |
|
109 |
+ } else { |
|
110 |
+ puts(buf); |
|
111 |
+ } |
|
112 |
+ } |
|
113 |
+ return -1; |
|
114 |
+} |
|
115 |
+ |
|
116 |
+int main(int argc, char *argv[]) |
|
117 |
+{ |
|
118 |
+ char virusname[CLAMD_BUFSIZ]; |
|
119 |
+ if(argc != 2) { |
|
120 |
+ fprintf(stderr,"Usage: %s <clamd_socket>\n", argv[0]); |
|
121 |
+ return 1; |
|
122 |
+ } |
|
123 |
+ virusname[0]=0; |
|
124 |
+ if(clamd_fdscan(0, argv[1],virusname, sizeof(virusname)) == -1) { |
|
125 |
+ perror("Error sending fd!"); |
|
126 |
+ return 2; |
|
127 |
+ } else { |
|
128 |
+ printf("FOUND: %s\n", virusname); |
|
129 |
+ } |
|
130 |
+ return 0; |
|
131 |
+} |
0 | 132 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
0 |
+/* $Id: clamd_fdscan.h,v 1.1.1.1 2007/01/18 14:01:24 mbalmer Exp $ */ |
|
1 |
+ |
|
2 |
+/* |
|
3 |
+ * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> |
|
4 |
+ * |
|
5 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
6 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
7 |
+ * copyright notice and this permission notice appear in all copies. |
|
8 |
+ * |
|
9 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
10 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
11 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
12 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
13 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
14 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
15 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+extern int clamd_fdscan(int fd, char *soname, char *name, size_t len); |
0 | 19 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,52 @@ |
0 |
+/* |
|
1 |
+ * This code is derived from OpenBSD's libc, original license follows: |
|
2 |
+ * |
|
3 |
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
|
4 |
+ * |
|
5 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
6 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
7 |
+ * copyright notice and this permission notice appear in all copies. |
|
8 |
+ * |
|
9 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
10 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
11 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
12 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
13 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
14 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
15 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+#include <sys/types.h> |
|
19 |
+#include <string.h> |
|
20 |
+ |
|
21 |
+/* |
|
22 |
+ * Copy src to string dst of size siz. At most siz-1 characters |
|
23 |
+ * will be copied. Always NUL terminates (unless siz == 0). |
|
24 |
+ * Returns strlen(src); if retval >= siz, truncation occurred. |
|
25 |
+ */ |
|
26 |
+size_t |
|
27 |
+strlcpy(char *dst, const char *src, size_t siz) |
|
28 |
+{ |
|
29 |
+ char *d = dst; |
|
30 |
+ const char *s = src; |
|
31 |
+ size_t n = siz; |
|
32 |
+ |
|
33 |
+ /* Copy as many bytes as will fit */ |
|
34 |
+ if (n != 0) { |
|
35 |
+ while (--n != 0) { |
|
36 |
+ if ((*d++ = *s++) == '\0') |
|
37 |
+ break; |
|
38 |
+ } |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ /* Not enough room in dst, add NUL and traverse rest of src */ |
|
42 |
+ if (n == 0) { |
|
43 |
+ if (siz != 0) |
|
44 |
+ *d = '\0'; /* NUL-terminate dst */ |
|
45 |
+ while (*s++) |
|
46 |
+ ; |
|
47 |
+ } |
|
48 |
+ |
|
49 |
+ return(s - src - 1); /* count does not include NUL */ |
|
50 |
+} |
|
51 |
+ |
... | ... |
@@ -56,8 +56,8 @@ subdir = database |
56 | 56 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
57 | 57 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
58 | 58 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
59 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
60 |
- $(top_srcdir)/configure.in |
|
59 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
60 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
61 | 61 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
62 | 62 |
$(ACLOCAL_M4) |
63 | 63 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -54,8 +54,8 @@ subdir = docs |
54 | 54 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
55 | 55 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
56 | 56 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
57 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
58 |
- $(top_srcdir)/configure.in |
|
57 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
58 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
59 | 59 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
60 | 60 |
$(ACLOCAL_M4) |
61 | 61 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -54,8 +54,8 @@ subdir = etc |
54 | 54 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
55 | 55 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
56 | 56 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
57 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
58 |
- $(top_srcdir)/configure.in |
|
57 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
58 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
59 | 59 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
60 | 60 |
$(ACLOCAL_M4) |
61 | 61 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -57,8 +57,8 @@ subdir = freshclam |
57 | 57 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
58 | 58 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
59 | 59 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
60 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
61 |
- $(top_srcdir)/configure.in |
|
60 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
61 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
62 | 62 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
63 | 63 |
$(ACLOCAL_M4) |
64 | 64 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -58,8 +58,8 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ |
58 | 58 |
$(srcdir)/Makefile.in |
59 | 59 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
60 | 60 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
61 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
62 |
- $(top_srcdir)/configure.in |
|
61 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
62 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
63 | 63 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
64 | 64 |
$(ACLOCAL_M4) |
65 | 65 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -56,8 +56,8 @@ subdir = libclamav/lzma |
56 | 56 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
57 | 57 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
58 | 58 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
59 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
60 |
- $(top_srcdir)/configure.in |
|
59 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
60 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
61 | 61 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
62 | 62 |
$(ACLOCAL_M4) |
63 | 63 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -42,8 +42,8 @@ subdir = libclamunrar |
42 | 42 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
43 | 43 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
44 | 44 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
45 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
46 |
- $(top_srcdir)/configure.in |
|
45 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
46 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
47 | 47 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
48 | 48 |
$(ACLOCAL_M4) |
49 | 49 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -42,8 +42,8 @@ subdir = libclamunrar_iface |
42 | 42 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
43 | 43 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
44 | 44 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
45 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
46 |
- $(top_srcdir)/configure.in |
|
45 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
46 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
47 | 47 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
48 | 48 |
$(ACLOCAL_M4) |
49 | 49 |
mkinstalldirs = $(install_sh) -d |
50 | 50 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,188 @@ |
0 |
+ |
|
1 |
+AC_DEFUN([CONFTEST_FDPASS],[[ |
|
2 |
+AC_LANG_SOURCE([[ |
|
3 |
+$1 |
|
4 |
+#include <sys/types.h> |
|
5 |
+#include <sys/wait.h> |
|
6 |
+#include <stdio.h> |
|
7 |
+#include <stdlib.h> |
|
8 |
+#include <unistd.h> |
|
9 |
+#include <string.h> |
|
10 |
+#include <sys/uio.h> |
|
11 |
+#include <signal.h> |
|
12 |
+#include <sys/socket.h> |
|
13 |
+ |
|
14 |
+ |
|
15 |
+#define TEST "test" |
|
16 |
+ |
|
17 |
+int send_fd(int s, int fd) |
|
18 |
+{ |
|
19 |
+ struct msghdr msg; |
|
20 |
+ struct cmsghdr *cmsg; |
|
21 |
+ unsigned char fdbuf[CMSG_SPACE(sizeof(int))]; |
|
22 |
+ struct iovec iov[1]; |
|
23 |
+ |
|
24 |
+ iov[0].iov_base = ""; |
|
25 |
+ iov[0].iov_len = 1; |
|
26 |
+ |
|
27 |
+ memset(&msg, 0, sizeof(msg)); |
|
28 |
+ msg.msg_control = fdbuf; |
|
29 |
+ /* must send/receive at least one byte */ |
|
30 |
+ msg.msg_iov = iov; |
|
31 |
+ msg.msg_iovlen = 1; |
|
32 |
+ msg.msg_controllen = CMSG_LEN(sizeof(int)); |
|
33 |
+ |
|
34 |
+ cmsg = CMSG_FIRSTHDR(&msg); |
|
35 |
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int)); |
|
36 |
+ cmsg->cmsg_level = SOL_SOCKET; |
|
37 |
+ cmsg->cmsg_type = SCM_RIGHTS; |
|
38 |
+ *(int *)CMSG_DATA(cmsg) = fd; |
|
39 |
+ |
|
40 |
+ if (sendmsg(s, &msg, 0) == -1) { |
|
41 |
+ perror("sendmsg"); |
|
42 |
+ close(s); |
|
43 |
+ return -1; |
|
44 |
+ } |
|
45 |
+ return 0; |
|
46 |
+} |
|
47 |
+ |
|
48 |
+int testfd(int desc) |
|
49 |
+{ |
|
50 |
+ char buf[256]; |
|
51 |
+ if(read(desc, buf, sizeof(buf)) != sizeof(TEST)) { |
|
52 |
+ fprintf(stderr, "test data not received correctly!"); |
|
53 |
+ return 1; |
|
54 |
+ } |
|
55 |
+ return memcmp(buf, TEST, sizeof(TEST)); |
|
56 |
+} |
|
57 |
+ |
|
58 |
+int recv_fd(int desc) |
|
59 |
+{ |
|
60 |
+ unsigned char buf[CMSG_SPACE(sizeof(int))]; |
|
61 |
+ struct msghdr msg; |
|
62 |
+ struct cmsghdr *cmsg; |
|
63 |
+ struct iovec iov[1]; |
|
64 |
+ char dummy; |
|
65 |
+ int ret=2; |
|
66 |
+ |
|
67 |
+ memset(&msg, 0, sizeof(msg)); |
|
68 |
+ iov[0].iov_base = &dummy; |
|
69 |
+ iov[0].iov_len = 1; |
|
70 |
+ msg.msg_iov = iov; |
|
71 |
+ msg.msg_iovlen = 1; |
|
72 |
+ msg.msg_control = buf; |
|
73 |
+ msg.msg_controllen = sizeof(buf); |
|
74 |
+ |
|
75 |
+ if (recvmsg(desc, &msg, 0) == -1) { |
|
76 |
+ perror("recvmsg failed!"); |
|
77 |
+ return -1; |
|
78 |
+ } |
|
79 |
+ if ((msg.msg_flags & MSG_TRUNC) || (msg.msg_flags & MSG_CTRUNC)) { |
|
80 |
+ fprintf(stderr, "control message truncated"); |
|
81 |
+ return -1; |
|
82 |
+ } |
|
83 |
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; |
|
84 |
+ cmsg = CMSG_NXTHDR(&msg, cmsg)) { |
|
85 |
+ if (cmsg->cmsg_len == CMSG_LEN(sizeof(int)) && |
|
86 |
+ cmsg->cmsg_level == SOL_SOCKET && |
|
87 |
+ cmsg->cmsg_type == SCM_RIGHTS) { |
|
88 |
+ int fd = *(int *)CMSG_DATA(cmsg); |
|
89 |
+ ret = testfd(fd); |
|
90 |
+ close(fd); |
|
91 |
+ } |
|
92 |
+ } |
|
93 |
+ return ret; |
|
94 |
+} |
|
95 |
+ |
|
96 |
+int main(void) |
|
97 |
+{ |
|
98 |
+ int fd[2]; |
|
99 |
+ int pip[2]; |
|
100 |
+ pid_t pid; |
|
101 |
+ int status; |
|
102 |
+ |
|
103 |
+ if(pipe(pip)) { |
|
104 |
+ perror("pipe"); |
|
105 |
+ return 1; |
|
106 |
+ } |
|
107 |
+ |
|
108 |
+ if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) { |
|
109 |
+ perror("socketpair"); |
|
110 |
+ return 1; |
|
111 |
+ } |
|
112 |
+ |
|
113 |
+ if((pid=fork()) < 0) { |
|
114 |
+ perror("fork"); |
|
115 |
+ } else if (!pid) { |
|
116 |
+ exit( recv_fd(fd[1]) ); |
|
117 |
+ } else { |
|
118 |
+ /* parent */ |
|
119 |
+ if(send_fd(fd[0], pip[0]) == -1) { |
|
120 |
+ kill(pid, 9); |
|
121 |
+ waitpid(pid, NULL, 0); |
|
122 |
+ return 2; |
|
123 |
+ } |
|
124 |
+ write(pip[1], TEST, sizeof(TEST)); |
|
125 |
+ close(pip[1]); |
|
126 |
+ waitpid(pid, &status, 0); |
|
127 |
+ } |
|
128 |
+ return status; |
|
129 |
+} |
|
130 |
+]]) |
|
131 |
+]]) |
|
132 |
+ |
|
133 |
+AC_DEFUN([AC_C_FDPASSING],[ |
|
134 |
+dnl Check if we can do fd passing |
|
135 |
+dnl Submitted by Richard Lyons <frob-clamav@webcentral.com.au> |
|
136 |
+AC_CHECK_FUNCS([recvmsg sendmsg]) |
|
137 |
+AC_CACHE_CHECK([for msg_control field in struct msghdr], |
|
138 |
+ [ac_cv_have_control_in_msghdr], [ |
|
139 |
+ AC_TRY_COMPILE( |
|
140 |
+[ |
|
141 |
+#define _XOPEN_SOURCE 500 |
|
142 |
+#include <sys/types.h> |
|
143 |
+#include <sys/socket.h> |
|
144 |
+#include <sys/uio.h> |
|
145 |
+], |
|
146 |
+[ |
|
147 |
+#ifdef msg_control |
|
148 |
+#error msg_control defined |
|
149 |
+#endif |
|
150 |
+struct msghdr m; |
|
151 |
+m.msg_control = 0; |
|
152 |
+return 0; |
|
153 |
+], [ ac_cv_have_control_in_msghdr="yes" ], [ ac_cv_have_control_in_msghdr="no" ]) |
|
154 |
+]) |
|
155 |
+if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then |
|
156 |
+ AC_DEFINE([HAVE_CONTROL_IN_MSGHDR],1,[ancillary data style fd pass]) |
|
157 |
+ |
|
158 |
+ dnl Check whether FD passing works <edwin@clamav.net> |
|
159 |
+ AC_MSG_CHECKING([BSD 4.4 / RFC2292 style fd passing]) |
|
160 |
+ AC_ARG_ENABLE([fdpassing],[ --disable-fdpassing don't build file descriptor passing support], |
|
161 |
+ want_fdpassing=$enableval, want_fdpassing="yes") |
|
162 |
+ |
|
163 |
+ if test "x$want_fdpassing" = "xyes"; then |
|
164 |
+ dnl Try without _XOPEN_SOURCE first |
|
165 |
+ AC_RUN_IFELSE(CONFTEST_FDPASS([]), [have_fdpass=1; fdpass_need_xopen=0], [have_fdpass=0],[have_fdpass=0]) |
|
166 |
+ |
|
167 |
+ if test $have_fdpass = 0; then |
|
168 |
+ AC_RUN_IFELSE(CONFTEST_FDPASS([#define _XOPEN_SOURCE 500]), [have_fdpass=1; fdpass_need_xopen=1],[have_fdpass=0],[have_fdpass=0]) |
|
169 |
+ fi |
|
170 |
+ |
|
171 |
+ if test $have_fdpass = 1; then |
|
172 |
+ AC_DEFINE([HAVE_FD_PASSING],1,[have working file descriptor passing support]) |
|
173 |
+ if test $fdpass_need_xopen = 1; then |
|
174 |
+ AC_DEFINE([FDPASS_NEED_XOPEN],1,[whether _XOPEN_SOURCE needs to be defined for fd passing to work]) |
|
175 |
+ AC_MSG_RESULT([yes, by defining _XOPEN_SOURCE]) |
|
176 |
+ else |
|
177 |
+ AC_MSG_RESULT([yes]) |
|
178 |
+ fi |
|
179 |
+ else |
|
180 |
+ AC_MSG_RESULT([no]) |
|
181 |
+ fi |
|
182 |
+ |
|
183 |
+ else |
|
184 |
+ AC_MSG_RESULT([disabled]) |
|
185 |
+ fi |
|
186 |
+fi |
|
187 |
+]) |
... | ... |
@@ -56,8 +56,8 @@ subdir = sigtool |
56 | 56 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
57 | 57 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
58 | 58 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
59 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
60 |
- $(top_srcdir)/configure.in |
|
59 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
60 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
61 | 61 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
62 | 62 |
$(ACLOCAL_M4) |
63 | 63 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -36,8 +36,8 @@ subdir = test |
36 | 36 |
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
37 | 37 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
38 | 38 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
39 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
40 |
- $(top_srcdir)/configure.in |
|
39 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
40 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
41 | 41 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
42 | 42 |
$(ACLOCAL_M4) |
43 | 43 |
mkinstalldirs = $(install_sh) -d |
... | ... |
@@ -39,8 +39,8 @@ subdir = unit_tests |
39 | 39 |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
40 | 40 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
41 | 41 |
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
42 |
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
43 |
- $(top_srcdir)/configure.in |
|
42 |
+ $(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \ |
|
43 |
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.in |
|
44 | 44 |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
45 | 45 |
$(ACLOCAL_M4) |
46 | 46 |
mkinstalldirs = $(install_sh) -d |