~ubuntu-branches/ubuntu/maverick/bacula/maverick

« back to all changes in this revision

Viewing changes to patches/2.4.2-inchanger.patch

  • Committer: Bazaar Package Importer
  • Author(s): Ante Karamatic
  • Date: 2008-11-26 13:53:30 UTC
  • mfrom: (3.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20081126135330-gvzmmbbeyiz9y1ar
Tags: 2.4.3-1ubuntu1
* Store sd|fd|director passwords in debconf (LP: #222558)
  - added debian/bacula-common.templates
  - modified debian/bacula-common.postinst:
    + generate random passwords and store them in debconf
  - modified debian/bacula-[sd|fd|director-mysql|director-pgsql].postinst
    + read and set passwords from debconf
* Daemons listen on all interfaces (LP: #286643)
* Start daemons on installation
* Build with generic XXX_*_XXX username, password and database name
  and replace it with dbconfig's settings in postinstall scripts
* Merge from debian unstable, remaining changes:
  - Drop mt-st to suggests. So that bacula goes back to main. (LP: #286528)
  - debian/rules: Disable fortify source since it was causing
    bacula-director to segfault.
  - debian/control:
    + Added libdbi-perl and libdb-mysql-perl to depends for
      bacula-director-mysql
      due to new postinst configuration.
    + Cleaned up bacula-director-pgsql dependenices and recommends.
    + Made mysql the default director to install bacula-director-{mysql|pgsql}
      added database handling to postinstall scripts and templates, modifiied
      postinstall script's sed expressions.
    + Removed libwgtk-2.6-dev as a build dependency; as a result
      bacula-console-wx isn't built anymore.
    + Install gawk if not installed. (LP: #207527)
  - debian/make_catalog_backup_awk.[mysql|pgsql|sqlite3|sqlite]:
    + New scripts for catalog backup. (CVE-2007-5626)
  - debian/bacula-console-wx:
    + Dropped since we are not building them anymore.
  - debian/bacula-director-common.bacula-director.init,
    debian/bacula-fd.init, debian/bacula-sd.init
    + Made more LSB specific.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
  Attempt to fix bug #1128 InChanger flag cleared during Migration
 
3
  job when reading from one autochanger and writing to another.
 
4
  Testing is needed.
 
5
  Apply this patch to Bacula version 2.4.2 with:
 
6
 
 
7
  cd <bacula-source>
 
8
  patch -p0 <2.4.2-inchanger.patch
 
9
  ./configure <your options>
 
10
  make
 
11
  ...
 
12
  make install
 
13
 
 
14
 
 
15
Index: src/dird/catreq.c
 
16
===================================================================
 
17
--- src/dird/catreq.c   (revision 7507)
 
18
+++ src/dird/catreq.c   (working copy)
 
19
@@ -83,7 +83,7 @@
 
20
    jcr->MediaId = mr->MediaId;
 
21
    pm_strcpy(jcr->VolumeName, mr->VolumeName);
 
22
    bash_spaces(mr->VolumeName);
 
23
-   stat = bnet_fsend(sd, OK_media, mr->VolumeName, mr->VolJobs,
 
24
+   stat = sd->fsend(OK_media, mr->VolumeName, mr->VolJobs,
 
25
       mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
 
26
       mr->VolMounts, mr->VolErrors, mr->VolWrites,
 
27
       edit_uint64(mr->MaxVolBytes, ed2),
 
28
@@ -266,11 +266,22 @@
 
29
          }
 
30
       }
 
31
       Dmsg2(400, "Update media: BefVolJobs=%u After=%u\n", mr.VolJobs, sdmr.VolJobs);
 
32
+
 
33
       /* Check if the volume has been written by the job, 
 
34
        * and update the LastWritten field if needed */
 
35
       if (mr.VolBlocks != sdmr.VolBlocks) {
 
36
          mr.LastWritten = sdmr.LastWritten;
 
37
       }
 
38
+
 
39
+      /*
 
40
+       * Update to point to the last device used to write the Volume.
 
41
+       *   However, do so only if we are writing the tape, i.e.
 
42
+       *   the number of VolWrites has increased.
 
43
+       */
 
44
+      if (jcr->wstore && jcr->wstore->StorageId && sdmr.VolWrites > mr.VolWrites) {
 
45
+         mr.StorageId = jcr->wstore->StorageId;
 
46
+      }
 
47
+
 
48
       /* Copy updated values to original media record */
 
49
       mr.VolJobs      = sdmr.VolJobs;
 
50
       mr.VolFiles     = sdmr.VolFiles;
 
51
@@ -285,14 +296,6 @@
 
52
       mr.VolWriteTime = sdmr.VolWriteTime;
 
53
       mr.VolParts     = sdmr.VolParts;
 
54
       bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
 
55
-      /*
 
56
-       * Update to point to the last device used to write the Volume.
 
57
-       *   However, do so only if we are writing the tape, i.e.
 
58
-       *   the number of VolBlocks has increased.
 
59
-       */
 
60
-      if (jcr->wstore && jcr->wstore->StorageId && mr.VolBlocks != sdmr.VolBlocks) {
 
61
-         mr.StorageId = jcr->wstore->StorageId;
 
62
-      }
 
63
 
 
64
       Dmsg2(400, "db_update_media_record. Stat=%s Vol=%s\n", mr.VolStatus, mr.VolumeName);
 
65
       /*
 
66
Index: src/dird/dird.c
 
67
===================================================================
 
68
--- src/dird/dird.c     (revision 7507)
 
69
+++ src/dird/dird.c     (working copy)
 
70
@@ -914,6 +914,7 @@
 
71
          db_create_storage_record(NULL, db, &sr);
 
72
          store->StorageId = sr.StorageId;   /* set storage Id */
 
73
          if (!sr.created) {                 /* if not created, update it */
 
74
+            sr.AutoChanger = store->autochanger;
 
75
             db_update_storage_record(NULL, db, &sr);
 
76
          }
 
77
 
 
78
Index: src/cats/sql_update.c
 
79
===================================================================
 
80
--- src/cats/sql_update.c       (revision 7507)
 
81
+++ src/cats/sql_update.c       (working copy)
 
82
@@ -1,7 +1,7 @@
 
83
 /*
 
84
    Bacula® - The Network Backup Solution
 
85
 
 
86
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
 
87
+   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
 
88
 
 
89
    The main author of Bacula is Kern Sibbald, with contributions from
 
90
    many others, a complete list can be found in the file AUTHORS.
 
91
@@ -445,7 +445,8 @@
 
92
 db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
 
93
 {
 
94
    char ed1[50], ed2[50];
 
95
-   if (mr->InChanger != 0 && mr->Slot != 0) {
 
96
+   if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0 &&
 
97
+       mr->MediaId != 0) {
 
98
       Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE "
 
99
            "Slot=%d AND StorageId=%s AND MediaId!=%s",
 
100
             mr->Slot,