tape: clear encryption key before writing labels

We always write labels unencrypted.
This commit is contained in:
Dietmar Maurer 2021-01-18 07:42:50 +01:00
parent d5a48b5ce4
commit 619554af2b
3 changed files with 6 additions and 0 deletions

View File

@ -461,6 +461,8 @@ impl TapeDriver for LinuxTapeHandle {
bail!("write_media_set_label failed - got wrong file number ({} != 1)", file_number);
}
self.set_encryption(None)?;
let mut handle = TapeWriterHandle {
writer: BlockedWriter::new(&mut self.file),
};

View File

@ -81,6 +81,8 @@ pub trait TapeDriver {
self.rewind()?;
self.set_encryption(None)?;
self.erase_media(true)?;
let raw = serde_json::to_string_pretty(&serde_json::to_value(&label)?)?;

View File

@ -327,6 +327,8 @@ impl TapeDriver for VirtualTapeHandle {
fn write_media_set_label(&mut self, media_set_label: &MediaSetLabel) -> Result<(), Error> {
self.set_encryption(None)?;
let mut status = self.load_status()?;
match status.current_tape {
Some(VirtualTapeStatus { ref name, ref mut pos }) => {