pub struct Verifier<'a> { /* private fields */ }
Expand description

An object used to perform a single check.

A Verifier is used when Mistrust::check_directory and Mistrust::make_directory are not sufficient for your needs.

Implementations

Configure this Verifier to require that all paths it checks be files (not directories).

Configure this Verifier to require that all paths it checks be directories.

Configure this Verifier to allow the paths that it checks to be filesystem objects of any type.

By default, the final path (after resolving all links) must be a directory or a regular file, not (for example) a block device or a named pipe.

Configure this Verifier to permit the target files/directory to be readable by untrusted users.

By default, we assume that the caller wants the target file or directory to be only readable or writable by trusted users. With this flag, we permit the target file or directory to be readable by untrusted users, but not writable.

(Note that we always allow the parent directories of the target to be readable by untrusted users, since their readability does not make the target readable.)

Tell this Verifier to accumulate as many errors as possible, rather than stopping at the first one.

If a single error is found, that error will be returned. Otherwise, the resulting error type will be Error::Multiple.

Example
if let Err(e) = Mistrust::new().verifier().all_errors().check("/home/gardenGnostic/.gnupg/") {
   for error in e.errors() {
      println!("{}", e)
   }
}

Configure this verifier so that, after checking the directory, check all of its contents.

Symlinks are not permitted; both files and directories are allowed. This option implies require_directory(), since only a directory can have contents.

Requires that the walkdir feature is enabled.

Check whether the file or directory at path conforms to the requirements of this Verifier and the Mistrust that created it.

Check whether path is a valid directory, and create it if it doesn’t exist.

Returns Ok if the directory already existed or if it was just created, and it conforms to the requirements of this Verifier and the Mistrust that created it.

Return an error if:

  • there was a permissions or ownership problem in the path or any of its ancestors,
  • there was a problem when creating the directory
  • after creating the directory, we found that it had a permissions or ownership problem.

Check whether path is a directory conforming to the requirements of this Verifier and the Mistrust that created it.

If it is, then return a new CheckedDir that can be used to securely access the contents of this directory.

Check whether path is a directory conforming to the requirements of this Verifier and the Mistrust that created it.

If successful, then return a new CheckedDir that can be used to securely access the contents of this directory.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.