shadow 0.0.1

Bindings for libc /etc/shadow password functions
Documentation
  • Coverage
  • 100%
    13 out of 13 items documented1 out of 5 items with examples
  • Size
  • Source code size: 4.89 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 972.43 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • ids1024/shadow-rs
    2 5 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ids1024

This modules provides a wrapper around the libc functions in shadow.h for handling the /etc/shadow file, which stores encrypted password for users.

It should work under Linux and some other Unix variants. Root permission is necessary to access the shadow file.

Since the relevant functions in libc are not thread-safe, this library is not either.

Examples

Print all shadow entries:

for i in shadow::Shadow::iter_all() {
    println!("{:?}", i);
}

Verify password is correct (requires pwhash):

let hash = shadow::Shadow::from_name("username").unwrap();
let correct = pwhash::unix::verify("password", &hash.password);
println!("Password correct: {}", correct);