Scope enrollment membership migration and use pull-only deployed gateway

This commit is contained in:
2026-11-17 16:03:54 +01:00
parent 7fd17272d5
commit 60f8f21f54
8 changed files with 258 additions and 67 deletions
+10 -3
View File
@@ -98,14 +98,21 @@ impl UpdateArtifacts {
hasher: Sha256::new(),
})
}
pub(crate) fn verified_file(&self, tenant: Uuid, hash: &str, bytes: u64) -> Result<File> {
fn open_object(&self, tenant: Uuid, hash: &str, bytes: u64) -> Result<(File, fs::Metadata)> {
ensure!(descriptor(hash, bytes), "bounded update object descriptor");
let parent = self.parent(tenant)?;
let mut file = OpenOptions::new()
let file = OpenOptions::new()
.read(true)
.custom_flags(libc::O_NOFOLLOW | libc::O_CLOEXEC)
.open(parent.join(hash))?;
let before = regular(&file, self.owner, bytes)?;
let metadata = regular(&file, self.owner, bytes)?;
Ok((file, metadata))
}
pub(crate) fn available(&self, tenant: Uuid, hash: &str, bytes: u64) -> Result<()> {
self.open_object(tenant, hash, bytes).map(|_| ())
}
pub(crate) fn verified_file(&self, tenant: Uuid, hash: &str, bytes: u64) -> Result<File> {
let (mut file, before) = self.open_object(tenant, hash, bytes)?;
let mut hasher = Sha256::new();
let mut buffer = [0_u8; 32768];
let mut seen = 0;