Cargo build always fails?

Hi i have been trying to auto log in and start plasma-wayland on tty6 so trying to set up using pam but build always fails i have this basic main.rs

extern crate pam;
pub fn main() {
        let service = "<yourapp>";
        let user = "<user>";
        let password = "<pass>";

        let mut auth = pam::Authenticator::with_password(service).unwrap();
        auth.handler_mut().set_credentials(user, password);
        if auth.authenticate().is_ok() && auth.open_session().is_ok() {
            println!("Successfully opened a session!");
        }
        else {
            println!("Authentication failed =/");
        }
}

and pam = 0.8.0 in dependancies

[package]
name = "Gamescope"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pam = "0.8.0"

but build always fails with this

error[E0433]: failed to resolve: could not find `Authenticator` in `pam`
 --> src/main.rs:8:34
  |
8 |     let mut authenticator = pam::Authenticator::with_password(service).unwrap();
  |                                  ^^^^^^^^^^^^^ could not find `Authenticator` in `pam`

pam::Authenticator only exists in the 0.7.0 version. In the 0.8.0 version it looks like you want pam::Client.

Note that you also don't need the extern crate pam; at the top of your file.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.