Implement and natively verify the human-reviewed Windows recovery tool
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -233,6 +233,23 @@ impl Store {
|
||||
value.check()?;
|
||||
Ok(value)
|
||||
}
|
||||
/// Verify the original protected journal and retain a read-only snapshot of its empty history.
|
||||
pub fn open_empty_history_snapshot() -> Result<Self> {
|
||||
let store = Self::open(false)?;
|
||||
ensure!(
|
||||
store.db.is_readonly(rusqlite::DatabaseName::Main)?,
|
||||
"read-only intent snapshot required"
|
||||
);
|
||||
store
|
||||
.db
|
||||
.execute_batch("PRAGMA trusted_schema=OFF; PRAGMA query_only=ON; BEGIN")?;
|
||||
let count: usize = store.db.query_row(
|
||||
"SELECT (SELECT count(*) FROM system_intents)+(SELECT count(*) FROM system_intent_mirrors)+(SELECT count(*) FROM system_intent_denial_resumes)",
|
||||
[], |r|r.get(0),
|
||||
)?;
|
||||
ensure!(count == 0, "unreviewed SYSTEM delegation");
|
||||
Ok(store)
|
||||
}
|
||||
pub fn check(&mut self) -> Result<()> {
|
||||
for file in &mut self.files {
|
||||
file.check()?;
|
||||
|
||||
@@ -624,7 +624,8 @@ impl PinnedFile {
|
||||
) -> Result<Self> {
|
||||
Self::open_impl(path, directory, readers, writers, write, false)
|
||||
}
|
||||
pub(crate) fn open_read_shared(
|
||||
/// Pin and check the object without opening a write-capable handle.
|
||||
pub fn open_read_shared(
|
||||
path: &Path,
|
||||
directory: bool,
|
||||
readers: &[String],
|
||||
|
||||
Reference in New Issue
Block a user