SSLv2 only when available; fixed sa_family_t compile error; minor cleanup

This commit is contained in:
Gerhard Rieger 2013-06-21 16:19:02 +02:00
parent 589080e693
commit 7701095d45
16 changed files with 133 additions and 83 deletions

View file

@ -134,6 +134,12 @@ porting:
corrections for OpenEmbedded, especially termios SHIFT values and corrections for OpenEmbedded, especially termios SHIFT values and
ISPEED/OSPEED. Thanks to John Faith for providing the patch ISPEED/OSPEED. Thanks to John Faith for providing the patch
fixed sa_family_t compile error on DragonFly; minor code cleanup.
Thanks to Tony Young for reporting this issue and sending a patch.
Ubuntu Oneiric: OpenSSL no longer provides SSLv2 functions; libutil.sh
is now bsd/libutil.h; compiler warns on vars that is only written to
new features: new features:
added option max-children that limits the number of concurrent child added option max-children that limits the number of concurrent child
processes. Thanks to Sam Liddicott for providing the patch. processes. Thanks to Sam Liddicott for providing the patch.

View file

@ -1,5 +1,5 @@
/* source: config.h.in */ /* source: config.h.in */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __config_h_included #ifndef __config_h_included
@ -142,6 +142,9 @@
/* Define if you have the hstrerror prototype */ /* Define if you have the hstrerror prototype */
#undef HAVE_PROTOTYPE_HSTRERROR #undef HAVE_PROTOTYPE_HSTRERROR
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
@ -259,6 +262,9 @@
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */ /* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
#undef HAVE_UTIL_H #undef HAVE_UTIL_H
/* Define if you have the <bsd/libutil.h> header file. */
#undef HAVE_BSD_LIBUTIL_H
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */ /* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
#undef HAVE_LIBUTIL_H #undef HAVE_LIBUTIL_H
@ -378,6 +384,12 @@
/* Define if you have the unsetenv function. not on HP-UX */ /* Define if you have the unsetenv function. not on HP-UX */
#undef HAVE_UNSETENV #undef HAVE_UNSETENV
/* Define if you have the SSLv2_client_method function. not in new openssl */
#undef HAVE_SSLv2_client_method
/* Define if you have the SSLv2_server_method function. not in new openssl */
#undef HAVE_SSLv2_server_method
/* Define if you have the flock function */ /* Define if you have the flock function */
#undef HAVE_FLOCK #undef HAVE_FLOCK

View file

@ -1,5 +1,5 @@
nl source: configure.in nl source: configure.in
dnl Copyright Gerhard Rieger 2001-2012 dnl Copyright Gerhard Rieger
dnl Published under the GNU General Public License V.2, see file COPYING dnl Published under the GNU General Public License V.2, see file COPYING
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
@ -53,6 +53,7 @@ export CFLAGS
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(inttypes.h)
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/param.h sys/ioctl.h sys/time.h syslog.h unistd.h) AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/param.h sys/ioctl.h sys/time.h syslog.h unistd.h)
AC_CHECK_HEADERS(pwd.h grp.h stdint.h sys/types.h sys/poll.h sys/socket.h sys/uio.h sys/stat.h netdb.h sys/un.h) AC_CHECK_HEADERS(pwd.h grp.h stdint.h sys/types.h sys/poll.h sys/socket.h sys/uio.h sys/stat.h netdb.h sys/un.h)
@ -76,7 +77,7 @@ AC_CHECK_HEADERS(termios.h linux/if_tun.h)
AC_CHECK_HEADERS(net/if_dl.h) AC_CHECK_HEADERS(net/if_dl.h)
AC_CHECK_HEADERS(linux/types.h linux/errqueue.h) AC_CHECK_HEADERS(linux/types.h linux/errqueue.h)
AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h) AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h)
AC_CHECK_HEADERS(util.h libutil.h sys/stropts.h regex.h) AC_CHECK_HEADERS(util.h bsd/libutil.h libutil.h sys/stropts.h regex.h)
AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h) AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h)
dnl Checks for setgrent, getgrent and endgrent. dnl Checks for setgrent, getgrent and endgrent.
@ -552,12 +553,12 @@ fi
# check for fips support # check for fips support
AC_MSG_CHECKING(whether to include openssl fips support) AC_MSG_CHECKING(whether to include openssl fips support)
AC_ARG_ENABLE(fips, [ --disable-fips disable OpenSSL FIPS support], AC_ARG_ENABLE(fips, [ --enable-fips enable OpenSSL FIPS support],
[ case "$enableval" in [ case "$enableval" in
no) AC_MSG_RESULT(no); WITH_FIPS= ;; yes) AC_MSG_RESULT(yes); WITH_FIPS=1 ;;
*) AC_MSG_RESULT(yes); WITH_FIPS=1 ;; *) AC_MSG_RESULT(no); WITH_FIPS= ;;
esac], esac],
[ AC_MSG_RESULT(yes); WITH_FIPS=1 ]) [ AC_MSG_RESULT(no); WITH_FIPS= ])
if test -n "$WITH_FIPS"; then if test -n "$WITH_FIPS"; then
if test -n "$WITH_OPENSSL"; then if test -n "$WITH_OPENSSL"; then
@ -880,6 +881,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
AC_MSG_CHECKING(for sa_family_t) AC_MSG_CHECKING(for sa_family_t)
AC_CACHE_VAL(sc_cv_type_sa_family_t, AC_CACHE_VAL(sc_cv_type_sa_family_t,
[AC_TRY_COMPILE([#include <sys/types.h> [AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[sa_family_t s;], #include <netinet/in.h>],[sa_family_t s;],
[sc_cv_type_sa_family_t=yes], [sc_cv_type_sa_family_t=yes],
[sc_cv_type_sa_family_t=no])]) [sc_cv_type_sa_family_t=no])])
@ -1288,6 +1290,10 @@ AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),
dnl Search for unsetenv() dnl Search for unsetenv()
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV)) AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV))
dnl Search for SSLv2_client_method, SSLv2_server_method
AC_CHECK_FUNC(SSLv3_client_method, AC_DEFINE(HAVE_SSLv3_client_method), AC_CHECK_LIB(crypt, SSLv3_client_method, [LIBS=-lcrypt $LIBS]))
AC_CHECK_FUNC(SSLv2_server_method, AC_DEFINE(HAVE_SSLv2_server_method), AC_CHECK_LIB(crypt, SSLv2_server_method, [LIBS=-lcrypt $LIBS]))
dnl Run time checks dnl Run time checks

