I want to implement a sudo plugin in Rust. The plugin should implement a C API that specified in
man 5 sudo_plugin. It defines some data structures and function signiature.
Is it possible to implement a shared library in Rust that compatible with C API that defined in given header files of sudo plugin?
Yes! I haven't done so myself, so others would be better able to answer specific questions. But the Rustonomicon entry on FFI will probably have a lot of useful info for you.
Also, you may want to look at bindgen to automatically convert the C headers to Rust type definitions.
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.