]> git.sur5r.net Git - bacula/bacula/commitdiff
Win32 tweaks
authorKern Sibbald <kern@sibbald.com>
Fri, 19 Aug 2005 15:36:13 +0000 (15:36 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 19 Aug 2005 15:36:13 +0000 (15:36 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2341 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/autoconf/configure.in
bacula/configure
bacula/src/baconfig.h
bacula/src/console/authenticate.c
bacula/src/lib/cram-md5.c
bacula/src/win32/compat/winconfig.h
bacula/src/wx-console/authenticate.c

index 0f7242eb2b9e5f59ff603003f46d2c4f3bf34513..1b7f6dbba117968140d5e213d6bf6441a0293f67 100644 (file)
@@ -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 <tcpd.h>
             int deny_severity = 0;
index 79b433695794e65928ef802117f1dcd23f5ba2ca..4f3ccdb45fdae04f1088508afea7bdb22e473d25 100755 (executable)
@@ -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
index 04dc8c6617aeeee2575bb238800111c7a90758f9..20791eefb76e63ecef5a5abfc6cccfba208b4e86 100644 (file)
@@ -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 <libintl.h>
    #include <locale.h>
index fcbed7b946af4fd9f0a964513ef4492670fcd37d..52b6f2ad9af86378d00e3a989f38d49292d89d96 100644 (file)
  *
  */
 /*
-   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"
index 540ae5b4afacddf57d2d7edb3d319066cc1e5291..c0f898ec1c65131d3bc679c7d4e1cac2b1485f14 100644 (file)
@@ -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;
index fe70abbce1859ce0d0efb993c5cd576134fc8682..ebbc55f36078b2d64c3d9a1f501dc195ebb810cd 100644 (file)
 /* 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
 /* 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 <sys/stat.h> do not work properly. */
index bf2994b3cce65a3fd47e6d69e8fdea2871461e22..fcab7be0c7f389536bd207732e88be2bca0898ee 100644 (file)
@@ -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;
+        }
       }
    }