ChocolateLoverRaj / pam-any

A PAM module that runs multiple other PAM modules in parallel, succeeding as long as one of them succeeds.
Apache License 2.0
8 stars 0 forks source link

Investigate and document thread safety requirements #3

Open tanriol opened 5 months ago

tanriol commented 5 months ago

According to pam(3)

The libpam interfaces are only thread-safe if each thread within the multithreaded application uses its own PAM handle.

Looks to me like the current implementation either is unsound due to violating libpam thread-safety requirements or relies on some internal libpam implementation details for soundness.

ChocolateLoverRaj commented 5 months ago

Is it even possible to have each thread use its own PAM handle?

ChocolateLoverRaj commented 5 months ago

If unsafe_send.rs was deleted and the solution in https://github.com/ChocolateLoverRaj/pam-any/pull/6#issuecomment-2008157250 was implemented would it meet PAM's thread safety requirements?

Also PAM should've been written in Rust so we wouldn't have to read documentation and could just confidently write safe code as long as we didn't use the word unsafe in this code.