1 unstable release

Uses old Rust 2015

0.0.1 Jan 14, 2017

#64 in #entries

22 downloads per month

MIT license

4KB
70 lines

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); 

Dependencies

~42KB