Skip to content

Commit cae0e67

Browse files
authored
Merge pull request #70 from LeChatP/optimize
Optimize RootAsRole sr program
2 parents e7f67da + 8e9f016 commit cae0e67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+11123
-6298
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
container:
1616
image: xd009642/tarpaulin:develop-nightly
17-
options: --security-opt seccomp=unconfined
17+
options: --security-opt seccomp=unconfined --privileged
1818
steps:
1919
- name: Checkout code
2020
uses: actions/checkout@v2

.vscode/launch.json

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,14 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "(gdb) Test",
9-
"type": "cppdbg",
10-
"request": "launch",
11-
"preLaunchTask": "make build_unit_test",
12-
"program": "${workspaceFolder}/bin/unit_test",
13-
"args": [],
14-
"stopAtEntry": false,
15-
"cwd": "${fileDirname}",
16-
"environment": [],
17-
"externalConsole": false,
18-
"MIMode": "gdb",
19-
"setupCommands": [
20-
{
21-
"description": "Enable pretty-printing for gdb",
22-
"text": "-enable-pretty-printing",
23-
"ignoreFailures": true
24-
},
25-
{
26-
"description": "Set Disassembly Flavor to Intel",
27-
"text": "-gdb-set disassembly-flavor intel",
28-
"ignoreFailures": true
29-
},
30-
{ "description": "The new process is debugged after a fork. The parent process runs unimpeded.",
31-
"text": "-gdb-set follow-fork-mode child",
32-
"ignoreFailures": true
33-
}
34-
]
35-
},
36-
{
37-
"name": "(gdb) Launch",
38-
"type": "cppdbg",
8+
"type": "lldb",
399
"request": "launch",
40-
"preLaunchTask": "setcap",
41-
"program": "/usr/bin/sr",
10+
"name": "Launch",
11+
"program": "${workspaceFolder}/target/debug/sr",
4212
"args": ["ls"],
43-
"stopAtEntry": false,
44-
"cwd": "${fileDirname}",
45-
"environment": [],
46-
"externalConsole": false,
47-
"MIMode": "gdb",
48-
"miDebuggerPath": "${workspaceFolder}/.vscode/gdb_root.sh",
49-
"setupCommands": [
50-
{
51-
"description": "Enable pretty-printing for gdb",
52-
"text": "-enable-pretty-printing",
53-
"ignoreFailures": true
54-
},
55-
{
56-
"description": "Set Disassembly Flavor to Intel",
57-
"text": "-gdb-set disassembly-flavor intel",
58-
"ignoreFailures": true
59-
}
60-
],
13+
"cwd": "${workspaceFolder}"
6114
}
15+
16+
6217
]
6318
}

.vscode/tasks.json

