]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #7552 About running wrong jopy job
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Fri, 23 Apr 2021 12:47:22 +0000 (14:47 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
This issue might happen when the user had a backup job named "Backup1"
and later changed the type of the job from Type = Backup to Type = Copy.

bacula/src/dird/mac.c

index 1d4657a2b758ab39dd902df8ec03d9bae91640b5..2570e9d1c23c9eeb91d8d85512ddd7c196449378 100644 (file)
@@ -170,6 +170,14 @@ bool do_mac_init(JCR *jcr)
       return false;
    }
 
+   /* Check for bug #7552 - to be sure that user is doing the right thing */
+   if (prev_job->JobType != JT_BACKUP ||
+       prev_job->JobType != JT_JOB_COPY ||
+       prev_job->JobType != JT_MIGRATED_JOB) {
+      Jmsg(jcr, M_FATAL, 0, _("Unexpected type ('%c') of job to copy:\"%s\".\n"),
+           prev_job->JobType, jcr->previous_jr.Name);
+      return false;
+   }
 
    /* Create a write jcr */
    wjcr = jcr->wjcr = new_jcr(sizeof(JCR), dird_free_jcr);