Skip to content

Commit 33b9ecd

Browse files
committed
Add sudo-rs package.
This uses a patch I had to write to get it to build on arm, we can drop after the next release. Signed-off-by: Dan Lorenc <[email protected]>
1 parent ad5e189 commit 33b9ecd

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

packages.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,4 +859,5 @@ corepack
859859
esbuild
860860
ruff
861861
oranda
862+
sudo-rs
862863
jwt-tool

sudo-rs.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package:
2+
name: sudo-rs
3+
# When bumping, change the tag below until there's a stable scheme
4+
version: 0.2.0_pre20230703
5+
epoch: 0
6+
description: A memory safe implementation of sudo and su.
7+
copyright:
8+
- license: MIT
9+
10+
environment:
11+
contents:
12+
packages:
13+
- ca-certificates-bundle
14+
- busybox
15+
- build-base
16+
- rust
17+
- openssl-dev
18+
- linux-pam-dev
19+
20+
pipeline:
21+
- uses: git-checkout
22+
with:
23+
repository: https://github.com/memorysafety/sudo-rs
24+
tag: v0.2.0-dev.20230703
25+
expected-commit: cad7e94744ad4d02e82f76a80bf6ca73b266dbc6
26+
27+
- uses: patch
28+
with:
29+
# Patch source: https://github.com/memorysafety/sudo-rs/pull/653
30+
patches: arm.patch
31+
32+
- runs: |
33+
cargo build --release
34+
mkdir -p ${{targets.destdir}}/usr/bin
35+
mv target/release/sudo ${{targets.destdir}}/usr/bin/
36+
mv target/release/su ${{targets.destdir}}/usr/bin/
37+
chmomd u+s ${{targets.destdir}}/usr/bin/sudo
38+
chmomd u+s ${{targets.destdir}}/usr/bin/su
39+
40+
- uses: strip
41+
42+
update:
43+
enabled: false

sudo-rs/arm.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/src/pam/mod.rs b/src/pam/mod.rs
2+
index 9eec40c..d46c795 100644
3+
--- a/src/pam/mod.rs
4+
+++ b/src/pam/mod.rs
5+
@@ -2,6 +2,7 @@ use std::{
6+
collections::HashMap,
7+
ffi::{CStr, CString, OsStr, OsString},
8+
os::unix::prelude::OsStrExt,
9+
+ os::raw::c_char,
10+
};
11+
12+
use converse::ConverserData;
13+
@@ -214,7 +215,7 @@ impl<C: Converser> PamContext<C> {
14+
}
15+
16+
// unsafe conversion to cstr
17+
- let cstr = unsafe { CStr::from_ptr(data as *const i8) };
18+
+ let cstr = unsafe { CStr::from_ptr(data as *const c_char) };
19+
20+
Ok(cstr.to_str()?.to_owned())
21+
}
22+

0 commit comments

Comments
 (0)