]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #7770 About the full restore client name displayed in the restore job status
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Mon, 7 Jun 2021 06:00:40 +0000 (08:00 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:02 +0000 (09:03 +0100)
bacula/src/dird/restore.c

index ddaba6ba722c8354072de31d405f1f69f00800dd..cddf5b427726d7ce141efdbd9fc1ab7be5add13c 100644 (file)
@@ -642,6 +642,7 @@ bool do_restore_init(JCR *jcr)
 void restore_cleanup(JCR *jcr, int TermCode)
 {
    POOL_MEM where;
+   CLIENT_DBR cr;
    char creplace;
    const char *replace = NULL;
    char sdt[MAX_TIME_LENGTH], edt[MAX_TIME_LENGTH];
@@ -655,6 +656,13 @@ void restore_cleanup(JCR *jcr, int TermCode)
    Dmsg0(20, "In restore_cleanup\n");
    update_job_end(jcr, TermCode);
 
+   memset(&cr, 0, sizeof(cr));
+   bstrncpy(cr.Name, jcr->client->name(), sizeof(cr.Name));
+   if (!db_get_client_record(jcr, jcr->db, &cr)) {
+      Jmsg(jcr, M_WARNING, 0, _("Error getting Client record for Job report: ERR=%s"),
+         db_strerror(jcr->db));
+   }
+
    if (jcr->component_fd) {
       fclose(jcr->component_fd);
       jcr->component_fd = NULL;
@@ -733,7 +741,7 @@ void restore_cleanup(JCR *jcr, int TermCode)
 "  Build OS:               %s %s %s\n"
 "  JobId:                  %d\n"
 "  Job:                    %s\n"
-"  Restore Client:         %s\n"
+"  Restore Client:         \"%s\" %s\n"
 "  Where:                  %s\n"
 "  Replace:                %s\n"
 "  Start time:             %s\n"
@@ -751,7 +759,7 @@ void restore_cleanup(JCR *jcr, int TermCode)
         HOST_OS, DISTNAME, DISTVER,
         jcr->jr.JobId,
         jcr->jr.Job,
-        jcr->client->name(),
+        jcr->client->name(), cr.Uname,
         where.c_str(),
         replace,
         sdt,