]> git.sur5r.net Git - bacula/bacula/commitdiff
Remove the USE_WIN32STREAMEXTRACTION #defines (always on)
authorKern Sibbald <kern@sibbald.com>
Sun, 13 Nov 2005 10:24:12 +0000 (10:24 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 13 Nov 2005 10:24:12 +0000 (10:24 +0000)
  and correct a few minor problems to make it build on Linux.
- Turn off API debug output unless debug set to avoid confusing
  the user.
- Add Solaris ACL detection in configure.in as supplied by
  Attila Fulop.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2578 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/autoconf/configure.in
bacula/configure
bacula/kes-1.38
bacula/kes-1.39
bacula/src/filed/restore.c
bacula/src/filed/status.c
bacula/src/findlib/bfile.c
bacula/src/findlib/bfile.h
bacula/src/version.h

index 6413c03c8140616e6d922fee2343c013c6c984dd..44c232f29e7a219c8b546eac054a42301d2e79af 100644 (file)
@@ -1572,10 +1572,15 @@ if test x$FDLIBS = x-lz; then
   have_zlib=yes
 fi
 
+#
+# Check for ACL libraries
+#
 have_acl=no
 AC_CHECK_HEADER(sys/acl.h)
 AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
-       [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"])]
+   [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"], 
+      [AC_CHECK_LIB(sec, acltotext, [have_acl=yes; FDLIBS="-lsec $FDLIBS"])]
+    )]
 )
 if test $have_acl = yes; then
    AC_DEFINE(HAVE_ACL)
@@ -1584,11 +1589,11 @@ fi
 dnl Check for pthread libraries
 PTHREAD_LIB=""
 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
-       [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
-           [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
-               [AC_CHECK_FUNC(pthread_create)]
-           )]
-       )]
+   [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
+      [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
+           [AC_CHECK_FUNC(pthread_create)]
+       )]
+    )]
 )
 
 AC_SUBST(FDLIBS)
index 29d8cce255a8e88856ff0ad564a0ce2a71270ad8..a19250e0d583f5137991ad4a8f690c23c62a30c7 100755 (executable)
@@ -28770,6 +28770,9 @@ _ACEOF
   have_zlib=yes
 fi
 
+#
+# Check for ACL libraries
+#
 have_acl=no
 if test "${ac_cv_header_sys_acl_h+set}" = set; then
   echo "$as_me:$LINENO: checking for sys/acl.h" >&5
@@ -29069,6 +29072,76 @@ echo "$as_me:$LINENO: result: $ac_cv_lib_acl_acl_get_file" >&5
 echo "${ECHO_T}$ac_cv_lib_acl_acl_get_file" >&6
 if test $ac_cv_lib_acl_acl_get_file = yes; then
   have_acl=yes; FDLIBS="-lacl $FDLIBS"
+else
+  echo "$as_me:$LINENO: checking for acltotext in -lsec" >&5
+echo $ECHO_N "checking for acltotext in -lsec... $ECHO_C" >&6
+if test "${ac_cv_lib_sec_acltotext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsec  $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 acltotext ();
+int
+main ()
+{
+acltotext ();
+  ;
+  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_lib_sec_acltotext=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_sec_acltotext=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_sec_acltotext" >&5
+echo "${ECHO_T}$ac_cv_lib_sec_acltotext" >&6
+if test $ac_cv_lib_sec_acltotext = yes; then
+  have_acl=yes; FDLIBS="-lsec $FDLIBS"
+fi
+
+
 fi
 
 
index 9ef3e1b1b48e0292086feaa6d7a2179b56aba977..b02bbeecc41e750bd492b0959c538d1c51bb6164 100644 (file)
@@ -4,6 +4,11 @@
 General:
 
 Changes to 1.38.1:
+13Oct05
+- Turn off API debug output unless debug set to avoid confusing
+  the user.
+- Add Solaris ACL detection in configure.in as supplied by
+  Attila Fulop. 
 12Oct05
 - Implement "autochanger drives" protocol so that Dir knows
   how many drives an autochanger has.
index 62a4e567c44b11c39898fcdd7baed6a22d835e6d..5b12fec13ca50282a552a8517fb44ac94801676b 100644 (file)
@@ -4,6 +4,10 @@
 General:
 
 Changes to 1.39.0:
+13Oct05
+- Remove the USE_WIN32STREAMEXTRACTION #defines (always on)
+  and correct a few minor problems to make it build on Linux.
+10Oct05
 - Remove delete of CVS from all Makefiles
 - Fix seg fault when clicking on Add button in wx-console
   restore panel.  Bug #470.
index 1ac1d634a9daac180bf4e6cc3fc21626a5932a55..f218a6a7e1b0c8da28ade955cd4d36ef9cdbce94 100644 (file)
@@ -227,7 +227,7 @@ void do_restore(JCR *jcr)
 
          attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI);
 