View file

@ -1,5 +1,5 @@
/* source: fdname.c */ /* source: fdname.c */
/* Copyright Gerhard Rieger 2003-2008 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* the subroutine sockname prints the basic info about the address of a socket /* the subroutine sockname prints the basic info about the address of a socket
@ -103,7 +103,6 @@ static int procgetfdname(int fd, char *filepath, size_t pathsize) {
int statname(const char *file, int fd, int filetype, FILE *outfile) { int statname(const char *file, int fd, int filetype, FILE *outfile) {
char filepath[PATH_MAX]; char filepath[PATH_MAX];
int result;
filepath[0] = '\0'; filepath[0] = '\0';
#if HAVE_PROC_DIR_FD #if HAVE_PROC_DIR_FD
@ -144,7 +143,7 @@ int statname(const char *file, int fd, int filetype, FILE *outfile) {
case (S_IFSOCK>>12): /* 12, socket */ case (S_IFSOCK>>12): /* 12, socket */
#if _WITH_SOCKET #if _WITH_SOCKET
if (fd >= 0) { if (fd >= 0) {
result = sockname(fd, outfile); sockname(fd, outfile);
} else if (file) { } else if (file) {
fprintf(outfile, "socket %s", file); fprintf(outfile, "socket %s", file);
} else { } else {

View file

@ -1,5 +1,5 @@
/* source: filan.c */ /* source: filan.c */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* the subroutine filan makes a "FILe descriptor ANalysis". It checks the /* the subroutine filan makes a "FILe descriptor ANalysis". It checks the
@ -215,7 +215,6 @@ int filan_stat(
#endif /* !HAVE_STAT64 */ #endif /* !HAVE_STAT64 */
, int statfd, int dynfd, FILE *outfile) { , int statfd, int dynfd, FILE *outfile) {
char stdevstr[8]; char stdevstr[8];
int result;
/* print header */ /* print header */
if (!headprinted) { if (!headprinted) {
@ -374,7 +373,7 @@ int filan_stat(
case (S_IFIFO): /* 1, FIFO */ case (S_IFIFO): /* 1, FIFO */
break; break;
case (S_IFCHR): /* 2, character device */ case (S_IFCHR): /* 2, character device */
result = cdevan(statfd, outfile); cdevan(statfd, outfile);
break; break;
case (S_IFDIR): /* 4, directory */ case (S_IFDIR): /* 4, directory */
break; break;
@ -387,7 +386,7 @@ int filan_stat(
#ifdef S_IFSOCK #ifdef S_IFSOCK
case (S_IFSOCK): /* 12, socket */ case (S_IFSOCK): /* 12, socket */
#if _WITH_SOCKET #if _WITH_SOCKET
result = sockan(statfd, outfile); sockan(statfd, outfile);
#else #else
Warn("SOCKET support not compiled in"); Warn("SOCKET support not compiled in");
return -1; return -1;

View file

@ -1,5 +1,5 @@
/* source: sslcls.c */ /* source: sslcls.c */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* explicit system call and C library trace function, for those who miss strace /* explicit system call and C library trace function, for those who miss strace
@ -35,71 +35,75 @@ int sycSSL_library_init(void) {
return result; return result;
} }
SSL_METHOD *sycSSLv2_client_method(void) { #if HAVE_SSLv2_client_method
SSL_METHOD *result; const SSL_METHOD *sycSSLv2_client_method(void) {
const SSL_METHOD *result;
Debug("SSLv2_client_method()"); Debug("SSLv2_client_method()");
result = SSLv2_client_method(); result = SSLv2_client_method();
Debug1("SSLv2_client_method() -> %p", result); Debug1("SSLv2_client_method() -> %p", result);
return result; return result;
} }
#endif
SSL_METHOD *sycSSLv2_server_method(void) { #if HAVE_SSLv2_server_method
SSL_METHOD *result; const SSL_METHOD *sycSSLv2_server_method(void) {
const SSL_METHOD *result;
Debug("SSLv2_server_method()"); Debug("SSLv2_server_method()");
result = SSLv2_server_method(); result = SSLv2_server_method();
Debug1("SSLv2_server_method() -> %p", result); Debug1("SSLv2_server_method() -> %p", result);
return result; return result;
} }
#endif
SSL_METHOD *sycSSLv3_client_method(void) { const SSL_METHOD *sycSSLv3_client_method(void) {
SSL_METHOD *result; const SSL_METHOD *result;
Debug("SSLv3_client_method()"); Debug("SSLv3_client_method()");
result = SSLv3_client_method(); result = SSLv3_client_method();
Debug1("SSLv3_client_method() -> %p", result); Debug1("SSLv3_client_method() -> %p", result);
return result; return result;
} }
SSL_METHOD *sycSSLv3_server_method(void) { const SSL_METHOD *sycSSLv3_server_method(void) {
SSL_METHOD *result; const SSL_METHOD *result;
Debug("SSLv3_server_method()"); Debug("SSLv3_server_method()");
result = SSLv3_server_method(); result = SSLv3_server_method();
Debug1("SSLv3_server_method() -> %p", result); Debug1("SSLv3_server_method() -> %p", result);
return result; return result;
} }
SSL_METHOD *sycSSLv23_client_method(void) { const SSL_METHOD *sycSSLv23_client_method(void) {
SSL_METHOD *result; const SSL_METHOD *result;
Debug("SSLv23_client_method()"); Debug("SSLv23_client_method()");
result = SSLv23_client_method(); result = SSLv23_client_method();
Debug1("SSLv23_client_method() -> %p", result); Debug1("SSLv23_client_method() -> %p", result);
return result; return result;
} }
SSL_METHOD *sycSSLv23_server_method(void) { const SSL_METHOD *sycSSLv23_server_method(void) {
SSL_METHOD *result; const SSL_METHOD *result;
Debug("SSLv23_server_method()"); Debug("SSLv23_server_method()");
result = SSLv23_server_method(); result = SSLv23_server_method();
Debug1("SSLv23_server_method() -> %p", result); Debug1("SSLv23_server_method() -> %p", result);
return result; return result;
} }
SSL_METHOD *sycTLSv1_client_method(void) { const SSL_METHOD *sycTLSv1_client_method(void) {
SSL_METHOD *result; const SSL_METHOD *result;
Debug("TLSv1_client_method()"); Debug("TLSv1_client_method()");
result = TLSv1_client_method(); result = TLSv1_client_method();
Debug1("TLSv1_client_method() -> %p", result); Debug1("TLSv1_client_method() -> %p", result);
return result; return result;
} }
SSL_METHOD *sycTLSv1_server_method(void) { const SSL_METHOD *sycTLSv1_server_method(void) {
SSL_METHOD *result; const SSL_METHOD *result;
Debug("TLSv1_server_method()"); Debug("TLSv1_server_method()");
result = TLSv1_server_method(); result = TLSv1_server_method();
Debug1("TLSv1_server_method() -> %p", result); Debug1("TLSv1_server_method() -> %p", result);
return result; return result;
} }
SSL_CTX *sycSSL_CTX_new(SSL_METHOD *method) { SSL_CTX *sycSSL_CTX_new(const SSL_METHOD *method) {
SSL_CTX *result; SSL_CTX *result;
Debug1("SSL_CTX_new(%p)", method); Debug1("SSL_CTX_new(%p)", method);
result = SSL_CTX_new(method); result = SSL_CTX_new(method);

View file

@ -1,5 +1,5 @@
/* source: sslcls.h */ /* source: sslcls.h */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __sslcls_h_included #ifndef __sslcls_h_included
@ -10,15 +10,15 @@
void sycSSL_load_error_strings(void); void sycSSL_load_error_strings(void);
int sycSSL_library_init(void); int sycSSL_library_init(void);
SSL_METHOD *sycSSLv2_client_method(void); const SSL_METHOD *sycSSLv2_client_method(void);
SSL_METHOD *sycSSLv2_server_method(void); const SSL_METHOD *sycSSLv2_server_method(void);
SSL_METHOD *sycSSLv3_client_method(void); const SSL_METHOD *sycSSLv3_client_method(void);
SSL_METHOD *sycSSLv3_server_method(void); const SSL_METHOD *sycSSLv3_server_method(void);
SSL_METHOD *sycSSLv23_client_method(void); const SSL_METHOD *sycSSLv23_client_method(void);
SSL_METHOD *sycSSLv23_server_method(void); const SSL_METHOD *sycSSLv23_server_method(void);
SSL_METHOD *sycTLSv1_client_method(void); const SSL_METHOD *sycTLSv1_client_method(void);
SSL_METHOD *sycTLSv1_server_method(void); const SSL_METHOD *sycTLSv1_server_method(void);
SSL_CTX *sycSSL_CTX_new(SSL_METHOD *method); SSL_CTX *sycSSL_CTX_new(const SSL_METHOD *method);
SSL *sycSSL_new(SSL_CTX *ctx); SSL *sycSSL_new(SSL_CTX *ctx);
int sycSSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, int sycSSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
const char *CApath); const char *CApath);

View file

@ -1,10 +1,13 @@
/* source: sysincludes.h */ /* source: sysincludes.h */
/* Copyright Gerhard Rieger 2001-2009 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __sysincludes_h_included #ifndef __sysincludes_h_included
#define __sysincludes_h_included 1 #define __sysincludes_h_included 1
#if HAVE_INTTYPES_H
#include <inttypes.h> /* uint16_t */
#endif
#if HAVE_LIMITS_H #if HAVE_LIMITS_H
#include <limits.h> /* USHRT_MAX */ #include <limits.h> /* USHRT_MAX */
#endif #endif
@ -147,7 +150,9 @@
#if HAVE_UTIL_H #if HAVE_UTIL_H
#include <util.h> /* NetBSD, OpenBSD openpty() */ #include <util.h> /* NetBSD, OpenBSD openpty() */
#endif #endif
#if HAVE_LIBUTIL_H #if HAVE_BSD_LIBUTIL_H
#include <bsd/libutil.h> /* FreeBSD openpty() */
#elif HAVE_LIBUTIL_H
#include <libutil.h> /* FreeBSD openpty() */ #include <libutil.h> /* FreeBSD openpty() */
#endif #endif
#if HAVE_SYS_STROPTS_H #if HAVE_SYS_STROPTS_H

32
test.sh
View file

@ -146,7 +146,8 @@ OpenBSD)IFCONFIG=/sbin/ifconfig ;;
OSF1) IFCONFIG=/sbin/ifconfig ;; OSF1) IFCONFIG=/sbin/ifconfig ;;
SunOS) IFCONFIG=/sbin/ifconfig ;; SunOS) IFCONFIG=/sbin/ifconfig ;;
Darwin)IFCONFIG=/sbin/ifconfig ;; Darwin)IFCONFIG=/sbin/ifconfig ;;
#*) IFCONFIG=/sbin/ifconfig ;; DragonFly) IFCONFIG=/sbin/ifconfig ;;
*) IFCONFIG=/sbin/ifconfig ;;
esac esac
# for some tests we need a second local IPv4 address # for some tests we need a second local IPv4 address
@ -178,6 +179,12 @@ SunOS)
#BCIFADDR="$SECONDADDR" #BCIFADDR="$SECONDADDR"
#BCADDR=$($IFCONFIG $BROADCASTIF |grep 'broadcast ' |sed 's/.*broadcast/broadcast/' |awk '{print($2);}') #BCADDR=$($IFCONFIG $BROADCASTIF |grep 'broadcast ' |sed 's/.*broadcast/broadcast/' |awk '{print($2);}')
;; ;;
DragonFly)
MAINIF=$($IFCONFIG -a |grep -v ^lp |grep '^[a-z]' |grep -v '^lo0: ' |head -1 |cut -d: -f1)
BROADCASTIF="$MAINIF"
SECONDADDR=$($IFCONFIG $BROADCASTIF |grep 'inet ' |awk '{print($2);}')
BCIFADDR="$SECONDADDR"
BCADDR=$($IFCONFIG $BROADCASTIF |grep 'broadcast ' |sed 's/.*broadcast/broadcast/' |awk '{print($2);}') ;;
#AIX|FreeBSD|Solaris) #AIX|FreeBSD|Solaris)
*) *)
SECONDADDR=$(expr "$($IFCONFIG -a |grep 'inet ' |fgrep -v ' 127.0.0.1 ' |head -n 1)" : '.*inet \([0-9.]*\) .*') SECONDADDR=$(expr "$($IFCONFIG -a |grep 'inet ' |fgrep -v ' 127.0.0.1 ' |head -n 1)" : '.*inet \([0-9.]*\) .*')
@ -1669,7 +1676,7 @@ ifprocess () {
NetBSD) l="$(ps -aj |grep "^[^ ][^ ]*[ ][ ]*$(printf %5u $1) ")" ;; NetBSD) l="$(ps -aj |grep "^[^ ][^ ]*[ ][ ]*$(printf %5u $1) ")" ;;
OpenBSD) l="$(ps -kaj |grep "^........ $(printf %5u $1)")" ;; OpenBSD) l="$(ps -kaj |grep "^........ $(printf %5u $1)")" ;;
SunOS) l="$(ps -fade |grep "^........ $(printf %5u $1)")" ;; SunOS) l="$(ps -fade |grep "^........ $(printf %5u $1)")" ;;
DragonFly)l="$(ps -faje |grep "^[^ ][^ ]*[ ][ ]*$(printf %5u $1)")" ;; DragonFly)l="$(ps -faje |grep "^[^ ][^ ]*[ ][ ]*$(printf %5u $1)")" ;;
CYGWIN*) l="$(ps -pafe |grep "^[^ ]*[ ][ ]*$1[ ]")" ;; CYGWIN*) l="$(ps -pafe |grep "^[^ ]*[ ][ ]*$1[ ]")" ;;
*) l="$(ps -fade |grep "^[^ ][^ ]*[ ][ ]*$(printf %5u $1) ")" ;; *) l="$(ps -fade |grep "^[^ ][^ ]*[ ][ ]*$(printf %5u $1) ")" ;;
esac esac
@ -1715,6 +1722,7 @@ isdefunct () {
HP-UX) l="$(echo "$1" |grep ' <defunct>$')" ;; HP-UX) l="$(echo "$1" |grep ' <defunct>$')" ;;
Linux) l="$(echo "$1" |grep ' <defunct>$')" ;; Linux) l="$(echo "$1" |grep ' <defunct>$')" ;;
SunOS) l="$(echo "$1" |grep ' <defunct>$')" ;; SunOS) l="$(echo "$1" |grep ' <defunct>$')" ;;
DragonFly)l="$(echo "$1" |grep ' <defunct>$')" ;;
*) l="$(echo "$1" |grep ' <defunct>$')" ;; *) l="$(echo "$1" |grep ' <defunct>$')" ;;
esac esac
[ -n "$l" ]; [ -n "$l" ];
@ -1745,7 +1753,8 @@ runsip4 () {
OSF1) l=$($IFCONFIG -a |grep ' inet ') ;; OSF1) l=$($IFCONFIG -a |grep ' inet ') ;;
SunOS) l=$($IFCONFIG -a |grep 'inet ') ;; SunOS) l=$($IFCONFIG -a |grep 'inet ') ;;
Darwin)l=$($IFCONFIG lo0 |fgrep 'inet 127.0.0.1 ') ;; Darwin)l=$($IFCONFIG lo0 |fgrep 'inet 127.0.0.1 ') ;;
# *) l=$($IFCONFIG -a |grep ' ::1[^:0-9A-Fa-f]') ;; DragonFly)l=$($IFCONFIG -a |fgrep 'inet 127.0.0.1 ');;
*) l=$($IFCONFIG -a |grep ' ::1[^:0-9A-Fa-f]') ;;
esac esac
[ -z "$l" ] && return 1 [ -z "$l" ] && return 1
# existence of interface might not suffice, check for routeability: # existence of interface might not suffice, check for routeability:
@ -1792,6 +1801,8 @@ runstcp4 () {
pid=$! pid=$!
usleep $MICROS usleep $MICROS
kill "$pid" 2>/dev/null kill "$pid" 2>/dev/null
wait
usleep $MICROS
test ! -s "$td/tcp4.stderr" test ! -s "$td/tcp4.stderr"
} }
@ -1803,6 +1814,8 @@ runstcp6 () {
pid=$! pid=$!
usleep $MICROS usleep $MICROS
kill "$pid" 2>/dev/null kill "$pid" 2>/dev/null
wait
usleep $MICROS
test ! -s "$td/tcp6.stderr" test ! -s "$td/tcp6.stderr"
} }
@ -1814,6 +1827,8 @@ runsudp4 () {
pid=$! pid=$!
usleep $MICROS usleep $MICROS
kill "$pid" 2>/dev/null kill "$pid" 2>/dev/null
wait
usleep $MICROS
test ! -s "$td/udp4.stderr" test ! -s "$td/udp4.stderr"
} }
@ -1825,6 +1840,8 @@ runsudp6 () {
pid=$! pid=$!
usleep $MICROS usleep $MICROS
kill "$pid" 2>/dev/null kill "$pid" 2>/dev/null
wait
usleep $MICROS
test ! -s "$td/udp6.stderr" test ! -s "$td/udp6.stderr"
} }
@ -1835,6 +1852,8 @@ runssctp4 () {
pid=$! pid=$!
usleep $MICROS usleep $MICROS
kill "$pid" 2>/dev/null kill "$pid" 2>/dev/null
wait
usleep $MICROS
test ! -s "$td/sctp4.stderr" test ! -s "$td/sctp4.stderr"
} }
@ -1845,6 +1864,8 @@ runssctp6 () {
pid=$! pid=$!
usleep $MICROS usleep $MICROS
kill "$pid" 2>/dev/null kill "$pid" 2>/dev/null
wait
usleep $MICROS
test ! -s "$td/sctp6.stderr" test ! -s "$td/sctp6.stderr"
} }
@ -1948,6 +1969,7 @@ checktcp4port () {
HP-UX) l=$(netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' .* LISTEN$') ;; HP-UX) l=$(netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' .* LISTEN$') ;;
OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') ;; OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') ;;
CYGWIN*) l=$(netstat -an -p TCP |grep '^ TCP [0-9.]*:'$port' .* LISTENING') ;; CYGWIN*) l=$(netstat -an -p TCP |grep '^ TCP [0-9.]*:'$port' .* LISTENING') ;;
DragonFly)l=$(netstat -ant |grep '^tcp4 .* .*[0-9*]\.'$port' [ ]* \*\.\* [ ]* LISTEN.*') ;;
*) l=$(netstat -an |grep -i 'tcp .*[0-9*][:.]'$port' .* listen') ;; *) l=$(netstat -an |grep -i 'tcp .*[0-9*][:.]'$port' .* listen') ;;
esac esac
[ -z "$l" ] && return 0 [ -z "$l" ] && return 0
@ -1976,6 +1998,7 @@ waittcp4port () {
HP-UX) l=$(netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' .* LISTEN$') ;; HP-UX) l=$(netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' .* LISTEN$') ;;
OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') ;; OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') ;;
CYGWIN*) l=$(netstat -an -p TCP |grep '^ TCP [0-9.]*:'$port' .* LISTENING') ;; CYGWIN*) l=$(netstat -an -p TCP |grep '^ TCP [0-9.]*:'$port' .* LISTENING') ;;
DragonFly) l=$(netstat -ant |grep '^tcp4 .* .*[0-9*]\.'$port' [ ]* \*\.\* [ ]* LISTEN.*') ;;
*) l=$(netstat -an |grep -i 'tcp .*[0-9*][:.]'$port' .* listen') ;; *) l=$(netstat -an |grep -i 'tcp .*[0-9*][:.]'$port' .* listen') ;;
esac esac
[ \( \( $logic -ne 0 \) -a -n "$l" \) -o \ [ \( \( $logic -ne 0 \) -a -n "$l" \) -o \
@ -2010,6 +2033,7 @@ waitudp4port () {
SunOS) l=$(netstat -an -f inet -P udp |grep '.*[1-9*]\.'$port' [ ]*Idle') ;; SunOS) l=$(netstat -an -f inet -P udp |grep '.*[1-9*]\.'$port' [ ]*Idle') ;;
HP-UX) l=$(netstat -an |grep '^udp 0 0 .*[0-9*]\.'$port' .* \*\.\* ') ;; HP-UX) l=$(netstat -an |grep '^udp 0 0 .*[0-9*]\.'$port' .* \*\.\* ') ;;
OSF1) l=$(/usr/sbin/netstat -an |grep '^udp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\*') ;; OSF1) l=$(/usr/sbin/netstat -an |grep '^udp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\*') ;;
DragonFly) l=$(netstat -an |grep '^udp4 .* .*[0-9*]\.'$port' [ ]* \*\.\* [ ]*') ;;
*) l=$(netstat -an |grep -i 'udp .*[0-9*][:.]'$port' ') ;; *) l=$(netstat -an |grep -i 'udp .*[0-9*][:.]'$port' ') ;;
esac esac
[ \( \( $logic -ne 0 \) -a -n "$l" \) -o \ [ \( \( $logic -ne 0 \) -a -n "$l" \) -o \
@ -2074,6 +2098,7 @@ waittcp6port () {
AIX) l=$(netstat -an |grep '^tcp[6 ] 0 0 .*[*0-9]\.'$port' .* LISTEN$') ;; AIX) l=$(netstat -an |grep '^tcp[6 ] 0 0 .*[*0-9]\.'$port' .* LISTEN$') ;;
SunOS) l=$(netstat -an -f inet6 -P tcp |grep '.*[1-9*]\.'$port' .*\* [ ]* 0 .* LISTEN') ;; SunOS) l=$(netstat -an -f inet6 -P tcp |grep '.*[1-9*]\.'$port' .*\* [ ]* 0 .* LISTEN') ;;
#OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp6 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') /*?*/;; #OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp6 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') /*?*/;;
DragonFly) l=$(netstat -ant |grep '^tcp6 .* .*[0-9*]\.'$port' [ ]* \*\.\* [ ]* LISTEN.*') ;;
*) l=$(netstat -an |grep -i 'tcp6 .*:'$port' .* listen') ;; *) l=$(netstat -an |grep -i 'tcp6 .*:'$port' .* listen') ;;
esac esac
[ \( \( $logic -ne 0 \) -a -n "$l" \) -o \ [ \( \( $logic -ne 0 \) -a -n "$l" \) -o \
@ -2105,6 +2130,7 @@ waitudp6port () {
SunOS) l=$(netstat -an -f inet6 -P udp |grep '.*[1-9*]\.'$port' [ ]*Idle') ;; SunOS) l=$(netstat -an -f inet6 -P udp |grep '.*[1-9*]\.'$port' [ ]*Idle') ;;
#HP-UX) l=$(netstat -an |grep '^udp 0 0 .*[0-9*]\.'$port' ') ;; #HP-UX) l=$(netstat -an |grep '^udp 0 0 .*[0-9*]\.'$port' ') ;;
#OSF1) l=$(/usr/sbin/netstat -an |grep '^udp6 0 0 .*[0-9*]\.'$port' [ ]*\*\.\*') ;; #OSF1) l=$(/usr/sbin/netstat -an |grep '^udp6 0 0 .*[0-9*]\.'$port' [ ]*\*\.\*') ;;
DragonFly) l=$(netstat -ant |grep '^udp6 .* .*[0-9*]\.'$port' [ ]* \*\.\* [ ]*') ;;
*) l=$(netstat -an |grep -i 'udp .*[0-9*][:.]'$port' ') ;; *) l=$(netstat -an |grep -i 'udp .*[0-9*][:.]'$port' ') ;;
esac esac
[ \( \( $logic -ne 0 \) -a -n "$l" \) -o \ [ \( \( $logic -ne 0 \) -a -n "$l" \) -o \

View file

@ -1,5 +1,5 @@
/* source: xio-exec.c */ /* source: xio-exec.c */
/* Copyright Gerhard Rieger 2001-2009 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for opening addresses of exec type */ /* this file contains the source for opening addresses of exec type */
@ -84,7 +84,7 @@ static int xioopen_exec1(int argc, const char *argv[], struct opt *opts,
NULL NULL
} ; } ;
char **pargv = NULL; char **pargv = NULL;
int pargc, i; int pargc;
size_t len; size_t len;
const char *strp; const char *strp;
char *token; /*! */ char *token; /*! */
@ -92,14 +92,12 @@ static int xioopen_exec1(int argc, const char *argv[], struct opt *opts,
char *path = NULL; char *path = NULL;
char *tmp; char *tmp;
int numleft; int numleft;
int result;
/*! Close(something) */ /*! Close(something) */
/* parse command line */ /* parse command line */
Debug1("child: args = \"%s\"", argv[1]); Debug1("child: args = \"%s\"", argv[1]);
pargv = Malloc(8*sizeof(char *)); pargv = Malloc(8*sizeof(char *));
if (pargv == NULL) return STAT_RETRYLATER; if (pargv == NULL) return STAT_RETRYLATER;
i = 0;
len = strlen(argv[1])+1; len = strlen(argv[1])+1;
strp = argv[1]; strp = argv[1];
token = Malloc(len); /*! */ token = Malloc(len); /*! */
@ -155,7 +153,7 @@ static int xioopen_exec1(int argc, const char *argv[], struct opt *opts,
Dup2(duptostderr, 2); Dup2(duptostderr, 2);
} }
Notice1("execvp'ing \"%s\"", token); Notice1("execvp'ing \"%s\"", token);
result = Execvp(token, pargv); Execvp(token, pargv);
/* here we come only if execvp() failed */ /* here we come only if execvp() failed */
switch (pargc) { switch (pargc) {
case 1: Error3("execvp(\"%s\", \"%s\"): %s", token, pargv[0], strerror(errno)); break; case 1: Error3("execvp(\"%s\", \"%s\"): %s", token, pargv[0], strerror(errno)); break;

View file

@ -54,13 +54,7 @@ int
successful establishment of tcp connection */ successful establishment of tcp connection */
result = _xioopen_listen(xfd, xioflags, result = _xioopen_listen(xfd, xioflags,
(struct sockaddr *)us, uslen, (struct sockaddr *)us, uslen,
opts, pf, socktype, proto, opts, pf, socktype, proto, level);
#if WITH_RETRY
(xfd->retry||xfd->forever)?E_INFO:E_ERROR
#else
E_ERROR
#endif /* WITH_RETRY */
);
/*! not sure if we should try again on retry/forever */ /*! not sure if we should try again on retry/forever */
switch (result) { switch (result) {
case STAT_OK: break; case STAT_OK: break;

View file

@ -1,5 +1,5 @@
/* source: xio-named.c */ /* source: xio-named.c */
/* Copyright Gerhard Rieger 2001-2008 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for filesystem entry functions */ /* this file contains the source for filesystem entry functions */
@ -96,7 +96,6 @@ int _xioopen_named_early(int argc, const char *argv[], xiofile_t *xfd,
int groups, int groups,
bool *exists, struct opt *opts) { bool *exists, struct opt *opts) {
const char *path = argv[1]; const char *path = argv[1];
unsigned int iogroups = 0;
#if HAVE_STAT64 #if HAVE_STAT64
struct stat64 statbuf; struct stat64 statbuf;
#else #else
@ -120,10 +119,8 @@ int _xioopen_named_early(int argc, const char *argv[], xiofile_t *xfd,
Error2("stat(\"%s\"): %s", path, strerror(errno)); Error2("stat(\"%s\"): %s", path, strerror(errno));
return STAT_RETRYLATER; return STAT_RETRYLATER;
} }
iogroups = GROUP_REG;
*exists = false; *exists = false;
} else { } else {
iogroups = _groupbits(statbuf.st_mode);
*exists = true; *exists = true;
} }
@ -135,7 +132,6 @@ int _xioopen_named_early(int argc, const char *argv[], xiofile_t *xfd,
Info1("\"%s\" already exists; removing it", path); Info1("\"%s\" already exists; removing it", path);
if (Unlink(path) < 0) { if (Unlink(path) < 0) {
Error2("unlink(\"%s\"): %s", path, strerror(errno)); Error2("unlink(\"%s\"): %s", path, strerror(errno));
*exists = true;
} else { } else {
*exists = false; *exists = false;
} }

View file

@ -1,5 +1,5 @@
/* source: xio-openssl.c */ /* source: xio-openssl.c */
/* Copyright Gerhard Rieger 2002-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the implementation of the openssl addresses */ /* this file contains the implementation of the openssl addresses */
@ -822,7 +822,7 @@ int
SSL_CTX **ctx) SSL_CTX **ctx)
{ {
bool opt_fips = false; bool opt_fips = false;
SSL_METHOD *method; const SSL_METHOD *method;
char *me_str = NULL; /* method string */ char *me_str = NULL; /* method string */
char *ci_str = NULL; /* cipher string */ char *ci_str = NULL; /* cipher string */
char *opt_key = NULL; /* file name of client private key */ char *opt_key = NULL; /* file name of client private key */
@ -878,8 +878,14 @@ int
if (!server) { if (!server) {
if (me_str != 0) { if (me_str != 0) {
if (!strcasecmp(me_str, "SSLv2") || !strcasecmp(me_str, "SSL2")) { if (!strcasecmp(me_str, "SSLv2") || !strcasecmp(me_str, "SSL2")) {
#if HAVE_SSLv2_client_method
method = sycSSLv2_client_method(); method = sycSSLv2_client_method();
} else if (!strcasecmp(me_str, "SSLv3") || !strcasecmp(me_str, "SSL3")) { #else
Error1("OpenSSL method \"%s\" not provided by library", me_str);
method = sycSSLv23_server_method();
#endif
} else
if (!strcasecmp(me_str, "SSLv3") || !strcasecmp(me_str, "SSL3")) {
method = sycSSLv3_client_method(); method = sycSSLv3_client_method();
} else if (!strcasecmp(me_str, "SSLv23") || !strcasecmp(me_str, "SSL23") || } else if (!strcasecmp(me_str, "SSLv23") || !strcasecmp(me_str, "SSL23") ||
!strcasecmp(me_str, "SSL")) { !strcasecmp(me_str, "SSL")) {
@ -889,16 +895,22 @@ int
method = sycTLSv1_client_method(); method = sycTLSv1_client_method();
} else { } else {
Error1("openssl-method=\"%s\": unknown method", me_str); Error1("openssl-method=\"%s\": unknown method", me_str);
method = sycSSLv23_client_method()/*!*/; method = sycSSLv23_client_method();
} }
} else { } else {
method = sycSSLv23_client_method()/*!*/; method = sycSSLv23_client_method();
} }
} else /* server */ { } else /* server */ {
if (me_str != 0) { if (me_str != 0) {
if (!strcasecmp(me_str, "SSLv2") || !strcasecmp(me_str, "SSL2")) { if (!strcasecmp(me_str, "SSLv2") || !strcasecmp(me_str, "SSL2")) {
#if HAVE_SSLv2_server_method
method = sycSSLv2_server_method(); method = sycSSLv2_server_method();
} else if (!strcasecmp(me_str, "SSLv3") || !strcasecmp(me_str, "SSL3")) { #else
Error1("OpenSSL method \"%s\" not provided by library", me_str);
method = sycSSLv23_server_method();
#endif
} else
if (!strcasecmp(me_str, "SSLv3") || !strcasecmp(me_str, "SSL3")) {
method = sycSSLv3_server_method(); method = sycSSLv3_server_method();
} else if (!strcasecmp(me_str, "SSLv23") || !strcasecmp(me_str, "SSL23") || } else if (!strcasecmp(me_str, "SSLv23") || !strcasecmp(me_str, "SSL23") ||
!strcasecmp(me_str, "SSL")) { !strcasecmp(me_str, "SSL")) {
@ -908,10 +920,10 @@ int
method = sycTLSv1_server_method(); method = sycTLSv1_server_method();
} else { } else {
Error1("openssl-method=\"%s\": unknown method", me_str); Error1("openssl-method=\"%s\": unknown method", me_str);
method = sycSSLv23_server_method()/*!*/; method = sycSSLv23_server_method();
} }
} else { } else {
method = sycSSLv23_server_method()/*!*/; method = sycSSLv23_server_method();
} }
} }

View file

@ -1,5 +1,5 @@
/* source: xio-socket.c */ /* source: xio-socket.c */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for socket related functions, and the /* this file contains the source for socket related functions, and the
@ -778,7 +778,6 @@ int _xioopen_connect(struct single *xfd, struct sockaddr *us, size_t uslen,
union sockaddr_union sin, *sinp; union sockaddr_union sin, *sinp;
unsigned short *port, i, N; unsigned short *port, i, N;
div_t dv; div_t dv;
bool problem;
/* prepare sockaddr for bind probing */ /* prepare sockaddr for bind probing */
if (us) { if (us) {
@ -826,7 +825,6 @@ int _xioopen_connect(struct single *xfd, struct sockaddr *us, size_t uslen,
} }
dv = div(random(), IPPORT_RESERVED-XIO_IPPORT_LOWER); dv = div(random(), IPPORT_RESERVED-XIO_IPPORT_LOWER);
i = N = XIO_IPPORT_LOWER + dv.rem; i = N = XIO_IPPORT_LOWER + dv.rem;
problem = false;
do { /* loop over lowport bind() attempts */ do { /* loop over lowport bind() attempts */
*port = htons(i); *port = htons(i);
if (Bind(xfd->rfd, (struct sockaddr *)sinp, sizeof(*sinp)) < 0) { if (Bind(xfd->rfd, (struct sockaddr *)sinp, sizeof(*sinp)) < 0) {
@ -1234,7 +1232,6 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
int rw = (xioflags&XIO_ACCMODE); int rw = (xioflags&XIO_ACCMODE);
int s; int s;
char *rangename; char *rangename;
socklen_t salen;
bool dofork = false; bool dofork = false;
pid_t pid; /* mostly int; only used with fork */ pid_t pid; /* mostly int; only used with fork */
char infobuff[256]; char infobuff[256];
@ -1388,7 +1385,6 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
struct msghdr msgh = {0}; struct msghdr msgh = {0};
socket_init(pf, pa); socket_init(pf, pa);
salen = sizeof(struct sockaddr);
if (drop) { if (drop) {
char *dummy[2]; char *dummy[2];

View file

@ -1,5 +1,5 @@
/* source: xio-udp.c */ /* source: xio-udp.c */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for handling UDP addresses */ /* this file contains the source for handling UDP addresses */
@ -489,7 +489,6 @@ int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
int pf, int socktype, int ipproto) { int pf, int socktype, int ipproto) {
union sockaddr_union us; union sockaddr_union us;
socklen_t uslen = sizeof(us); socklen_t uslen = sizeof(us);
bool needbind = false;
int result; int result;
if (argc != 2) { if (argc != 2) {
@ -536,7 +535,6 @@ int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
case PF_INET6: us.ip6.sin6_addr = la.ip6.sin6_addr; break; case PF_INET6: us.ip6.sin6_addr = la.ip6.sin6_addr; break;
#endif #endif
} }
needbind = true;
} }
} }

View file

@ -1,5 +1,5 @@
/* source: xioopts.c */ /* source: xioopts.c */
/* Copyright Gerhard Rieger 2001-2012 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for address options handling */ /* this file contains the source for address options handling */
@ -2820,7 +2820,7 @@ int retropt_bind(struct opt *opts,
const char portsep[] = ":"; const char portsep[] = ":";
const char *ends[] = { portsep, NULL }; const char *ends[] = { portsep, NULL };
const char *nests[] = { "[", "]", NULL }; const char *nests[] = { "[", "]", NULL };
bool addrallowed, portallowed; bool portallowed;
char *bindname, *bindp; char *bindname, *bindp;
char hostname[512], *hostp = hostname, *portp = NULL; char hostname[512], *hostp = hostname, *portp = NULL;
size_t hostlen = sizeof(hostname)-1; size_t hostlen = sizeof(hostname)-1;
@ -2856,7 +2856,6 @@ int retropt_bind(struct opt *opts,
#if WITH_IP6 #if WITH_IP6
case AF_INET6: case AF_INET6:
#endif /*WITH_IP6 */ #endif /*WITH_IP6 */
addrallowed = true;
portallowed = (feats>=2); portallowed = (feats>=2);
nestlex((const char **)&bindp, &hostp, &hostlen, ends, NULL, NULL, nests, nestlex((const char **)&bindp, &hostp, &hostlen, ends, NULL, NULL, nests,
true, false, false, false); true, false, false, false);