Lines changed: 2 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,14 @@
66
}
77
},
88
"tasks": [
9-
{
10-
"type": "cppbuild",
11-
"label": "C/C++: gcc build active file",
12-
"command": "/usr/bin/gcc",
13-
"args": [
14-
"-fdiagnostics-color=always",
15-
"-g",
16-
"${file}",
17-
"-o",
18-
"${fileDirname}/${fileBasenameNoExtension}"
19-
],
20-
"options": {
21-
"cwd": "${fileDirname}"
22-
},
23-
"problemMatcher": [
24-
"$gcc"
25-
],
26-
"group": {
27-
"kind": "build",
28-
"isDefault": true
29-
},
30-
"detail": "Task generated by Debugger."
31-
},
32-
{
33-
"type": "shell",
34-
"label": "make",
35-
"command": "sudo",
36-
"args": [
37-
"-E",
38-
"/usr/bin/make",
39-
"install"
40-
],
41-
"options": {
42-
"cwd": "${cwd}"
43-
},
44-
"problemMatcher": [
45-
"$gcc"
46-
],
47-
"group": {
48-
"kind": "build",
49-
"isDefault": true
50-
},
51-
"detail": "Task generated by Debugger."
52-
},
9+
5310
{
5411
"type": "shell",
5512
"label": "setcap",
56-
"dependsOn": "make",
5713
"command": "sudo",
5814
"args": [
5915
"/usr/bin/setcap",
60-
"=eip",
16+
"=p",
6117
"${cwd}/bin/sr"
6218
],
6319
"options": {
@@ -66,58 +22,6 @@
6622
"group": {
6723
"kind": "none"
6824
}
69-
},
70-
{
71-
"type": "shell",
72-
"label": "make build_unit_test",
73-
"command": "sudo",
74-
"args": [
75-
"/usr/bin/make",
76-
"build_unit_test"
77-
],
78-
"options": {
79-
"cwd": "${workspaceFolder}",
80-
"env": {
81-
"GDB_DEBUG": "1",
82-
"DEBUG": "1"
83-
}
84-
},
85-
"problemMatcher": [
86-
"$gcc"
87-
],
88-
"group": {
89-
"kind": "build",
90-
"isDefault": true
91-
},
92-
"detail": "Task generated by Debugger."
93-
},
94-
{
95-
"type": "shell",
96-
"label": "debug unit_test",
97-
"dependsOn": "make build_unit_test",
98-
"command": "${cwd}/bin/unit_test",
99-
"args": [
100-
"--debug=gdb"
101-
],
102-
"options": {
103-
"cwd": "${cwd}"
104-
},
105-
"isBackground": true,
106-
"problemMatcher": {
107-
"pattern": [
108-
{
109-
"regexp": ".",
110-
"file": 1,
111-
"location": 2,
112-
"message": 3
113-
}
114-
],
115-
"background": {
116-
"activeOnStart": true,
117-
"beginsPattern": ".",
118-
"endsPattern": "Listening on port"
119-
}
120-
}
12125
}
12226

12327
],

Cargo.toml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["xtask", "rar-common"]
44
[package]
55
name = "rootasrole"
66
# The project version is managed on json file in resources/rootasrole.json
7-
version = "3.0.6"
7+
version = "3.1.0"
88
rust-version = "1.76.0"
99
authors = ["Eddie Billoir <eddie.billoir@irit.fr>"]
1010
edition = "2021"
@@ -25,9 +25,17 @@ maintainance ={ status = "actively-maintained", badge = "https://img.shields.io/
2525
[profile.release]
2626
strip = "symbols"
2727
lto = true
28-
opt-level = "s"
28+
opt-level = 3
2929
codegen-units = 1
3030

31+
[profile.profiling]
32+
strip = "none"
33+
lto = false
34+
opt-level = 1
35+
inherits = "release"
36+
debug = true
37+
38+
3139
#[features]
3240
#cursive_lib = [ "cursive" ]
3341
#srlibs = [ "pam-client", "bitflags" ]
@@ -45,6 +53,7 @@ path = "src/chsr/main.rs"
4553
[features]
4654
default = ["finder"]
4755
finder = ["dep:pcre2", "rar-common/pcre2", "rar-common/finder"]
56+
pcre2 = ["dep:pcre2", "rar-common/pcre2"]
4857

4958
[lints.rust]
5059
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(tarpaulin_include)'] }
@@ -65,7 +74,7 @@ capctl = "0.2"
6574
pcre2 = { version = "0.2", optional = true }
6675
serde = { version = "1.0", features=["rc", "derive"] }
6776
serde_json = "1.0"
68-
ciborium = "0.2"
77+
cbor4ii = { version = "1.0.0", features = ["serde", "serde1", "use_std"] }
6978
glob = "0.3"
7079
pam-client2 = "0.5"
7180
bitflags = { version = "2.6" }
@@ -80,6 +89,8 @@ pest = "2.7"
8089
pest_derive = "2.7"
8190
const_format = "0.2"
8291
hex = "0.4"
92+
bon = "3.5.1"
93+
serde_json_borrow = "0.7.1"
8394

8495
[dev-dependencies]
8596
log = "0.4"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<!-- The project version is managed on json file in resources/rootasrole.json -->
1717
<!-- markdownlint-restore -->
1818

19-
# RootAsRole (V3.0.6) : A memory-safe and security-oriented alternative to sudo/su commands
19+
# RootAsRole (V3.1.0) : A memory-safe and security-oriented alternative to sudo/su commands
2020

2121
**RootAsRole** is a project to allow Linux/Unix administrators to delegate their administrative tasks access rights to users. Its main features are :
2222

build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn set_readme_version(package_version: &str, file: &str) -> Result<(), Box<dyn E
5353
Ok(())
5454
}
5555

56-
fn main() {
56+
fn main() {
5757
println!("cargo:rerun-if-changed=Cargo.toml");
5858
println!("cargo:rerun-if-changed=build.rs");
5959

@@ -77,6 +77,4 @@ fn main() {
7777
if let Err(err) = set_readme_version(&package_version, "README.md") {
7878
eprintln!("cargo:warning={}", err);
7979
}
80-
81-
8280
}

rar-common/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rootasrole-core"
3-
version = "3.0.6"
3+
version = "3.1.0"
44
edition = "2021"
55
description = "This core crate contains the RBAC and main features for the RootAsRole project."
66
license = "LGPL-3.0-or-later"
@@ -27,7 +27,7 @@ log = "0.4"
2727
syslog = "7.0"
2828
env_logger = "0.11"
2929
bon = { version = "3.3.2", features = ["experimental-overwritable"] }
30-
ciborium = "0.2.2"
30+
cbor4ii = { version = "1.0.0", features = ["serde", "serde1", "use_std"] }
3131

3232
[dev-dependencies]
3333
log = "0.4"

0 commit comments

Comments
 (0)