ChocolateLoverRaj/pam-any

Should there be a (unsafe) gross hack mode?

Open

#15 opened on May 23, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (4 forks)auto 404
help wanted

Repository metrics

Stars
 (34 stars)
PR merge metrics
 (PR metrics pending)

Description

Based on https://github.com/lvkv/pam-rs/issues/13 and #3 , I determined that pam_conv (which is the Conv struct in the Rust bindings) cannot be sent across threads, and the unsafe send marking of Conv is not correct. I'm pretty sure pam-fprint-grosshack also sends pam_conv across threads and breaks the same rule that we do.

Sending Conv to another thread is needed in order to return from the sm_authenticate function before a prompt is complete. WIthout sending Conv to another thread, it would be less convenient for the user.

I see two options:

  • Remove gross hack mode completely
  • Remove gross hack mode by default but leave it as an option

I decided that I will add a gross hack mode if there is demand for it. However, it would be two separate binaries, one with 100% safe Rust (without gross hack), and one with the unsafe send on Conv (for gross hack). This way it isolates the unsafe from affecting non-gross hack usage.

Contributor guide