]> git.sur5r.net Git - bacula/bacula/commitdiff
Add code to check and prevent setting StorageId to zero
authorKern Sibbald <kern@sibbald.com>
Sat, 13 Feb 2010 11:45:13 +0000 (12:45 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 2 Aug 2010 14:49:29 +0000 (16:49 +0200)
bacula/src/dird/catreq.c

index de2971c2699822e9e75d83408bd56357a4e69f59..5af634c290a45efe8e4e7c6111af788523e0b136 100644 (file)
@@ -282,7 +282,13 @@ void catalog_request(JCR *jcr, BSOCK *bs)
        *   the number of VolWrites has increased.
        */
       if (jcr->wstore && jcr->wstore->StorageId && sdmr.VolWrites > mr.VolWrites) {
-         mr.StorageId = jcr->wstore->StorageId;
+         Dmsg2(050, "Update StorageId old=%d new=%d\n",
+               mr.StorageId, jcr->wstore->StorageId);
+         if (jcr->wstore->StorageId == 0) {
+            Jmsg(jcr, M_ERROR, 0, _("Attempt to set StorageId to zero.\n"));
+         } else {
+            mr.StorageId = jcr->wstore->StorageId;
+         }
       }
 
       /* Copy updated values to original media record */