From 910a21936f762a17f27f0f53101cff5b3c8c35fb Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Wed, 21 May 2014 21:23:16 +0200 Subject: [PATCH] Fix some problems on old platforms like Solaris 8 and 9 --- autoconf/configure.in | 29 +++++++++++++++++++++++++++++ src/findlib/acl.c | 2 +- src/lib/bsys.c | 1 + src/lib/compression.c | 5 +++++ src/lib/crypto_openssl.c | 9 ++++++--- 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/autoconf/configure.in b/autoconf/configure.in index c5fa1e3766c..ffaa08f7b59 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -1049,6 +1049,16 @@ if test "x$support_crypto" != "xno" -o "x$support_tls" != "xno"; then CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}" CPPFLAGS="${saved_CPPFLAGS} ${OPENSSL_INC}" + AC_TRY_LINK( + [ + #include + ], [ + ENGINE_load_pk11(); + ], [ + AC_DEFINE(HAVE_ENGINE_LOAD_PK11, 1, [Define to 1 if OpenSSL library has ENGINE_load_pk11 available]) + ] + ) + AC_TRY_LINK( [ #include @@ -2700,6 +2710,20 @@ CPPFLAGS="${saved_CPPFLAGS} ${ZLIB_INC}" AC_CHECK_HEADERS(zlib.h) +AC_MSG_CHECKING(for compressBound in zlib library) +AC_TRY_LINK( + [ + #include + ], [ + compressBound(0); + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_COMPRESS_BOUND, 1, [Define to 1 if you have compressBound]) + ], [ + AC_MSG_RESULT(no) + ] +) + AC_MSG_CHECKING(for deflate in zlib library) AC_TRY_LINK( [ @@ -3854,9 +3878,14 @@ solaris) 5.5|5.6) AC_DEFINE(HAVE_OLD_SOCKOPT, 1, [Define to 1 to use the old sockopt option]) AC_DEFINE(USE_THR_SETCONCURRENCY, 1, [Define to 1 to use the thr_setconcurrency function]) + AC_DEFINE(HAVE_NON_WORKING_WALKCONTEXT, 1, [Define to 1 to when walkcontext does not work]) ;; 5.7|5.8) AC_DEFINE(USE_THR_SETCONCURRENCY, 1, [Define to 1 to use the thr_setconcurrency function]) + AC_DEFINE(HAVE_NON_WORKING_WALKCONTEXT, 1, [Define to 1 to when walkcontext does not work]) + ;; + 5.9) + AC_DEFINE(HAVE_NON_WORKING_WALKCONTEXT, 1, [Define to 1 to when walkcontext does not work]) ;; *) ;; diff --git a/src/findlib/acl.c b/src/findlib/acl.c index 1be8cd725cd..1c9577f18d6 100644 --- a/src/findlib/acl.c +++ b/src/findlib/acl.c @@ -2056,7 +2056,7 @@ static bacl_exit_code solaris_build_acl_streams(JCR *jcr, char *acl_text; n = acl(acl_data->last_fname, GETACLCNT, 0, NULL); - if (n < MIN_ACL_ENTRIES) + if (n < MIN_ACL_ENTRIES) { return bacl_exit_error; } diff --git a/src/lib/bsys.c b/src/lib/bsys.c index c42ab978336..026fe2ef773 100644 --- a/src/lib/bsys.c +++ b/src/lib/bsys.c @@ -1054,6 +1054,7 @@ void stack_trace() * Support strack_trace support on Solaris when using the SUNPRO_CC compiler. */ #elif defined(HAVE_SUN_OS) && \ + !defined(HAVE_NON_WORKING_WALKCONTEXT) && \ defined(HAVE_UCONTEXT_H) && \ defined(HAVE_DEMANGLE_H) && \ defined(HAVE_CPLUS_DEMANGLE) && \ diff --git a/src/lib/compression.c b/src/lib/compression.c index 6a49bdcc03d..2bd3ddbfc37 100644 --- a/src/lib/compression.c +++ b/src/lib/compression.c @@ -49,6 +49,11 @@ #endif #ifdef HAVE_LIBZ + +#ifndef HAVE_COMPRESS_BOUND +#define compressBound(sourceLen) (sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13) +#endif + /* * Convert ZLIB error code into an ASCII message */ diff --git a/src/lib/crypto_openssl.c b/src/lib/crypto_openssl.c index c0942f6d9ec..22598a2fc4b 100644 --- a/src/lib/crypto_openssl.c +++ b/src/lib/crypto_openssl.c @@ -1384,14 +1384,17 @@ int init_crypto(void) Jmsg0(NULL, M_ERROR_TERM, 0, _("Failed to seed OpenSSL PRNG\n")); } -#ifndef HAVE_SUN_OS /* FIXME: Until https://www.illumos.org/issues/1667 is solved. */ +#ifdef HAVE_ENGINE_LOAD_PK11 + /* + * FIXME: Until https://www.illumos.org/issues/1667 is solved. + */ + ENGINE_load_pk11(); +#else /* * Load all the builtin engines. */ ENGINE_load_builtin_engines(); ENGINE_register_all_complete(); -#else - ENGINE_load_pk11(); #endif crypto_initialized = true;