]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/job.c
Fix broken editing code
[bacula/bacula] / bacula / src / stored / job.c
index 187f4639ec671f1517c6a3ab22c7e67190785890..4bb402fc4edad28e74f1bebca8f42aa9e46d262c 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -134,8 +134,8 @@ bool job_cmd(JCR *jcr)
    unbash_spaces(fileset_name);
    jcr->fileset_name = get_pool_memory(PM_NAME);
    pm_strcpy(jcr->fileset_name, fileset_name);
-   jcr->JobType = JobType;
-   jcr->JobLevel = level;
+   jcr->set_JobType(JobType);
+   jcr->set_JobLevel(level);
    jcr->no_attributes = no_attributes;
    jcr->spool_attributes = spool_attributes;
    jcr->spool_data = spool_data;
@@ -146,7 +146,6 @@ bool job_cmd(JCR *jcr)
    jcr->PreferMountedVols = PreferMountedVols;
 
    jcr->authenticated = false;
-   jcr->need_fd = true;
 
    /*
     * Pass back an authorization key for the File daemon
@@ -154,7 +153,7 @@ bool job_cmd(JCR *jcr)
    bsnprintf(seed, sizeof(seed), "%p%d", jcr, JobId);
    make_session_key(auth_key, seed, 1);
    dir->fsend(OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
-   Dmsg2(100, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg);
+   Dmsg2(50, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg);
    jcr->sd_auth_key = bstrdup(auth_key);
    memset(auth_key, 0, sizeof(auth_key));
    generate_daemon_event(jcr, "JobStart");
@@ -174,7 +173,7 @@ bool run_cmd(JCR *jcr)
    /* If we do not need the FD, we are doing a migrate, copy, or virtual
     *   backup.
     */
-   if (!jcr->need_fd) {
+   if (jcr->no_client_used()) {
       do_mac(jcr);
       return false;
    }
@@ -186,7 +185,7 @@ bool run_cmd(JCR *jcr)
    timeout.tv_nsec = tv.tv_usec * 1000;
    timeout.tv_sec = tv.tv_sec + me->client_wait;
 
-   Dmsg3(050, "%s waiting %d sec for FD to contact SD key=%s\n",
+   Dmsg3(50, "%s waiting %d sec for FD to contact SD key=%s\n",
          jcr->Job, (int)(timeout.tv_sec-time(NULL)), jcr->sd_auth_key);
 
    /*
@@ -201,14 +200,14 @@ bool run_cmd(JCR *jcr)
          break;
       }
    }
-   Dmsg3(100, "Auth=%d canceled=%d errstat=%d\n", jcr->authenticated,
+   Dmsg3(50, "Auth=%d canceled=%d errstat=%d\n", jcr->authenticated,
       job_canceled(jcr), errstat);
    V(mutex);
 
    memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
 
    if (jcr->authenticated && !job_canceled(jcr)) {
-      Dmsg1(100, "Running job %s\n", jcr->Job);
+      Dmsg1(50, "Running job %s\n", jcr->Job);
       run_job(jcr);                   /* Run the job */
    }
    return false;
@@ -230,30 +229,35 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
    if (!(jcr=get_jcr_by_full_name(job_name))) {
       Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name);
       Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
+      fd->close();
       return;
    }
 
-   jcr->file_bsock = fd;
-   jcr->file_bsock->set_jcr(jcr);
 
-   Dmsg1(110, "Found Job %s\n", job_name);
+   Dmsg1(50, "Found Job %s\n", job_name);
 
    if (jcr->authenticated) {
       Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s already authenticated.\n"),
          (uint32_t)jcr->JobId, jcr->Job);
+      Dmsg2(50, "Hey!!!! JobId %u Job %s already authenticated.\n",
+         (uint32_t)jcr->JobId, jcr->Job);
+      fd->close();
       free_jcr(jcr);
       return;
    }
 
+   jcr->file_bsock = fd;
+   jcr->file_bsock->set_jcr(jcr);
+
    /*
     * Authenticate the File daemon
     */
    if (jcr->authenticated || !authenticate_filed(jcr)) {
-      Dmsg1(100, "Authentication failed Job %s\n", jcr->Job);
+      Dmsg1(50, "Authentication failed Job %s\n", jcr->Job);
       Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
    } else {
       jcr->authenticated = true;
-      Dmsg2(110, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
+      Dmsg2(50, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
    }
 
    if (!jcr->authenticated) {
@@ -366,6 +370,8 @@ void stored_free_jcr(JCR *jcr)
       free_bsr(jcr->bsr);
       jcr->bsr = NULL;
    }
+   /* Free any restore volume list created */
+   free_restore_volume_list(jcr);
    if (jcr->RestoreBootstrap) {
       unlink(jcr->RestoreBootstrap);
       free_pool_memory(jcr->RestoreBootstrap);