]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/verify_vol.c
Merge branch 'master' into basejobv3
[bacula/bacula] / bacula / src / filed / verify_vol.c
index b468584903d0fd0fc76a532918771b8fa8b73ae1..7a9e88eac9dbf67a3181f4b1c93392312b9b2f55 100644 (file)
@@ -8,24 +8,32 @@
  *
  */
 /*
-   Copyright (C) 2000-2004 Kern Sibbald and John Walker
+   Bacula® - The Network Backup Solution
 
-   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.
+   Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
+
+   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.
 
-   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.
+   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., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
- */
+   Bacula® is a registered trademark of Kern Sibbald.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 
 #include "bacula.h"
 #include "filed.h"
@@ -191,6 +199,11 @@ void do_verify_volume(JCR *jcr)
             stat = bnet_fsend(dir, "%d %d %s %s%c%s%c%s%c", jcr->JobFiles,
                           STREAM_UNIX_ATTRIBUTES, "pinsug5", fname,
                           0, ap, 0, lname, 0);
+         /* for a deleted record, we set fileindex=0 */
+         } else if (type == FT_DELETED)  {
+            stat = bnet_fsend(dir,"%d %d %s %s%c%s%c%c", 0,
+                          STREAM_UNIX_ATTRIBUTES, "pinsug5", fname,
+                          0, ap, 0, 0);
          } else {
             stat = bnet_fsend(dir,"%d %d %s %s%c%s%c%c", jcr->JobFiles,
                           STREAM_UNIX_ATTRIBUTES, "pinsug5", fname,
@@ -203,21 +216,8 @@ void do_verify_volume(JCR *jcr)
          }
          break;
 
-      /* Data streams to ignore */
-      case STREAM_ENCRYPTED_SESSION_DATA:
-      case STREAM_FILE_DATA:
-      case STREAM_SPARSE_DATA:
-      case STREAM_WIN32_DATA:
-      case STREAM_WIN32_GZIP_DATA:
-      case STREAM_GZIP_DATA:
-      case STREAM_SPARSE_GZIP_DATA:
-      case STREAM_SIGNED_DIGEST:
-
-        /* Do nothing */
-        break;
-
       case STREAM_MD5_DIGEST:
-         bin_to_base64(digest, (char *)sd->msg, CRYPTO_DIGEST_MD5_SIZE);
+         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_MD5_SIZE, true);
          Dmsg2(400, "send inx=%d MD5=%s\n", jcr->JobFiles, digest);
          bnet_fsend(dir, "%d %d %s *MD5-%d*", jcr->JobFiles, STREAM_MD5_DIGEST, digest,
                     jcr->JobFiles);
@@ -225,7 +225,7 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_SHA1_DIGEST:
-         bin_to_base64(digest, (char *)sd->msg, CRYPTO_DIGEST_SHA1_SIZE);
+         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_SHA1_SIZE, true);
          Dmsg2(400, "send inx=%d SHA1=%s\n", jcr->JobFiles, digest);
          bnet_fsend(dir, "%d %d %s *SHA1-%d*", jcr->JobFiles, STREAM_SHA1_DIGEST,
                     digest, jcr->JobFiles);
@@ -233,7 +233,7 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_SHA256_DIGEST:
-         bin_to_base64(digest, (char *)sd->msg, CRYPTO_DIGEST_SHA256_SIZE);
+         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_SHA256_SIZE, true);
          Dmsg2(400, "send inx=%d SHA256=%s\n", jcr->JobFiles, digest);
          bnet_fsend(dir, "%d %d %s *SHA256-%d*", jcr->JobFiles, STREAM_SHA256_DIGEST,
                     digest, jcr->JobFiles);
@@ -241,16 +241,17 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_SHA512_DIGEST:
-         bin_to_base64(digest, (char *)sd->msg, CRYPTO_DIGEST_SHA512_SIZE);
+         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_SHA512_SIZE, true);
          Dmsg2(400, "send inx=%d SHA512=%s\n", jcr->JobFiles, digest);
          bnet_fsend(dir, "%d %d %s *SHA512-%d*", jcr->JobFiles, STREAM_SHA512_DIGEST,
                     digest, jcr->JobFiles);
          Dmsg2(20, "bfiled>bdird: SHA512 len=%d: msg=%s\n", dir->msglen, dir->msg);
          break;
 
+      /* Ignore everything else */
       default:
-         Pmsg2(0, "None of above!!! stream=%d data=%s\n", stream,sd->msg);
          break;
+
       } /* end switch */
    } /* end while bnet_get */
    set_jcr_job_status(jcr, JS_Terminated);