Close hostile recovery and concurrency gaps
This commit is contained in:
parent
696dae610a
commit
3f9b1b3543
1 changed files with 306 additions and 113 deletions
|
|
@ -2,10 +2,10 @@ use std::collections::BTreeMap;
|
|||
use std::ffi::{OsStr, OsString};
|
||||
use std::fmt;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, Read, Seek, SeekFrom, Write};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::os::fd::{AsFd, AsRawFd};
|
||||
use std::os::unix::ffi::OsStringExt;
|
||||
use std::os::unix::fs::{FileTypeExt, MetadataExt, PermissionsExt};
|
||||
use std::os::unix::fs::{FileExt, FileTypeExt, MetadataExt, PermissionsExt};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
|
|
@ -1743,10 +1743,8 @@ impl PublishedControlFace {
|
|||
"publication objects changed identity, ownership, or mode",
|
||||
));
|
||||
}
|
||||
let mut exact_identity = self.identity_file.try_clone()?;
|
||||
exact_identity.seek(SeekFrom::Start(0))?;
|
||||
let mut bytes = Vec::new();
|
||||
exact_identity.read_to_end(&mut bytes)?;
|
||||
let mut bytes = vec![0; self.publication_bytes.len()];
|
||||
self.identity_file.read_exact_at(&mut bytes, 0)?;
|
||||
if bytes != self.publication_bytes {
|
||||
return Err(ControlError::InvalidPublication(
|
||||
"publication identity bytes changed",
|
||||
|
|
|
|||
Loading…
Reference in a new issue