-         if (!is_stream_supported(attr->data_stream)) {
+         if (!is_restore_stream_supported(attr->data_stream)) {
             if (!non_support_data++) {
                Jmsg(jcr, M_ERROR, 0, _("%s stream not supported on this Client.\n"),
                   stream_to_ascii(attr->data_stream));
@@ -541,7 +541,6 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
       Dmsg2(30, "Write %u bytes, total before write=%s\n", wsize, edit_uint64(jcr->JobBytes, ec1));
    }
 
-#ifdef USE_WIN32STREAMEXTRACTION
    if (flags & FO_WIN32DECOMP) {
       if (!processWin32BackupAPIBlock(bfd, wbuf, wsize)) {
          berrno be;
@@ -549,10 +548,7 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
                jcr->last_fname, be.strerror(bfd->berrno));
          return -1;
       }
-   }
-   else
-#endif
-   if (bwrite(bfd, wbuf, wsize) != (ssize_t)wsize) {
+   } else if (bwrite(bfd, wbuf, wsize) != (ssize_t)wsize) {
       berrno be;
       Jmsg2(jcr, M_ERROR, 0, _("Write error on %s: %s\n"), 
             jcr->last_fname, be.strerror(bfd->berrno));
index 01327e441d632151c704ff7368359906503f14ae..fdeb2abf57f58690018a8fc633883c2266e922f2 100755 (executable)
@@ -72,7 +72,7 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a
         dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
    sendit(msg, len, arg);
 #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
-   if (/*debug_level > 0*/ true) {
+   if (debug_level > 0) {
       if (!privs) {
          privs = enable_backup_privileges(NULL, 1);
       }
index e1ca62b9924126bf9852c0309a94d2de66d6960c..691dd314e86e1de1e63ec118965c28a0c3960158 100644 (file)
@@ -92,22 +92,21 @@ const char *stream_to_ascii(int stream)
    }
 }
 
-#ifdef USE_WIN32STREAMEXTRACTION
    
 void int64_LE2BE(int64_t* pBE, const int64_t v)
 {
    /* convert little endian to big endian */
    if (htonl(1) != 1L) { /* no work if on little endian machine */
-          memcpy(pBE, &v, sizeof(int64_t));
+           memcpy(pBE, &v, sizeof(int64_t));
    } else {
-          int i;
-          uint8_t rv[sizeof(int64_t)];
-          uint8_t *pv = (uint8_t *) &v;
-
-          for (i = 0; i < 8; i++) {
-             rv[i] = pv[7 - i];
-          }
-          memcpy(pBE, &rv, sizeof(int64_t));
+           int i;
+           uint8_t rv[sizeof(int64_t)];
+           uint8_t *pv = (uint8_t *) &v;
+
+           for (i = 0; i < 8; i++) {
+              rv[i] = pv[7 - i];
+           }
+           memcpy(pBE, &rv, sizeof(int64_t));
    }    
 }
 
@@ -116,21 +115,21 @@ void int32_LE2BE(int32_t* pBE, const int32_t v)
 {
    /* convert little endian to big endian */
    if (htonl(1) != 1L) { /* no work if on little endian machine */
-          memcpy(pBE, &v, sizeof(int32_t));
+           memcpy(pBE, &v, sizeof(int32_t));
    } else {
-          int i;
-          uint8_t rv[sizeof(int32_t)];
-          uint8_t *pv = (uint8_t *) &v;
-
-          for (i = 0; i < 4; i++) {
-             rv[i] = pv[3 - i];
-          }
-          memcpy(pBE, &rv, sizeof(int32_t));
+           int i;
+           uint8_t rv[sizeof(int32_t)];
+           uint8_t *pv = (uint8_t *) &v;
+
+           for (i = 0; i < 4; i++) {
+              rv[i] = pv[3 - i];
+           }
+           memcpy(pBE, &rv, sizeof(int32_t));
    }    
 }
 
 
-BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
+bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize)
 {   
    /* pByte contains the buffer 
       dwSize the len to be processed.  function assumes to be
@@ -139,7 +138,7 @@ BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
     */
 
    PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT* pContext = &(bfd->win32DecompContext);
-   bool bContinue = FALSE;
+   bool bContinue = false;
    int64_t dwDataOffset = 0;
    int64_t dwDataLen;
 
@@ -151,7 +150,7 @@ BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
    do {               
       if (pContext->liNextHeader >= dwSize) {                        
          dwDataLen = dwSize-dwDataOffset;
-         bContinue = FALSE; /* 1 iteration is enough */
+         bContinue = false; /* 1 iteration is enough */
       }
       else {                        
          dwDataLen = pContext->liNextHeader-dwDataOffset;
@@ -161,8 +160,8 @@ BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
       /* flush */
       /* copy block of real DATA */
       if (pContext->bIsInData) {
-         if (bwrite(bfd, ((LPBYTE)pBuffer)+dwDataOffset, dwDataLen) != (ssize_t)dwDataLen)            
-            return FALSE;         
+         if (bwrite(bfd, ((char *)pBuffer)+dwDataOffset, dwDataLen) != (ssize_t)dwDataLen)
+            return false;         
       }
 
       if (pContext->liNextHeader < dwSize) {/* is a header in this block ? */
@@ -189,15 +188,15 @@ BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
             /* header (or rest of header) is completely available
                in current block 
              */
-            bHeaderIsComplete = TRUE;                                                        
+            bHeaderIsComplete = true;
          else  {
             /* header will continue in next block */
-            bHeaderIsComplete = FALSE;
+            bHeaderIsComplete = false;
             dwHeaderPartLen = dwSize-dwOffsetSource;
          }
 
          /* copy the available portion of header to persistent copy */
-         memcpy (((LPBYTE) &pContext->header_stream)+dwOffsetTarget, ((LPBYTE) pBuffer)+dwOffsetSource, dwHeaderPartLen);
+         memcpy(((char *)&pContext->header_stream)+dwOffsetTarget, ((char *)pBuffer)+dwOffsetSource, dwHeaderPartLen);
 
          /* recalculate position of next header */
          if (bHeaderIsComplete) {
@@ -210,14 +209,14 @@ BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
             int64_LE2BE (&(pContext->liNextHeader), pContext->header_stream.Size);
             pContext->liNextHeader += dwDataOffset;
 
-            pContext->bIsInData = pContext->header_stream.dwStreamId == BACKUP_DATA;
+            pContext->bIsInData = pContext->header_stream.dwStreamId == WIN32_BACKUP_DATA;
             if (dwDataOffset == dwSize)
-                  bContinue = FALSE;
+                  bContinue = false;
          }
          else {
             /* stop and continue with next block */
-            bContinue = FALSE;
-            pContext->bIsInData = FALSE;
+            bContinue = false;
+            pContext->bIsInData = false;
          }
       }                
    } while (bContinue);    
@@ -227,7 +226,6 @@ BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize)
 
    return TRUE;
 }
-#endif
 
 
 
@@ -298,20 +296,13 @@ bool have_win32_api()
 /*
  * Return true  if we support the stream
  *        false if we do not support the stream
+ *
+ *  This code is running under Win32, so we
+ *    do not need #ifdef on MACOS ...
  */
-bool is_stream_supported(int stream)
+bool is_restore_stream_supported(int stream)
 {
-   /* With Win32 backup on this machine */
    switch (stream) {
-   case STREAM_WIN32_DATA:
-#ifdef HAVE_ZLIB
-   case STREAM_WIN32_GZIP_DATA:
-#endif
-#ifdef USE_WIN32STREAMEXTRACTION
-      return true;
-#else
-      return have_win32_api();      
-#endif
 
 /* Streams known not to be supported */
 #ifndef HAVE_LIBZ
@@ -327,7 +318,9 @@ bool is_stream_supported(int stream)
 #ifdef HAVE_LIBZ
    case STREAM_GZIP_DATA:
    case STREAM_SPARSE_GZIP_DATA:
+   case STREAM_WIN32_GZIP_DATA:
 #endif
+   case STREAM_WIN32_DATA:
    case STREAM_UNIX_ATTRIBUTES:
    case STREAM_FILE_DATA:
    case STREAM_MD5_SIGNATURE:
@@ -472,10 +465,8 @@ int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
    }
    bfd->errmsg = NULL;
    bfd->lpContext = NULL;
-#ifdef USE_WIN32STREAMEXTRACTION
-   bfd->win32DecompContext.bIsInData = FALSE;
+   bfd->win32DecompContext.bIsInData = false;
    bfd->win32DecompContext.liNextHeader = 0;
-#endif
    free_pool_memory(win32_fname_wchar);
    free_pool_memory(win32_fname);
    return bfd->mode == BF_CLOSED ? -1 : 1;
@@ -674,8 +665,10 @@ bool set_prog(BFILE *bfd, char *prog, JCR *jcr)
 
 }
 
-
-bool is_stream_supported(int stream)
+/* 
+ * This code is running on a non-Win32 machine 
+ */
+bool is_restore_stream_supported(int stream)
 {
    /* No Win32 backup on this machine */
      switch (stream) {
@@ -684,9 +677,6 @@ bool is_stream_supported(int stream)
    case STREAM_SPARSE_GZIP_DATA:
    case STREAM_WIN32_GZIP_DATA:    
 #endif
-#ifndef USE_WIN32STREAMEXTRACTION
-   case STREAM_WIN32_DATA:
-#endif
 #ifndef HAVE_DARWIN_OS
    case STREAM_MACOS_FORK_DATA:
    case STREAM_HFSPLUS_ATTRIBUTES:
@@ -697,13 +687,9 @@ bool is_stream_supported(int stream)
 #ifdef HAVE_LIBZ
    case STREAM_GZIP_DATA:
    case STREAM_SPARSE_GZIP_DATA:
-#endif
-#ifdef USE_WIN32STREAMEXTRACTION
-   case STREAM_WIN32_DATA:
-# ifdef HAVE_LIBZ 
    case STREAM_WIN32_GZIP_DATA:    
-# endif
 #endif
+   case STREAM_WIN32_DATA:
    case STREAM_UNIX_ATTRIBUTES:
    case STREAM_FILE_DATA:
    case STREAM_MD5_SIGNATURE:
@@ -737,10 +723,8 @@ int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
    Dmsg1(400, "Open file %d\n", bfd->fid);
    errno = bfd->berrno;
 
-#ifdef USE_WIN32STREAMEXTRACTION
-   bfd->win32DecompContext.bIsInData = FALSE;
+   bfd->win32DecompContext.bIsInData = false;
    bfd->win32DecompContext.liNextHeader = 0;
-#endif
 
    return bfd->fid;
 }
index 4a4f69469a9034150c592f7f0e5ea4e9968bee77..dc724fa7d431e27e94b32d9295c4b99cc54cd2e1 100644 (file)
@@ -36,13 +36,14 @@ struct Python_IO {
 };
 #endif
 
-#ifdef USE_WIN32STREAMEXTRACTION
 
 /* this should physically correspond to WIN32_STREAM_ID
  * from winbase.h on Win32. We didn't inlcude cStreamName
  * as we don't use it and don't need it for a correct struct size.
  */
 
+#define WIN32_BACKUP_DATA 1
+
 typedef struct _BWIN32_STREAM_ID {
         int32_t        dwStreamId;
         int32_t        dwStreamAttributes;
@@ -56,7 +57,6 @@ typedef struct _PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT {
         bool             bIsInData;
         BWIN32_STREAM_ID header_stream;        
 } PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT;
-#endif
 
 /*  =======================================================
  *
@@ -91,10 +91,8 @@ struct BFILE {
    char *prog;                        /* reader/writer program if any */
    JCR *jcr;                          /* jcr for editing job codes */
    Python_IO pio;                     /* Python I/O routines */
-#ifdef USE_WIN32STREAMEXTRACTION
    PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT win32DecompContext; /* context for decomposition of win32 backup streams */
    int use_backup_decomp;             /* set if using BackupRead Stream Decomposition */
-#endif
 };
 
 HANDLE bget_handle(BFILE *bfd);
@@ -115,10 +113,8 @@ struct BFILE {
    char *prog;                        /* reader/writer program if any */
    JCR *jcr;                          /* jcr for editing job codes */
    Python_IO pio;                     /* Python I/O routines */
-#ifdef USE_WIN32STREAMEXTRACTION
    PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT win32DecompContext; /* context for decomposition of win32 backup streams */
    int use_backup_decomp;             /* set if using BackupRead Stream Decomposition */
-#endif
 };
 
 #endif
@@ -130,7 +126,7 @@ bool    set_portable_backup(BFILE *bfd);
 bool    set_prog(BFILE *bfd, char *prog, JCR *jcr);
 bool    have_win32_api();
 bool    is_portable_backup(BFILE *bfd);
-bool    is_stream_supported(int stream);
+bool    is_restore_stream_supported(int stream);
 bool    is_win32_stream(int stream);
 char   *xberror(BFILE *bfd);          /* DO NOT USE  -- use berrno class */
 int     bopen(BFILE *bfd, const char *fname, int flags, mode_t mode);
@@ -143,8 +139,6 @@ ssize_t bwrite(BFILE *bfd, void *buf, size_t count);
 off_t   blseek(BFILE *bfd, off_t offset, int whence);
 const char   *stream_to_ascii(int stream);
 
-#ifdef USE_WIN32STREAMEXTRACTION
-BOOL processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, size_t dwSize);
-#endif
+bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize);
 
 #endif /* __BFILE_H */
index b4a6fca7e3c3aebc8252e08ea4f2dcc1c92f08ce..f8c64a1678be93171987a5c65b54fa2a1d356338 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.39.0"
-#define BDATE   "12 November 2005"
-#define LSMDATE "12Nov05"
+#define BDATE   "13 November 2005"
+#define LSMDATE "13Nov05"
 
 /* Debug flags */
 #undef  DEBUG