]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #9305 At restore time, show wrong Backup Client when modifying client
authorAlain Spineux <alain@baculasystems.com>
Tue, 5 Jul 2022 10:35:30 +0000 (12:35 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:58 +0000 (13:56 +0200)
There is two values :
Backup Client: this is related to the backup job, then this is immutable as the job already ran
Restore Client: this is related to the restore, this can change

In a "normal" restore, the values that are assigned are as follow :

Backup Client:  rc.client ? rc.client->hdr.name : jcr->job->client->hdr.name
Restore Client: jcr->client->name()

We can see the values that have changed before and after the "mod"

ua_run.c:173-0 ASX rc.client=0x55af0c0d5aa8 jcr->job->client->hdr.name=1-fd rc.client->hdr.name=1-fd jcr->client->name()=1-fd
ua_run.c:173-0 ASX rc.client=0x55af0c0d7eb8 jcr->job->client->hdr.name=1-fd rc.client->hdr.name=2-fd jcr->client->name()=2-fd

The value jcr->job->client->hdr.name did not change has expected (it should be immutable) and should be used instead of the conditional for the "Backup Client" value

When doing the mod, the code does

      case 4:
         /* Client */
      {
         int32_t jt = rc.job ? rc.job->JobType : JT_SYSTEM;
         rc.client = select_client_resource(ua, jt);
         if (rc.client) {
            jcr->client = rc.client;
            goto try_again;
         }
      }

Then both the rc.client and the jcr->client are modified

I think the right solution is just to use
  jcr->job->client->hdr.name
instead of the conditional
  rc.client ? rc.client->hdr.name : jcr->job->client->hdr.name

bacula/src/dird/ua_run.c

index d014d93e3602afce8d309375c5f3dfc7b9b52704..05467a3eb9ea6ba2778d4a35af14706fddff230e 100644 (file)
@@ -173,7 +173,7 @@ int run_cmd(UAContext *ua, const char *cmd)
        *   allow him to modify them.
        */
       if (!display_job_parameters(ua, jcr, rc.job, rc.verify_list, rc.jid, rc.replace,
-           rc.client ? rc.client->hdr.name : jcr->job->client->hdr.name)) {
+           jcr->job->client->hdr.name)) {
          break; /* error get out of while loop */
       }