+++ /dev/null
-Index: fd_cmds.c
-===================================================================
---- fd_cmds.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
-+++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -1,18 +1,4 @@
- /*
-- * This file handles commands from the File daemon.
-- *
-- * Kern Sibbald, MM
-- *
-- * We get here because the Director has initiated a Job with
-- * the Storage daemon, then done the same with the File daemon,
-- * then when the Storage daemon receives a proper connection from
-- * the File daemon, control is passed here to handle the
-- * subsequent File daemon commands.
-- *
-- * Version $Id$
-- *
-- */
--/*
- Bacula® - The Network Backup Solution
-
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
-@@ -39,6 +25,20 @@
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
- */
-+/*
-+ * This file handles commands from the File daemon.
-+ *
-+ * Kern Sibbald, MM
-+ *
-+ * We get here because the Director has initiated a Job with
-+ * the Storage daemon, then done the same with the File daemon,
-+ * then when the Storage daemon receives a proper connection from
-+ * the File daemon, control is passed here to handle the
-+ * subsequent File daemon commands.
-+ *
-+ * Version $Id$
-+ *
-+ */
-
- #include "bacula.h"
- #include "stored.h"
-@@ -120,7 +120,7 @@
-
- dir->set_jcr(jcr);
- Dmsg1(120, "Start run Job=%s\n", jcr->Job);
-- bnet_fsend(dir, Job_start, jcr->Job);
-+ dir->fsend(Job_start, jcr->Job);
- jcr->start_time = time(NULL);
- jcr->run_time = jcr->start_time;
- set_jcr_job_status(jcr, JS_Running);
-@@ -130,9 +130,9 @@
- dequeue_messages(jcr); /* send any queued messages */
- set_jcr_job_status(jcr, JS_Terminated);
- generate_daemon_event(jcr, "JobEnd");
-- bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
-+ dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
- edit_uint64(jcr->JobBytes, ec1));
-- bnet_sig(dir, BNET_EOD); /* send EOD to Director daemon */
-+ dir->signal(BNET_EOD); /* send EOD to Director daemon */
- return;
- }
-
-@@ -150,7 +150,7 @@
- int stat;
-
- /* Read command coming from the File daemon */
-- stat = bnet_recv(fd);
-+ stat = fd->recv();
- if (is_bnet_stop(fd)) { /* hardeof or error */
- break; /* connection terminated */
- }
-@@ -171,11 +171,11 @@
- }
- if (!found) { /* command not found */
- Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
-- bnet_fsend(fd, ferrmsg);
-+ fd->fsend(ferrmsg);
- break;
- }
- }
-- bnet_sig(fd, BNET_TERMINATE); /* signal to FD job is done */
-+ fd->signal(BNET_TERMINATE); /* signal to FD job is done */
- }
-
- /*
-@@ -195,10 +195,10 @@
- return true;
- } else {
- bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
-- bnet_fsend(fd, ERROR_append);
-+ fd->fsend(ERROR_append);
- }
- } else {
-- bnet_fsend(fd, NOT_opened);
-+ fd->fsend(NOT_opened);
- }
- return false;
- }
-@@ -209,11 +209,11 @@
-
- Dmsg1(120, "store<file: %s", fd->msg);
- if (!jcr->session_opened) {
-- bnet_fsend(fd, NOT_opened);
-+ fd->fsend(NOT_opened);
- return false;
- }
- set_jcr_job_status(jcr, JS_Terminated);
-- return bnet_fsend(fd, OK_end);
-+ return fd->fsend(OK_end);
- }
-
-
-@@ -227,14 +227,14 @@
-
- Dmsg1(120, "Append open session: %s", fd->msg);
- if (jcr->session_opened) {
-- bnet_fsend(fd, NO_open);
-+ fd->fsend(NO_open);
- return false;
- }
-
- jcr->session_opened = true;
-
- /* Send "Ticket" to File Daemon */
-- bnet_fsend(fd, OK_open, jcr->VolSessionId);
-+ fd->fsend(OK_open, jcr->VolSessionId);
- Dmsg1(110, ">filed: %s", fd->msg);
-
- return true;
-@@ -251,14 +251,14 @@
-
- Dmsg1(120, "<filed: %s", fd->msg);
- if (!jcr->session_opened) {
-- bnet_fsend(fd, NOT_opened);
-+ fd->fsend(NOT_opened);
- return false;
- }
- /* Send final statistics to File daemon */
-- bnet_fsend(fd, OK_close, jcr->JobStatus);
-+ fd->fsend(OK_close, jcr->JobStatus);
- Dmsg1(120, ">filed: %s", fd->msg);
-
-- bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
-+ fd->signal(BNET_EOD); /* send EOD to File daemon */
-
- jcr->session_opened = false;
- return true;
-@@ -279,7 +279,7 @@
- Dmsg1(120, "<bfiled: %s", fd->msg);
- return do_read_data(jcr);
- } else {
-- bnet_fsend(fd, NOT_opened);
-+ fd->fsend(NOT_opened);
- return false;
- }
- }
-@@ -296,7 +296,7 @@
-
- Dmsg1(120, "%s\n", fd->msg);
- if (jcr->session_opened) {
-- bnet_fsend(fd, NO_open);
-+ fd->fsend(NO_open);
- return false;
- }
-
-@@ -304,7 +304,7 @@
- &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
- &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
- if (jcr->session_opened) {
-- bnet_fsend(fd, NOT_opened);
-+ fd->fsend(NOT_opened);
- return false;
- }
- Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
-@@ -319,7 +319,7 @@
- jcr->JobType = JT_RESTORE;
-
- /* Send "Ticket" to File Daemon */
-- bnet_fsend(fd, OK_open, jcr->VolSessionId);
-+ fd->fsend(OK_open, jcr->VolSessionId);
- Dmsg1(110, ">filed: %s", fd->msg);
-
- return true;
-@@ -357,7 +357,7 @@
- goto bail_out;
- }
- Dmsg0(10, "=== Bootstrap file ===\n");
-- while (bnet_recv(sock) >= 0) {
-+ while (sock->recv() >= 0) {
- Dmsg1(10, "%s", sock->msg);
- fputs(sock->msg, bs);
- }
-@@ -378,10 +378,10 @@
- free_pool_memory(jcr->RestoreBootstrap);
- jcr->RestoreBootstrap = NULL;
- if (!ok) {
-- bnet_fsend(sock, ERROR_bootstrap);
-+ sock->fsend(ERROR_bootstrap);
- return false;
- }
-- return bnet_fsend(sock, OK_bootstrap);
-+ return sock->fsend(OK_bootstrap);
- }
-
-
-@@ -395,14 +395,14 @@
-
- Dmsg1(120, "Read close session: %s\n", fd->msg);
- if (!jcr->session_opened) {
-- bnet_fsend(fd, NOT_opened);
-+ fd->fsend(NOT_opened);
- return false;
- }
-- /* Send final statistics to File daemon */
-- bnet_fsend(fd, OK_close);
-+ /* Send final close msg to File daemon */
-+ fd->fsend(OK_close, jcr->JobStatus);
- Dmsg1(160, ">filed: %s\n", fd->msg);
-
-- bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
-+ fd->signal(BNET_EOD); /* send EOD to File daemon */
-
- jcr->session_opened = false;
- return true;
-Index: stored_conf.c
-===================================================================
---- stored_conf.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
-+++ stored_conf.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -75,7 +75,7 @@
- {"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
- {"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, 0, 0},
- {"scriptsdirectory", store_dir, ITEM(res_store.scripts_directory), 0, 0, 0},
-- {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 10},
-+ {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
- {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
- {"tlsenable", store_bit, ITEM(res_store.tls_enable), 1, 0, 0},
- {"tlsrequire", store_bit, ITEM(res_store.tls_require), 1, 0, 0},
-Index: bscan.c
-===================================================================
---- bscan.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
-+++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -120,7 +120,7 @@
- " -m update media info in database\n"
- " -n <name> specify the database name (default bacula)\n"
- " -u <user> specify database user name (default bacula)\n"
--" -P <password specify database password (default none)\n"
-+" -P <password> specify database password (default none)\n"
- " -h <host> specify database host (default NULL)\n"
- " -p proceed inspite of I/O errors\n"
- " -r list records\n"
-@@ -326,6 +326,7 @@
- mdcr->StartFile = dcr->StartFile;
- mdcr->EndBlock = dcr->EndBlock;
- mdcr->EndFile = dcr->EndFile;
-+ mdcr->VolMediaId = dcr->VolMediaId;
- mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
- if (!create_jobmedia_record(db, mjcr)) {
- Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
-@@ -476,6 +477,7 @@
- dcr->VolFirstIndex = dcr->FileIndex = 0;
- dcr->StartBlock = dcr->EndBlock = 0;
- dcr->StartFile = dcr->EndFile = 0;
-+ dcr->VolMediaId = 0;
- }
-
- Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
-@@ -1177,6 +1179,7 @@
-
- dcr->EndBlock = dev->EndBlock;
- dcr->EndFile = dev->EndFile;
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
-
- memset(&jmr, 0, sizeof(jmr));
- jmr.JobId = mjcr->JobId;
-Index: askdir.c
-===================================================================
---- askdir.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
-+++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -398,7 +398,7 @@
- dcr->StartFile, dcr->EndFile,
- dcr->StartBlock, dcr->EndBlock,
- dcr->Copy, dcr->Stripe,
-- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
-+ edit_uint64(dcr->VolMediaId, ed1));
- Dmsg1(100, ">dird: %s", dir->msg);
- if (bnet_recv(dir) <= 0) {
- Dmsg0(190, "create_jobmedia error bnet_recv\n");
-Index: dev.h
-===================================================================
---- dev.h (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
-+++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -447,6 +447,7 @@
- uint32_t StartFile; /* Start write file */
- uint32_t StartBlock; /* Start write block */
- uint32_t EndBlock; /* Ending block written */
-+ int64_t VolMediaId; /* MediaId */
- int64_t job_spool_size; /* Current job spool size */
- int64_t max_job_spool_size; /* Max job spool size */
- char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
-Index: block.c
-===================================================================
---- block.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
-+++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -611,6 +611,7 @@
- dev->block_num = dcr->EndBlock;
- dev->file = dcr->EndFile;
- }
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
- if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
- dcr->VolFirstIndex = block->FirstIndex;
- }
-@@ -1098,6 +1099,7 @@
- dev->block_num = dcr->EndBlock;
- dev->file = dcr->EndFile;
- }
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
- dev->file_addr += block->read_len;
- dev->file_size += block->read_len;
-
+++ /dev/null
-Index: fd_cmds.c
-===================================================================
---- fd_cmds.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
-+++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -1,18 +1,4 @@
- /*
-- * This file handles commands from the File daemon.
-- *
-- * Kern Sibbald, MM
-- *
-- * We get here because the Director has initiated a Job with
-- * the Storage daemon, then done the same with the File daemon,
-- * then when the Storage daemon receives a proper connection from
-- * the File daemon, control is passed here to handle the
-- * subsequent File daemon commands.
-- *
-- * Version $Id$
-- *
-- */
--/*
- Bacula® - The Network Backup Solution
-
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
-@@ -39,6 +25,20 @@
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
- */
-+/*
-+ * This file handles commands from the File daemon.
-+ *
-+ * Kern Sibbald, MM
-+ *
-+ * We get here because the Director has initiated a Job with
-+ * the Storage daemon, then done the same with the File daemon,
-+ * then when the Storage daemon receives a proper connection from
-+ * the File daemon, control is passed here to handle the
-+ * subsequent File daemon commands.
-+ *
-+ * Version $Id$
-+ *
-+ */
-
- #include "bacula.h"
- #include "stored.h"
-Index: bscan.c
-===================================================================
---- bscan.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
-+++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -326,6 +326,7 @@
- mdcr->StartFile = dcr->StartFile;
- mdcr->EndBlock = dcr->EndBlock;
- mdcr->EndFile = dcr->EndFile;
-+ mdcr->VolMediaId = dcr->VolMediaId;
- mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
- if (!create_jobmedia_record(db, mjcr)) {
- Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
-@@ -476,6 +477,7 @@
- dcr->VolFirstIndex = dcr->FileIndex = 0;
- dcr->StartBlock = dcr->EndBlock = 0;
- dcr->StartFile = dcr->EndFile = 0;
-+ dcr->VolMediaId = 0;
- }
-
- Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
-@@ -1177,6 +1179,7 @@
-
- dcr->EndBlock = dev->EndBlock;
- dcr->EndFile = dev->EndFile;
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
-
- memset(&jmr, 0, sizeof(jmr));
- jmr.JobId = mjcr->JobId;
-Index: askdir.c
-===================================================================
---- askdir.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
-+++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -398,7 +398,7 @@
- dcr->StartFile, dcr->EndFile,
- dcr->StartBlock, dcr->EndBlock,
- dcr->Copy, dcr->Stripe,
-- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
-+ edit_uint64(dcr->VolMediaId, ed1));
- Dmsg1(100, ">dird: %s", dir->msg);
- if (bnet_recv(dir) <= 0) {
- Dmsg0(190, "create_jobmedia error bnet_recv\n");
-Index: dev.h
-===================================================================
---- dev.h (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
-+++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -447,6 +447,7 @@
- uint32_t StartFile; /* Start write file */
- uint32_t StartBlock; /* Start write block */
- uint32_t EndBlock; /* Ending block written */
-+ int64_t VolMediaId; /* MediaId */
- int64_t job_spool_size; /* Current job spool size */
- int64_t max_job_spool_size; /* Max job spool size */
- char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
-Index: block.c
-===================================================================
---- block.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
-+++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -611,6 +611,7 @@
- dev->block_num = dcr->EndBlock;
- dev->file = dcr->EndFile;
- }
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
- if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
- dcr->VolFirstIndex = block->FirstIndex;
- }
-@@ -1098,6 +1099,7 @@
- dev->block_num = dcr->EndBlock;
- dev->file = dcr->EndFile;
- }
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
- dev->file_addr += block->read_len;
- dev->file_size += block->read_len;
-
+++ /dev/null
-Index: fd_cmds.c
-===================================================================
---- fd_cmds.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
-+++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -1,18 +1,4 @@
- /*
-- * This file handles commands from the File daemon.
-- *
-- * Kern Sibbald, MM
-- *
-- * We get here because the Director has initiated a Job with
-- * the Storage daemon, then done the same with the File daemon,
-- * then when the Storage daemon receives a proper connection from
-- * the File daemon, control is passed here to handle the
-- * subsequent File daemon commands.
-- *
-- * Version $Id$
-- *
-- */
--/*
- Bacula® - The Network Backup Solution
-
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
-@@ -39,6 +25,20 @@
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
- */
-+/*
-+ * This file handles commands from the File daemon.
-+ *
-+ * Kern Sibbald, MM
-+ *
-+ * We get here because the Director has initiated a Job with
-+ * the Storage daemon, then done the same with the File daemon,
-+ * then when the Storage daemon receives a proper connection from
-+ * the File daemon, control is passed here to handle the
-+ * subsequent File daemon commands.
-+ *
-+ * Version $Id$
-+ *
-+ */
-
- #include "bacula.h"
- #include "stored.h"
-Index: bscan.c
-===================================================================
---- bscan.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
-+++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -326,6 +326,7 @@
- mdcr->StartFile = dcr->StartFile;
- mdcr->EndBlock = dcr->EndBlock;
- mdcr->EndFile = dcr->EndFile;
-+ mdcr->VolMediaId = dcr->VolMediaId;
- mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
- if (!create_jobmedia_record(db, mjcr)) {
- Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
-@@ -476,6 +477,7 @@
- dcr->VolFirstIndex = dcr->FileIndex = 0;
- dcr->StartBlock = dcr->EndBlock = 0;
- dcr->StartFile = dcr->EndFile = 0;
-+ dcr->VolMediaId = 0;
- }
-
- Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
-@@ -1177,6 +1179,7 @@
-
- dcr->EndBlock = dev->EndBlock;
- dcr->EndFile = dev->EndFile;
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
-
- memset(&jmr, 0, sizeof(jmr));
- jmr.JobId = mjcr->JobId;
-Index: askdir.c
-===================================================================
---- askdir.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
-+++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -398,7 +398,7 @@
- dcr->StartFile, dcr->EndFile,
- dcr->StartBlock, dcr->EndBlock,
- dcr->Copy, dcr->Stripe,
-- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
-+ edit_uint64(dcr->VolMediaId, ed1));
- Dmsg1(100, ">dird: %s", dir->msg);
- if (bnet_recv(dir) <= 0) {
- Dmsg0(190, "create_jobmedia error bnet_recv\n");
-Index: dev.h
-===================================================================
---- dev.h (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
-+++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -447,6 +447,7 @@
- uint32_t StartFile; /* Start write file */
- uint32_t StartBlock; /* Start write block */
- uint32_t EndBlock; /* Ending block written */
-+ int64_t VolMediaId; /* MediaId */
- int64_t job_spool_size; /* Current job spool size */
- int64_t max_job_spool_size; /* Max job spool size */
- char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
-Index: block.c
-===================================================================
---- block.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
-+++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
-@@ -611,6 +611,7 @@
- dev->block_num = dcr->EndBlock;
- dev->file = dcr->EndFile;
- }
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
- if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
- dcr->VolFirstIndex = block->FirstIndex;
- }
-@@ -1098,6 +1099,7 @@
- dev->block_num = dcr->EndBlock;
- dev->file = dcr->EndFile;
- }
-+ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
- dev->file_addr += block->read_len;
- dev->file_size += block->read_len;
-
+++ /dev/null
- This patch corrects a bug where the last volume of a migration
- job is incorrectly found producing an error. This fixes bug #936.
- Apply the patch to 2.2.3 (and possibly earlier 2.2.x versions) with:
-
- cd <bacula-source>
- patch -p0 <2.2.3-migrate-vol.patch
- ./configure (your options)
- make
- ...
- make install
-
-Index: src/dird/migrate.c
-===================================================================
---- src/dird/migrate.c (revision 5507)
-+++ src/dird/migrate.c (working copy)
-@@ -1098,8 +1098,10 @@
- if (mig_jcr->VolumeName[0]) {
- /* Find last volume name. Multiple vols are separated by | */
- char *p = strrchr(mig_jcr->VolumeName, '|');
-- if (!p) {
-- p = mig_jcr->VolumeName;
-+ if (p) {
-+ p++; /* skip | */
-+ } else {
-+ p = mig_jcr->VolumeName; /* no |, take full name */
- }
- bstrncpy(mr.VolumeName, p, sizeof(mr.VolumeName));
- if (!db_get_media_record(jcr, jcr->db, &mr)) {
+++ /dev/null
-
- This patch was supplied by Landon Fuller and corrects a bug that
- caused high CPU usage when connecting from bconsole to the Director.
- This fixes bug #944.
-
- Apply this patch to version 2.2.3 (it should work with any 2.2.x
- version with:
-
- cd <bacula-source>
- patch -p0 <2.2.3-tls.patch
- ./configure (your options)
- make
- ...
- make install
-
-Index: src/lib/tls.c
-===================================================================
---- src/lib/tls.c (revision 5507)
-+++ src/lib/tls.c (working copy)
-@@ -622,13 +622,21 @@
- break;
-
- case SSL_ERROR_WANT_READ:
-+ /* If we timeout on a select, this will be unset */
-+ FD_SET((unsigned)bsock->m_fd, &fdset);
-+ tv.tv_sec = 10;
-+ tv.tv_usec = 0;
-+ /* Block until we can read */
-+ select(fdmax, &fdset, NULL, NULL, &tv);
-+ break;
-+
- case SSL_ERROR_WANT_WRITE:
- /* If we timeout on a select, this will be unset */
- FD_SET((unsigned)bsock->m_fd, &fdset);
- tv.tv_sec = 10;
- tv.tv_usec = 0;
-- /* Block until we can read or write */
-- select(fdmax, NULL, &fdset, &fdset, &tv);
-+ /* Block until we can write */
-+ select(fdmax, NULL, &fdset, NULL, &tv);
- break;
-
- case SSL_ERROR_ZERO_RETURN:
--- /dev/null
+Index: fd_cmds.c
+===================================================================
+--- fd_cmds.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
++++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -1,18 +1,4 @@
+ /*
+- * This file handles commands from the File daemon.
+- *
+- * Kern Sibbald, MM
+- *
+- * We get here because the Director has initiated a Job with
+- * the Storage daemon, then done the same with the File daemon,
+- * then when the Storage daemon receives a proper connection from
+- * the File daemon, control is passed here to handle the
+- * subsequent File daemon commands.
+- *
+- * Version $Id$
+- *
+- */
+-/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+@@ -39,6 +25,20 @@
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ * This file handles commands from the File daemon.
++ *
++ * Kern Sibbald, MM
++ *
++ * We get here because the Director has initiated a Job with
++ * the Storage daemon, then done the same with the File daemon,
++ * then when the Storage daemon receives a proper connection from
++ * the File daemon, control is passed here to handle the
++ * subsequent File daemon commands.
++ *
++ * Version $Id$
++ *
++ */
+
+ #include "bacula.h"
+ #include "stored.h"
+@@ -120,7 +120,7 @@
+
+ dir->set_jcr(jcr);
+ Dmsg1(120, "Start run Job=%s\n", jcr->Job);
+- bnet_fsend(dir, Job_start, jcr->Job);
++ dir->fsend(Job_start, jcr->Job);
+ jcr->start_time = time(NULL);
+ jcr->run_time = jcr->start_time;
+ set_jcr_job_status(jcr, JS_Running);
+@@ -130,9 +130,9 @@
+ dequeue_messages(jcr); /* send any queued messages */
+ set_jcr_job_status(jcr, JS_Terminated);
+ generate_daemon_event(jcr, "JobEnd");
+- bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
++ dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
+ edit_uint64(jcr->JobBytes, ec1));
+- bnet_sig(dir, BNET_EOD); /* send EOD to Director daemon */
++ dir->signal(BNET_EOD); /* send EOD to Director daemon */
+ return;
+ }
+
+@@ -150,7 +150,7 @@
+ int stat;
+
+ /* Read command coming from the File daemon */
+- stat = bnet_recv(fd);
++ stat = fd->recv();
+ if (is_bnet_stop(fd)) { /* hardeof or error */
+ break; /* connection terminated */
+ }
+@@ -171,11 +171,11 @@
+ }
+ if (!found) { /* command not found */
+ Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
+- bnet_fsend(fd, ferrmsg);
++ fd->fsend(ferrmsg);
+ break;
+ }
+ }
+- bnet_sig(fd, BNET_TERMINATE); /* signal to FD job is done */
++ fd->signal(BNET_TERMINATE); /* signal to FD job is done */
+ }
+
+ /*
+@@ -195,10 +195,10 @@
+ return true;
+ } else {
+ bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
+- bnet_fsend(fd, ERROR_append);
++ fd->fsend(ERROR_append);
+ }
+ } else {
+- bnet_fsend(fd, NOT_opened);
++ fd->fsend(NOT_opened);
+ }
+ return false;
+ }
+@@ -209,11 +209,11 @@
+
+ Dmsg1(120, "store<file: %s", fd->msg);
+ if (!jcr->session_opened) {
+- bnet_fsend(fd, NOT_opened);
++ fd->fsend(NOT_opened);
+ return false;
+ }
+ set_jcr_job_status(jcr, JS_Terminated);
+- return bnet_fsend(fd, OK_end);
++ return fd->fsend(OK_end);
+ }
+
+
+@@ -227,14 +227,14 @@
+
+ Dmsg1(120, "Append open session: %s", fd->msg);
+ if (jcr->session_opened) {
+- bnet_fsend(fd, NO_open);
++ fd->fsend(NO_open);
+ return false;
+ }
+
+ jcr->session_opened = true;
+
+ /* Send "Ticket" to File Daemon */
+- bnet_fsend(fd, OK_open, jcr->VolSessionId);
++ fd->fsend(OK_open, jcr->VolSessionId);
+ Dmsg1(110, ">filed: %s", fd->msg);
+
+ return true;
+@@ -251,14 +251,14 @@
+
+ Dmsg1(120, "<filed: %s", fd->msg);
+ if (!jcr->session_opened) {
+- bnet_fsend(fd, NOT_opened);
++ fd->fsend(NOT_opened);
+ return false;
+ }
+ /* Send final statistics to File daemon */
+- bnet_fsend(fd, OK_close, jcr->JobStatus);
++ fd->fsend(OK_close, jcr->JobStatus);
+ Dmsg1(120, ">filed: %s", fd->msg);
+
+- bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
++ fd->signal(BNET_EOD); /* send EOD to File daemon */
+
+ jcr->session_opened = false;
+ return true;
+@@ -279,7 +279,7 @@
+ Dmsg1(120, "<bfiled: %s", fd->msg);
+ return do_read_data(jcr);
+ } else {
+- bnet_fsend(fd, NOT_opened);
++ fd->fsend(NOT_opened);
+ return false;
+ }
+ }
+@@ -296,7 +296,7 @@
+
+ Dmsg1(120, "%s\n", fd->msg);
+ if (jcr->session_opened) {
+- bnet_fsend(fd, NO_open);
++ fd->fsend(NO_open);
+ return false;
+ }
+
+@@ -304,7 +304,7 @@
+ &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
+ &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
+ if (jcr->session_opened) {
+- bnet_fsend(fd, NOT_opened);
++ fd->fsend(NOT_opened);
+ return false;
+ }
+ Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
+@@ -319,7 +319,7 @@
+ jcr->JobType = JT_RESTORE;
+
+ /* Send "Ticket" to File Daemon */
+- bnet_fsend(fd, OK_open, jcr->VolSessionId);
++ fd->fsend(OK_open, jcr->VolSessionId);
+ Dmsg1(110, ">filed: %s", fd->msg);
+
+ return true;
+@@ -357,7 +357,7 @@
+ goto bail_out;
+ }
+ Dmsg0(10, "=== Bootstrap file ===\n");
+- while (bnet_recv(sock) >= 0) {
++ while (sock->recv() >= 0) {
+ Dmsg1(10, "%s", sock->msg);
+ fputs(sock->msg, bs);
+ }
+@@ -378,10 +378,10 @@
+ free_pool_memory(jcr->RestoreBootstrap);
+ jcr->RestoreBootstrap = NULL;
+ if (!ok) {
+- bnet_fsend(sock, ERROR_bootstrap);
++ sock->fsend(ERROR_bootstrap);
+ return false;
+ }
+- return bnet_fsend(sock, OK_bootstrap);
++ return sock->fsend(OK_bootstrap);
+ }
+
+
+@@ -395,14 +395,14 @@
+
+ Dmsg1(120, "Read close session: %s\n", fd->msg);
+ if (!jcr->session_opened) {
+- bnet_fsend(fd, NOT_opened);
++ fd->fsend(NOT_opened);
+ return false;
+ }
+- /* Send final statistics to File daemon */
+- bnet_fsend(fd, OK_close);
++ /* Send final close msg to File daemon */
++ fd->fsend(OK_close, jcr->JobStatus);
+ Dmsg1(160, ">filed: %s\n", fd->msg);
+
+- bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
++ fd->signal(BNET_EOD); /* send EOD to File daemon */
+
+ jcr->session_opened = false;
+ return true;
+Index: stored_conf.c
+===================================================================
+--- stored_conf.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
++++ stored_conf.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -75,7 +75,7 @@
+ {"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
+ {"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, 0, 0},
+ {"scriptsdirectory", store_dir, ITEM(res_store.scripts_directory), 0, 0, 0},
+- {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 10},
++ {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
+ {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+ {"tlsenable", store_bit, ITEM(res_store.tls_enable), 1, 0, 0},
+ {"tlsrequire", store_bit, ITEM(res_store.tls_require), 1, 0, 0},
+Index: bscan.c
+===================================================================
+--- bscan.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
++++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -120,7 +120,7 @@
+ " -m update media info in database\n"
+ " -n <name> specify the database name (default bacula)\n"
+ " -u <user> specify database user name (default bacula)\n"
+-" -P <password specify database password (default none)\n"
++" -P <password> specify database password (default none)\n"
+ " -h <host> specify database host (default NULL)\n"
+ " -p proceed inspite of I/O errors\n"
+ " -r list records\n"
+@@ -326,6 +326,7 @@
+ mdcr->StartFile = dcr->StartFile;
+ mdcr->EndBlock = dcr->EndBlock;
+ mdcr->EndFile = dcr->EndFile;
++ mdcr->VolMediaId = dcr->VolMediaId;
+ mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
+ if (!create_jobmedia_record(db, mjcr)) {
+ Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+@@ -476,6 +477,7 @@
+ dcr->VolFirstIndex = dcr->FileIndex = 0;
+ dcr->StartBlock = dcr->EndBlock = 0;
+ dcr->StartFile = dcr->EndFile = 0;
++ dcr->VolMediaId = 0;
+ }
+
+ Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
+@@ -1177,6 +1179,7 @@
+
+ dcr->EndBlock = dev->EndBlock;
+ dcr->EndFile = dev->EndFile;
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+
+ memset(&jmr, 0, sizeof(jmr));
+ jmr.JobId = mjcr->JobId;
+Index: askdir.c
+===================================================================
+--- askdir.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
++++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -398,7 +398,7 @@
+ dcr->StartFile, dcr->EndFile,
+ dcr->StartBlock, dcr->EndBlock,
+ dcr->Copy, dcr->Stripe,
+- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
++ edit_uint64(dcr->VolMediaId, ed1));
+ Dmsg1(100, ">dird: %s", dir->msg);
+ if (bnet_recv(dir) <= 0) {
+ Dmsg0(190, "create_jobmedia error bnet_recv\n");
+Index: dev.h
+===================================================================
+--- dev.h (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
++++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -447,6 +447,7 @@
+ uint32_t StartFile; /* Start write file */
+ uint32_t StartBlock; /* Start write block */
+ uint32_t EndBlock; /* Ending block written */
++ int64_t VolMediaId; /* MediaId */
+ int64_t job_spool_size; /* Current job spool size */
+ int64_t max_job_spool_size; /* Max job spool size */
+ char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
+Index: block.c
+===================================================================
+--- block.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
++++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -611,6 +611,7 @@
+ dev->block_num = dcr->EndBlock;
+ dev->file = dcr->EndFile;
+ }
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+ if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
+ dcr->VolFirstIndex = block->FirstIndex;
+ }
+@@ -1098,6 +1099,7 @@
+ dev->block_num = dcr->EndBlock;
+ dev->file = dcr->EndFile;
+ }
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+ dev->file_addr += block->read_len;
+ dev->file_size += block->read_len;
+
--- /dev/null
+Index: fd_cmds.c
+===================================================================
+--- fd_cmds.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
++++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -1,18 +1,4 @@
+ /*
+- * This file handles commands from the File daemon.
+- *
+- * Kern Sibbald, MM
+- *
+- * We get here because the Director has initiated a Job with
+- * the Storage daemon, then done the same with the File daemon,
+- * then when the Storage daemon receives a proper connection from
+- * the File daemon, control is passed here to handle the
+- * subsequent File daemon commands.
+- *
+- * Version $Id$
+- *
+- */
+-/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+@@ -39,6 +25,20 @@
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ * This file handles commands from the File daemon.
++ *
++ * Kern Sibbald, MM
++ *
++ * We get here because the Director has initiated a Job with
++ * the Storage daemon, then done the same with the File daemon,
++ * then when the Storage daemon receives a proper connection from
++ * the File daemon, control is passed here to handle the
++ * subsequent File daemon commands.
++ *
++ * Version $Id$
++ *
++ */
+
+ #include "bacula.h"
+ #include "stored.h"
+Index: bscan.c
+===================================================================
+--- bscan.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
++++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -326,6 +326,7 @@
+ mdcr->StartFile = dcr->StartFile;
+ mdcr->EndBlock = dcr->EndBlock;
+ mdcr->EndFile = dcr->EndFile;
++ mdcr->VolMediaId = dcr->VolMediaId;
+ mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
+ if (!create_jobmedia_record(db, mjcr)) {
+ Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+@@ -476,6 +477,7 @@
+ dcr->VolFirstIndex = dcr->FileIndex = 0;
+ dcr->StartBlock = dcr->EndBlock = 0;
+ dcr->StartFile = dcr->EndFile = 0;
++ dcr->VolMediaId = 0;
+ }
+
+ Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
+@@ -1177,6 +1179,7 @@
+
+ dcr->EndBlock = dev->EndBlock;
+ dcr->EndFile = dev->EndFile;
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+
+ memset(&jmr, 0, sizeof(jmr));
+ jmr.JobId = mjcr->JobId;
+Index: askdir.c
+===================================================================
+--- askdir.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
++++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -398,7 +398,7 @@
+ dcr->StartFile, dcr->EndFile,
+ dcr->StartBlock, dcr->EndBlock,
+ dcr->Copy, dcr->Stripe,
+- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
++ edit_uint64(dcr->VolMediaId, ed1));
+ Dmsg1(100, ">dird: %s", dir->msg);
+ if (bnet_recv(dir) <= 0) {
+ Dmsg0(190, "create_jobmedia error bnet_recv\n");
+Index: dev.h
+===================================================================
+--- dev.h (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
++++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -447,6 +447,7 @@
+ uint32_t StartFile; /* Start write file */
+ uint32_t StartBlock; /* Start write block */
+ uint32_t EndBlock; /* Ending block written */
++ int64_t VolMediaId; /* MediaId */
+ int64_t job_spool_size; /* Current job spool size */
+ int64_t max_job_spool_size; /* Max job spool size */
+ char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
+Index: block.c
+===================================================================
+--- block.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508)
++++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -611,6 +611,7 @@
+ dev->block_num = dcr->EndBlock;
+ dev->file = dcr->EndFile;
+ }
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+ if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
+ dcr->VolFirstIndex = block->FirstIndex;
+ }
+@@ -1098,6 +1099,7 @@
+ dev->block_num = dcr->EndBlock;
+ dev->file = dcr->EndFile;
+ }
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+ dev->file_addr += block->read_len;
+ dev->file_size += block->read_len;
+
--- /dev/null
+Index: fd_cmds.c
+===================================================================
+--- fd_cmds.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
++++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -1,18 +1,4 @@
+ /*
+- * This file handles commands from the File daemon.
+- *
+- * Kern Sibbald, MM
+- *
+- * We get here because the Director has initiated a Job with
+- * the Storage daemon, then done the same with the File daemon,
+- * then when the Storage daemon receives a proper connection from
+- * the File daemon, control is passed here to handle the
+- * subsequent File daemon commands.
+- *
+- * Version $Id$
+- *
+- */
+-/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+@@ -39,6 +25,20 @@
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ * This file handles commands from the File daemon.
++ *
++ * Kern Sibbald, MM
++ *
++ * We get here because the Director has initiated a Job with
++ * the Storage daemon, then done the same with the File daemon,
++ * then when the Storage daemon receives a proper connection from
++ * the File daemon, control is passed here to handle the
++ * subsequent File daemon commands.
++ *
++ * Version $Id$
++ *
++ */
+
+ #include "bacula.h"
+ #include "stored.h"
+Index: bscan.c
+===================================================================
+--- bscan.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
++++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -326,6 +326,7 @@
+ mdcr->StartFile = dcr->StartFile;
+ mdcr->EndBlock = dcr->EndBlock;
+ mdcr->EndFile = dcr->EndFile;
++ mdcr->VolMediaId = dcr->VolMediaId;
+ mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
+ if (!create_jobmedia_record(db, mjcr)) {
+ Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+@@ -476,6 +477,7 @@
+ dcr->VolFirstIndex = dcr->FileIndex = 0;
+ dcr->StartBlock = dcr->EndBlock = 0;
+ dcr->StartFile = dcr->EndFile = 0;
++ dcr->VolMediaId = 0;
+ }
+
+ Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
+@@ -1177,6 +1179,7 @@
+
+ dcr->EndBlock = dev->EndBlock;
+ dcr->EndFile = dev->EndFile;
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+
+ memset(&jmr, 0, sizeof(jmr));
+ jmr.JobId = mjcr->JobId;
+Index: askdir.c
+===================================================================
+--- askdir.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
++++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -398,7 +398,7 @@
+ dcr->StartFile, dcr->EndFile,
+ dcr->StartBlock, dcr->EndBlock,
+ dcr->Copy, dcr->Stripe,
+- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
++ edit_uint64(dcr->VolMediaId, ed1));
+ Dmsg1(100, ">dird: %s", dir->msg);
+ if (bnet_recv(dir) <= 0) {
+ Dmsg0(190, "create_jobmedia error bnet_recv\n");
+Index: dev.h
+===================================================================
+--- dev.h (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
++++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -447,6 +447,7 @@
+ uint32_t StartFile; /* Start write file */
+ uint32_t StartBlock; /* Start write block */
+ uint32_t EndBlock; /* Ending block written */
++ int64_t VolMediaId; /* MediaId */
+ int64_t job_spool_size; /* Current job spool size */
+ int64_t max_job_spool_size; /* Max job spool size */
+ char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
+Index: block.c
+===================================================================
+--- block.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508)
++++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
+@@ -611,6 +611,7 @@
+ dev->block_num = dcr->EndBlock;
+ dev->file = dcr->EndFile;
+ }
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+ if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
+ dcr->VolFirstIndex = block->FirstIndex;
+ }
+@@ -1098,6 +1099,7 @@
+ dev->block_num = dcr->EndBlock;
+ dev->file = dcr->EndFile;
+ }
++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+ dev->file_addr += block->read_len;
+ dev->file_size += block->read_len;
+
--- /dev/null
+ This patch corrects a bug where the last volume of a migration
+ job is incorrectly found producing an error. This fixes bug #936.
+ Apply the patch to 2.2.3 (and possibly earlier 2.2.x versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.2.3-migrate-vol.patch
+ ./configure (your options)
+ make
+ ...
+ make install
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 5507)
++++ src/dird/migrate.c (working copy)
+@@ -1098,8 +1098,10 @@
+ if (mig_jcr->VolumeName[0]) {
+ /* Find last volume name. Multiple vols are separated by | */
+ char *p = strrchr(mig_jcr->VolumeName, '|');
+- if (!p) {
+- p = mig_jcr->VolumeName;
++ if (p) {
++ p++; /* skip | */
++ } else {
++ p = mig_jcr->VolumeName; /* no |, take full name */
+ }
+ bstrncpy(mr.VolumeName, p, sizeof(mr.VolumeName));
+ if (!db_get_media_record(jcr, jcr->db, &mr)) {
--- /dev/null
+
+ This patch was supplied by Landon Fuller and corrects a bug that
+ caused high CPU usage when connecting from bconsole to the Director.
+ This fixes bug #944.
+
+ Apply this patch to version 2.2.3 (it should work with any 2.2.x
+ version with:
+
+ cd <bacula-source>
+ patch -p0 <2.2.3-tls.patch
+ ./configure (your options)
+ make
+ ...
+ make install
+
+Index: src/lib/tls.c
+===================================================================
+--- src/lib/tls.c (revision 5507)
++++ src/lib/tls.c (working copy)
+@@ -622,13 +622,21 @@
+ break;
+
+ case SSL_ERROR_WANT_READ:
++ /* If we timeout on a select, this will be unset */
++ FD_SET((unsigned)bsock->m_fd, &fdset);
++ tv.tv_sec = 10;
++ tv.tv_usec = 0;
++ /* Block until we can read */
++ select(fdmax, &fdset, NULL, NULL, &tv);
++ break;
++
+ case SSL_ERROR_WANT_WRITE:
+ /* If we timeout on a select, this will be unset */
+ FD_SET((unsigned)bsock->m_fd, &fdset);
+ tv.tv_sec = 10;
+ tv.tv_usec = 0;
+- /* Block until we can read or write */
+- select(fdmax, NULL, &fdset, &fdset, &tv);
++ /* Block until we can write */
++ select(fdmax, NULL, &fdset, NULL, &tv);
+ break;
+
+ case SSL_ERROR_ZERO_RETURN: