diff --git a/src/backup/catalog.rs b/src/backup/catalog.rs index 3d68017b..4bb7c2f4 100644 --- a/src/backup/catalog.rs +++ b/src/backup/catalog.rs @@ -9,6 +9,7 @@ use chrono::offset::{TimeZone, Local}; use proxmox::tools::io::ReadExt; use crate::pxar::catalog::{BackupCatalogWriter, CatalogEntryType}; +use crate::backup::file_formats::PROXMOX_CATALOG_FILE_MAGIC_1_0; enum DirEntry { Directory { name: Vec, start: u64 }, @@ -154,7 +155,9 @@ pub struct CatalogWriter { impl CatalogWriter { pub fn new(writer: W) -> Result { - Ok(Self { writer, dirstack: vec![ DirInfo::new_rootdir() ], pos: 0 }) + let mut me = Self { writer, dirstack: vec![ DirInfo::new_rootdir() ], pos: 0 }; + me.write_all(&PROXMOX_CATALOG_FILE_MAGIC_1_0)?; + Ok(me) } pub fn finish(&mut self) -> Result<(), Error> { diff --git a/src/backup/file_formats.rs b/src/backup/file_formats.rs index ce2e2118..efc62f47 100644 --- a/src/backup/file_formats.rs +++ b/src/backup/file_formats.rs @@ -2,6 +2,9 @@ use endian_trait::Endian; // WARNING: PLEASE DO NOT MODIFY THOSE MAGIC VALUES +// openssl::sha::sha256(b"Proxmox Backup Catalog file v1.0")[0..8] +pub const PROXMOX_CATALOG_FILE_MAGIC_1_0: [u8; 8] = [145, 253, 96, 249, 196, 103, 88, 213]; + // openssl::sha::sha256(b"Proxmox Backup uncompressed blob v1.0")[0..8] pub const UNCOMPRESSED_BLOB_MAGIC_1_0: [u8; 8] = [66, 171, 56, 7, 190, 131, 112, 161];