]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/catreq.c
kes Update copyright date in program files, and for the most part
[bacula/bacula] / bacula / src / dird / catreq.c
index 06ed35937b67a571390dbbfaaf11dbc71315a811..3dd8a582124f1b3a1bf3c12c77585f8585b837e1 100644 (file)
@@ -123,7 +123,7 @@ void catalog_request(JCR *jcr, BSOCK *bs)
       ok = db_get_pool_record(jcr, jcr->db, &pr);
       if (ok) {
          mr.PoolId = pr.PoolId;
-         mr.StorageId = jcr->store->StorageId;
+         mr.StorageId = jcr->wstore->StorageId;
          ok = find_next_volume_for_append(jcr, &mr, index, true /*permit create new vol*/);
          Dmsg3(100, "find_media idx=%d ok=%d vol=%s\n", index, ok, mr.VolumeName);
       }
@@ -162,7 +162,7 @@ void catalog_request(JCR *jcr, BSOCK *bs)
              */
             if (mr.PoolId != jcr->jr.PoolId) {
                reason = _("not in Pool");
-            } else if (strcmp(mr.MediaType, jcr->store->media_type) != 0) {
+            } else if (strcmp(mr.MediaType, jcr->wstore->media_type) != 0) {
                reason = _("not correct MediaType");
             } else {
                /*
@@ -221,6 +221,9 @@ void catalog_request(JCR *jcr, BSOCK *bs)
       if (label || mr.LabelDate == 0) {
          mr.LabelDate = jcr->start_time;
          mr.set_label_date = true;
+         if (mr.InitialWrite == 0) {
+            mr.InitialWrite = jcr->start_time;
+         }
          Dmsg2(400, "label=%d labeldate=%d\n", label, mr.LabelDate);
       } else {
          /*
@@ -252,8 +255,8 @@ void catalog_request(JCR *jcr, BSOCK *bs)
       mr.VolWriteTime = sdmr.VolWriteTime;
       mr.VolParts     = sdmr.VolParts;
       bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
-      if (jcr->store->StorageId) {
-         mr.StorageId = jcr->store->StorageId;
+      if (jcr->wstore->StorageId) {
+         mr.StorageId = jcr->wstore->StorageId;
       }
 
       Dmsg2(400, "db_update_media_record. Stat=%s Vol=%s\n", mr.VolStatus, mr.VolumeName);
@@ -279,8 +282,8 @@ void catalog_request(JCR *jcr, BSOCK *bs)
       &jm.FirstIndex, &jm.LastIndex, &jm.StartFile, &jm.EndFile,
       &jm.StartBlock, &jm.EndBlock, &jm.Copy, &Stripe) == 9) {
 
-      if (jcr->previous_jcr) {
-         jm.JobId = jcr->previous_jcr->JobId;
+      if (jcr->mig_jcr) {
+         jm.JobId = jcr->mig_jcr->JobId;
          jm.MediaId = jcr->MediaId;
       } else {
          jm.JobId = jcr->JobId;
@@ -394,8 +397,8 @@ void catalog_update(JCR *jcr, BSOCK *bs)
       ar->FileIndex = FileIndex;
       ar->Stream = Stream;
       ar->link = NULL;
-      if (jcr->previous_jcr) {
-         ar->JobId = jcr->previous_jcr->JobId;
+      if (jcr->mig_jcr) {
+         ar->JobId = jcr->mig_jcr->JobId;
       } else {
          ar->JobId = jcr->JobId;
       }
@@ -412,7 +415,7 @@ void catalog_update(JCR *jcr, BSOCK *bs)
          Jmsg(jcr, M_WARNING, 0, _("Got %s but not same File as attributes\n"), stream_to_ascii(Stream));
       } else {
          /* Update digest in catalog */
-         char digestbuf[CRYPTO_DIGEST_MAX_SIZE];
+         char digestbuf[BASE64_SIZE(CRYPTO_DIGEST_MAX_SIZE)];
          int len = 0;
          int type = CRYPTO_DIGEST_NONE;
 
@@ -439,7 +442,7 @@ void catalog_update(JCR *jcr, BSOCK *bs)
                  Stream);
          }
 
-         bin_to_base64(digestbuf, fname, len);
+         bin_to_base64(digestbuf, sizeof(digestbuf), fname, len, true);
          Dmsg3(400, "DigestLen=%d Digest=%s type=%d\n", strlen(digestbuf), digestbuf, Stream);
          if (jcr->cached_attribute) {
             ar->Digest = digestbuf;