-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[workspace] | ||
members = ["judge-core", "judger"] | ||
resolver = "2" | ||
members = ["judge-core", "judger", "runguard"] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "runguard" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
clap = { version = "4.5", features = ["derive"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# runguard | ||
|
||
A Rust version of | ||
[Domjudge runguard](https://github.com/DOMjudge/domjudge/blob/main/judge/runguard.cc) | ||
written in C++. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use clap::Parser; | ||
|
||
#[derive(Parser)] | ||
#[command( | ||
override_usage = "runguard [OPTION]... <COMMAND>...", | ||
about = "Run COMMAND with specified options.", | ||
after_help = "Note that root privileges are needed for the `root' and `user' options. \ | ||
If `user' is set, then `group' defaults to the same to prevent security issues, \ | ||
since otherwise the process would retain group root permissions. \ | ||
The COMMAND path is relative to the changed ROOT directory if specified. \ | ||
TIME may be specified as a float; two floats separated by `:' are treated as soft and hard limits. \ | ||
The runtime written to file is that of the last of wall/cpu time options set, \ | ||
and defaults to CPU time when neither is set. \ | ||
When run setuid without the `user' option, the user ID is set to the real user ID." | ||
)] | ||
struct Cli { | ||
/// run COMMAND with root directory set to ROOT | ||
#[arg(short, long)] | ||
root: String, | ||
|
||
/// run COMMAND as user with username or ID USER | ||
#[arg(short, long)] | ||
user: String, | ||
|
||
/// run COMMAND under group with name or ID GROUP | ||
#[arg(short, long)] | ||
group: String, | ||
|
||
#[arg(required = true)] | ||
command: Vec<String>, | ||
} | ||
|
||
fn main() { | ||
let _ = Cli::parse(); | ||
} |