From a7215a4a12f89d10052b284dbbcaac9f8756ee64 Mon Sep 17 00:00:00 2001 From: Stephen Touset Date: Tue, 12 Oct 2021 16:05:02 -0700 Subject: [PATCH] Move raw example to deny_everything-raw --- Cargo.toml | 2 +- Dockerfile | 18 +++++++------- .../Cargo.toml | 2 +- .../LICENSE-APACHE | 0 .../src/lib.rs | 6 +++++ sudo_plugin-sys/README.md | 24 +++++++++---------- 6 files changed, 29 insertions(+), 23 deletions(-) rename examples/{raw_plugin_api => deny_everything-raw}/Cargo.toml (95%) rename examples/{raw_plugin_api => deny_everything-raw}/LICENSE-APACHE (100%) rename examples/{raw_plugin_api => deny_everything-raw}/src/lib.rs (97%) diff --git a/Cargo.toml b/Cargo.toml index 8aebb62..fca438f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,5 @@ members = [ 'sudo_plugin-sys', 'sudo_pair', - 'examples/raw_plugin_api', + 'examples/deny_everything-raw', ] diff --git a/Dockerfile b/Dockerfile index bbd2707..5c4dd7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,15 +38,15 @@ FROM build AS sudo_pair-deps RUN cargo new --lib sudo_plugin-sys RUN cargo new --lib sudo_plugin RUN cargo new --lib sudo_pair -RUN cargo new --lib examples/raw_plugin_api - -COPY Cargo.toml . -COPY sudo_plugin-sys/Cargo.toml ./sudo_plugin-sys -COPY sudo_plugin-sys/build.rs ./sudo_plugin-sys -COPY sudo_plugin-sys/src/bindings ./sudo_plugin-sys/src/bindings -COPY sudo_plugin/Cargo.toml ./sudo_plugin -COPY sudo_pair/Cargo.toml ./sudo_pair -COPY examples/raw_plugin_api/Cargo.toml ./examples/raw_plugin_api +RUN cargo new --lib examples/deny_everything-raw + +COPY Cargo.toml . +COPY sudo_plugin-sys/Cargo.toml ./sudo_plugin-sys +COPY sudo_plugin-sys/build.rs ./sudo_plugin-sys +COPY sudo_plugin-sys/src/bindings ./sudo_plugin-sys/src/bindings +COPY sudo_plugin/Cargo.toml ./sudo_plugin +COPY sudo_pair/Cargo.toml ./sudo_pair +COPY examples/deny_everything-raw/Cargo.toml ./examples/deny_everything-raw RUN --mount=type=cache,target=/tmp/cache/cargo \ --mount=type=cache,target=/tmp/cache/target,sharing=private \ diff --git a/examples/raw_plugin_api/Cargo.toml b/examples/deny_everything-raw/Cargo.toml similarity index 95% rename from examples/raw_plugin_api/Cargo.toml rename to examples/deny_everything-raw/Cargo.toml index 6d02d82..735d868 100644 --- a/examples/raw_plugin_api/Cargo.toml +++ b/examples/deny_everything-raw/Cargo.toml @@ -7,7 +7,7 @@ edition = '2018' authors = ['Stephen Touset '] description = 'sudo approval plugin that denies everything' -homepage = 'https://github.com/square/sudo_pair/tree/master/examples/raw_plugin_api' +homepage = 'https://github.com/square/sudo_pair/tree/master/examples/deny_everything-raw' repository = 'https://github.com/square/sudo_pair.git' readme = 'README.md' diff --git a/examples/raw_plugin_api/LICENSE-APACHE b/examples/deny_everything-raw/LICENSE-APACHE similarity index 100% rename from examples/raw_plugin_api/LICENSE-APACHE rename to examples/deny_everything-raw/LICENSE-APACHE diff --git a/examples/raw_plugin_api/src/lib.rs b/examples/deny_everything-raw/src/lib.rs similarity index 97% rename from examples/raw_plugin_api/src/lib.rs rename to examples/deny_everything-raw/src/lib.rs index bb4ad78..0dc3cec 100644 --- a/examples/raw_plugin_api/src/lib.rs +++ b/examples/deny_everything-raw/src/lib.rs @@ -1,4 +1,10 @@ //! An example minimal sudo approval plugin that denies all actions. +//! +//! # Usage +//! +//! ``` +//! Plugin deny_everything deny_everything.so +//! ``` #![warn(future_incompatible)] #![warn(nonstandard_style)] diff --git a/sudo_plugin-sys/README.md b/sudo_plugin-sys/README.md index 1218e0a..003629d 100644 --- a/sudo_plugin-sys/README.md +++ b/sudo_plugin-sys/README.md @@ -51,10 +51,10 @@ find a use-case that requires this, please [let us know][new-issue]. This project simply exposes the raw sudo plugin API bindings to Rust. While these raw FFI bindings may be used directly, we encourage the use of a safe -wrapper such as the [sudo_plugin][sudo_plugin] project. +wrapper such as the [sudo_plugin] project. For a demonstration of how to use the raw FFI bindings directly, see the -[raw_plugin_api][raw_plugin_api] example project. +[deny_everything-raw] example project. ## Contributions @@ -70,13 +70,13 @@ openly. `sudo_plugin-sys` is distributed under the terms of the [Apache License, Version 2.0][license]. -[badge-build]: https://github.com/square/sudo_pair/actions/workflows/rust.yml -[badge-docs]: https://docs.rs/sudo_plugin-sys -[badge-crate]: https://crates.io/crates/sudo_plugin-sys -[license]: https://github.com/square/sudo_pair/blob/master/LICENSE-APACHE -[new-issue]: https://github.com/square/sudo_pair/issues/new -[raw_plugin_api]: ../examples/raw_plugin_api/ -[sudo_plugin]: ../sudo_plugin/README.md -[square-cla]: https://cla-assistant.io/square/sudo_pair -[square-open-source]: https://square.github.io/ -[sudo_plugin_man]: https://www.sudo.ws/man/sudo_plugin.man.html +[badge-build]: https://github.com/square/sudo_pair/actions/workflows/rust.yml +[badge-docs]: https://docs.rs/sudo_plugin-sys +[badge-crate]: https://crates.io/crates/sudo_plugin-sys +[license]: https://github.com/square/sudo_pair/blob/master/LICENSE-APACHE +[new-issue]: https://github.com/square/sudo_pair/issues/new +[deny_everything-raw]: ../examples/deny_everything-raw/ +[sudo_plugin]: ../sudo_plugin/README.md +[square-cla]: https://cla-assistant.io/square/sudo_pair +[square-open-source]: https://square.github.io/ +[sudo_plugin_man]: https://www.sudo.ws/man/sudo_plugin.man.html