trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.87k stars 76 forks source link

Portable C binding #822

Closed squell closed 7 months ago

squell commented 7 months ago

This will close #818 (verified on i386).

Note that the bindgen self-test that I edited don't really add much value: they're essentially testing that the [repr(C)] layout is as we expect it to be, but they go a bit beyond what a C compiler would have to guarantee; and even if the layout of these structs is different, it would still mean our PAM bindings would be correct anyway. The only important bit is that the Rust spec given matches the actual C prototypes.

Which is a given, since PAM is an extremely stable API.

This can be reviewed commit-by-commit.

squell commented 7 months ago

Note: we should probably also add "build on a 32-bit platform" to the CI after this pull request.

Also, perhaps the bindgen scripts might also be removed (or move to a "tools" directory for future reference), since running bindgen shouldn't be needed any more.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (2fa9234) 57.36% compared to head (3260252) 57.78%. Report is 9 commits behind head on main.

Files Patch % Lines
src/pam/mod.rs 0.00% 8 Missing :warning:
src/pam/sys.rs 89.70% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #822 +/- ## ========================================== + Coverage 57.36% 57.78% +0.41% ========================================== Files 74 74 Lines 10559 10590 +31 ========================================== + Hits 6057 6119 +62 + Misses 4502 4471 -31 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.