From: Kern Sibbald Date: Fri, 19 Aug 2005 15:36:13 +0000 (+0000) Subject: Win32 tweaks X-Git-Tag: Release-1.38.0~163 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f8b4d482f9c3df697941338fe14fce467f658ac9;p=bacula%2Fbacula Win32 tweaks git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2341 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 0f7242eb2b..1b7f6dbba1 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -684,6 +684,7 @@ AC_ARG_WITH(tcp-wrappers, saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap" AC_MSG_CHECKING(for libwrap) + AC_SEARCH_LIBS(nanosleep, [rt]) AC_TRY_LINK( [ #include int deny_severity = 0; diff --git a/bacula/configure b/bacula/configure index 79b4336957..4f3ccdb45f 100755 --- a/bacula/configure +++ b/bacula/configure @@ -9813,6 +9813,132 @@ if test "${with_tcp_wrappers+set}" = set; then LIBS="$saved_LIBS -lwrap" echo "$as_me:$LINENO: checking for libwrap" >&5 echo $ECHO_N "checking for libwrap... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for library containing nanosleep" >&5 +echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6 +if test "${ac_cv_search_nanosleep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_nanosleep=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char nanosleep (); +int +main () +{ +nanosleep (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_nanosleep="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_nanosleep" = no; then + for ac_lib in rt; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char nanosleep (); +int +main () +{ +nanosleep (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_nanosleep="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5 +echo "${ECHO_T}$ac_cv_search_nanosleep" >&6 +if test "$ac_cv_search_nanosleep" != no; then + test "$ac_cv_search_nanosleep" = "none required" || LIBS="$ac_cv_search_nanosleep $LIBS" + +fi + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 04dc8c6617..20791eefb7 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -58,6 +58,9 @@ /* Allow printing of NULL pointers */ #define NPRT(x) (x)?(x):_("*None*") +#ifdef WIN32 +#undef ENABLE_NLS +#endif #ifdef ENABLE_NLS #include #include diff --git a/bacula/src/console/authenticate.c b/bacula/src/console/authenticate.c index fcbed7b946..52b6f2ad9a 100644 --- a/bacula/src/console/authenticate.c +++ b/bacula/src/console/authenticate.c @@ -11,22 +11,18 @@ * */ /* - Copyright (C) 2001-2004 Kern Sibbald and John Walker + Copyright (C) 2001-2005 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ #include "bacula.h" diff --git a/bacula/src/lib/cram-md5.c b/bacula/src/lib/cram-md5.c index 540ae5b4af..c0f898ec1c 100644 --- a/bacula/src/lib/cram-md5.c +++ b/bacula/src/lib/cram-md5.c @@ -8,22 +8,17 @@ * Version $Id$ */ /* - Copyright (C) 2000-2004 Kern Sibbald and John Walker + Copyright (C) 2000-2005 Kern Sibbald - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -67,6 +62,7 @@ int cram_md5_auth(BSOCK *bs, char *password, int tls_local_need) } hmac_md5((uint8_t *)chal, strlen(chal), (uint8_t *)password, strlen(password), hmac); bin_to_base64(host, (char *)hmac, 16); +// Dmsg3(100, "auth: chal=%s pw=%s hmac=%s\n", chal, password, host); ok = strcmp(bs->msg, host) == 0; if (ok) { Dmsg1(50, "Authenticate OK %s\n", host); @@ -101,15 +97,16 @@ int cram_md5_get_auth(BSOCK *bs, char *password, int *tls_remote_need) Dmsg1(100, "cram-get: %s", bs->msg); if (sscanf(bs->msg, "auth cram-md5 %s ssl=%d\n", chal, tls_remote_need) != 2) { if (sscanf(bs->msg, "auth cram-md5 %s\n", chal) != 1) { - Dmsg1(50, "Cannot scan challenge: %s", bs->msg); - bnet_fsend(bs, _("1999 Authorization failed.\n")); - bmicrosleep(5, 0); - return 0; + Dmsg1(50, "Cannot scan challenge: %s", bs->msg); + bnet_fsend(bs, _("1999 Authorization failed.\n")); + bmicrosleep(5, 0); + return 0; } } hmac_md5((uint8_t *)chal, strlen(chal), (uint8_t *)password, strlen(password), hmac); bs->msglen = bin_to_base64(bs->msg, (char *)hmac, 16) + 1; +// Dmsg3(100, "get_auth: chal=%s pw=%s hmac=%s\n", chal, password, bs->msg); if (!bnet_send(bs)) { Dmsg1(50, "Send challenge failed. ERR=%s\n", bnet_strerror(bs)); return 0; diff --git a/bacula/src/win32/compat/winconfig.h b/bacula/src/win32/compat/winconfig.h index fe70abbce1..ebbc55f360 100644 --- a/bacula/src/win32/compat/winconfig.h +++ b/bacula/src/win32/compat/winconfig.h @@ -147,11 +147,6 @@ /* Define if you have sys/bitypes.h */ /* #undef HAVE_SYS_BITYPES_H */ -/* Directory for PID files */ -#define _PATH_BACULA_PIDDIR "/var/run" - -/* LOCALEDIR */ -#define LOCALEDIR "." /* Define if you have zlib */ #define HAVE_LIBZ 1 @@ -569,9 +564,9 @@ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if the `S_IS*' macros in do not work properly. */ diff --git a/bacula/src/wx-console/authenticate.c b/bacula/src/wx-console/authenticate.c index bf2994b3cc..fcab7be0c7 100644 --- a/bacula/src/wx-console/authenticate.c +++ b/bacula/src/wx-console/authenticate.c @@ -68,11 +68,11 @@ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons) password = cons->password; /* TLS Requirement */ if (cons->tls_enable) { - if (cons->tls_require) { - tls_local_need = BNET_TLS_REQUIRED; - } else { - tls_local_need = BNET_TLS_OK; - } + if (cons->tls_require) { + tls_local_need = BNET_TLS_REQUIRED; + } else { + tls_local_need = BNET_TLS_OK; + } } tls_ctx = cons->tls_ctx; @@ -81,11 +81,11 @@ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons) password = director->password; /* TLS Requirement */ if (director->tls_enable) { - if (director->tls_require) { - tls_local_need = BNET_TLS_REQUIRED; - } else { - tls_local_need = BNET_TLS_OK; - } + if (director->tls_require) { + tls_local_need = BNET_TLS_REQUIRED; + } else { + tls_local_need = BNET_TLS_OK; + } } tls_ctx = director->tls_ctx; @@ -99,30 +99,28 @@ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons) if (!cram_md5_get_auth(dir, password, &tls_remote_need) || !cram_md5_auth(dir, password, tls_local_need)) { goto bail_out; - } + } /* Verify that the remote host is willing to meet our TLS requirements */ if (tls_remote_need < tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) { - csprint(_("Authorization problem:" - " Remote server did not advertise required TLS support.\n")); + csprint(_("Authorization problem: Remote server did not advertise required TLS support.\n")); goto bail_out; } /* Verify that we are willing to meet the remote host's requirements */ if (tls_remote_need > tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) { - csprint(_("Authorization problem:" - " Remote server requires TLS.\n")); + csprint(_("Authorization problem: Remote server requires TLS.\n")); goto bail_out; } /* Is TLS Enabled? */ if (have_tls) { if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) { - /* Engage TLS! Full Speed Ahead! */ - if (!bnet_tls_client(tls_ctx, dir)) { + /* Engage TLS! Full Speed Ahead! */ + if (!bnet_tls_client(tls_ctx, dir)) { csprint(_("TLS negotiation failed\n")); - goto bail_out; - } + goto bail_out; + } } }