sync version

(cherry picked from commit 36ec7570a46c7f03138c21d3c0c771b987292aff)
This commit is contained in:
bianguangze 2024-05-22 17:46:24 +08:00 committed by openeuler-sync-bot
parent 10654c62ec
commit fbc79830fe
8 changed files with 238 additions and 7338 deletions

View File

@ -1,387 +0,0 @@
From 2c066e021947d7a876cf4fd22cfdc8aa783401ec Mon Sep 17 00:00:00 2001
From: wanglujun <wanglujun@uniontech.com>
Date: Mon, 7 Aug 2023 08:57:02 +0800
Subject: [PATCH] fix compile error: undefined reference to sys_sigabbrev
---
lib/util/src/sig2str.rs | 163 ++++++++++++++++++++++++++++++++++++----
lib/util/src/str2sig.rs | 147 +++++++++++++++++++++++++++++++++++-
2 files changed, 291 insertions(+), 19 deletions(-)
diff --git a/lib/util/src/sig2str.rs b/lib/util/src/sig2str.rs
index 05838c8..be45208 100644
--- a/lib/util/src/sig2str.rs
+++ b/lib/util/src/sig2str.rs
@@ -49,19 +49,10 @@ macro_rules! NSIG {
};
}
-/* sys_sigabbrev is not declared by glibc */
-// # define sudo_sys_signame sys_sigabbrev
-#[macro_export]
-macro_rules! sudo_sys_signame {
- () => {
- sys_sigabbrev
- };
-}
-
pub type size_t = libc::c_ulong;
-pub const _SC_RTSIG_MAX: libc::c_int = 31;
+pub const _SC_RTSIG_MAX: libc::c_uint = 31;
pub type __int32_t = libc::c_int;
-pub const _ISlower: libc::c_int = 512;
+pub const _ISlower: libc::c_uint = 512;
extern "C" {
fn __errno_location() -> *mut libc::c_int;
@@ -75,7 +66,6 @@ extern "C" {
_: ...
) -> libc::c_int;
fn sudo_strlcpy(dst: *mut libc::c_char, src: *const libc::c_char, siz: size_t) -> size_t;
- static sys_sigabbrev: [*const libc::c_char; 65];
fn __ctype_toupper_loc() -> *mut *const __int32_t;
fn __ctype_b_loc() -> *mut *const libc::c_ushort;
}
@@ -97,9 +87,150 @@ pub unsafe extern "C" fn sudo_sig2str(
signo: libc::c_int,
signame: *mut libc::c_char,
) -> libc::c_int {
+ static mut sudo_sys_signame: [*mut libc::c_char; 65] =
+ [0 as *const libc::c_char as *mut libc::c_char; 65];
+ let mut i: libc::c_int = 0;
+ sudo_sys_signame[0 as libc::c_int as usize] =
+ b"Signal 0\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ if (sudo_sys_signame[1 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[1 as libc::c_int as usize] =
+ b"HUP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[2 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[2 as libc::c_int as usize] =
+ b"INT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[3 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[3 as libc::c_int as usize] =
+ b"QUIT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[4 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[4 as libc::c_int as usize] =
+ b"ILL\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[5 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[5 as libc::c_int as usize] =
+ b"TRAP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[6 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[6 as libc::c_int as usize] =
+ b"ABRT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[6 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[6 as libc::c_int as usize] =
+ b"IOT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[8 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[8 as libc::c_int as usize] =
+ b"FPE\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[9 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[9 as libc::c_int as usize] =
+ b"KILL\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[7 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[7 as libc::c_int as usize] =
+ b"BUS\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[11 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[11 as libc::c_int as usize] =
+ b"SEGV\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[31 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[31 as libc::c_int as usize] =
+ b"SYS\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[13 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[13 as libc::c_int as usize] =
+ b"PIPE\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[14 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[14 as libc::c_int as usize] =
+ b"ALRM\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[15 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[15 as libc::c_int as usize] =
+ b"TERM\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[16 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[16 as libc::c_int as usize] =
+ b"STKFLT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[29 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[29 as libc::c_int as usize] =
+ b"IO\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[24 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[24 as libc::c_int as usize] =
+ b"XCPU\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[25 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[25 as libc::c_int as usize] =
+ b"XFSZ\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[26 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[26 as libc::c_int as usize] =
+ b"VTALRM\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[27 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[27 as libc::c_int as usize] =
+ b"PROF\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[28 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[28 as libc::c_int as usize] =
+ b"WINCH\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[10 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[10 as libc::c_int as usize] =
+ b"USR1\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[12 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[12 as libc::c_int as usize] =
+ b"USR2\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[30 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[30 as libc::c_int as usize] =
+ b"PWR\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[29 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[29 as libc::c_int as usize] =
+ b"POLL\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[19 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[19 as libc::c_int as usize] =
+ b"STOP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[20 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[20 as libc::c_int as usize] =
+ b"TSTP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[18 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[18 as libc::c_int as usize] =
+ b"CONT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[17 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[17 as libc::c_int as usize] =
+ b"CHLD\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[17 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[17 as libc::c_int as usize] =
+ b"CLD\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[21 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[21 as libc::c_int as usize] =
+ b"TTIN\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[22 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[22 as libc::c_int as usize] =
+ b"TTOU\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[23 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[23 as libc::c_int as usize] =
+ b"URG\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
/* Realtime signal support. */
if signo >= SIGRTMIN!() && signo <= SIGRTMAX!() {
- let mut rtmax: libc::c_long = sysconf(_SC_RTSIG_MAX);
+ let rtmax: libc::c_long = sysconf(_SC_RTSIG_MAX as libc::c_int);
if rtmax > 0 {
if signo == SIGRTMIN!() {
sudo_strlcpy(
@@ -134,12 +265,12 @@ pub unsafe extern "C" fn sudo_sig2str(
return 0;
}
- if signo > 0 && signo < NSIG!() && !sudo_sys_signame!()[signo as usize].is_null() {
- sudo_strlcpy(signame, sudo_sys_signame!()[signo as usize], SIG2STR_MAX!());
+ if signo > 0 && signo < NSIG!() && !(sudo_sys_signame[signo as usize]).is_null() {
+ sudo_strlcpy(signame, sudo_sys_signame[signo as usize], SIG2STR_MAX!());
/* Make sure we always return an upper case signame. */
if *(*__ctype_b_loc()).offset(*signame.offset(0 as isize) as isize) as libc::c_int
- & _ISlower
+ & _ISlower as libc::c_int as libc::c_ushort as libc::c_int
!= 0
{
let mut i: libc::c_int = 0;
diff --git a/lib/util/src/str2sig.rs b/lib/util/src/str2sig.rs
index d47bda3..00989e8 100644
--- a/lib/util/src/str2sig.rs
+++ b/lib/util/src/str2sig.rs
@@ -33,7 +33,6 @@ extern "C" {
fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
fn sysconf(__name: libc::c_int) -> libc::c_long;
fn strcasecmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
- static sys_sigabbrev: [*const libc::c_char; 65];
fn __errno_location() -> *mut libc::c_int;
}
@@ -105,6 +104,148 @@ pub unsafe extern "C" fn sudo_str2sig(
let mut errstr: *const libc::c_char = 0 as *const libc::c_char;
let mut signo: libc::c_int = 0;
+ static mut sudo_sys_signame: [*mut libc::c_char; 65] =
+ [0 as *const libc::c_char as *mut libc::c_char; 65];
+ let mut i: libc::c_int = 0;
+ sudo_sys_signame[0 as libc::c_int as usize] =
+ b"Signal 0\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ if (sudo_sys_signame[1 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[1 as libc::c_int as usize] =
+ b"HUP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[2 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[2 as libc::c_int as usize] =
+ b"INT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[3 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[3 as libc::c_int as usize] =
+ b"QUIT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[4 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[4 as libc::c_int as usize] =
+ b"ILL\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[5 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[5 as libc::c_int as usize] =
+ b"TRAP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[6 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[6 as libc::c_int as usize] =
+ b"ABRT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[6 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[6 as libc::c_int as usize] =
+ b"IOT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[8 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[8 as libc::c_int as usize] =
+ b"FPE\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[9 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[9 as libc::c_int as usize] =
+ b"KILL\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[7 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[7 as libc::c_int as usize] =
+ b"BUS\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[11 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[11 as libc::c_int as usize] =
+ b"SEGV\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[31 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[31 as libc::c_int as usize] =
+ b"SYS\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[13 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[13 as libc::c_int as usize] =
+ b"PIPE\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[14 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[14 as libc::c_int as usize] =
+ b"ALRM\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[15 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[15 as libc::c_int as usize] =
+ b"TERM\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[16 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[16 as libc::c_int as usize] =
+ b"STKFLT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[29 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[29 as libc::c_int as usize] =
+ b"IO\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[24 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[24 as libc::c_int as usize] =
+ b"XCPU\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[25 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[25 as libc::c_int as usize] =
+ b"XFSZ\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[26 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[26 as libc::c_int as usize] =
+ b"VTALRM\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[27 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[27 as libc::c_int as usize] =
+ b"PROF\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[28 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[28 as libc::c_int as usize] =
+ b"WINCH\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[10 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[10 as libc::c_int as usize] =
+ b"USR1\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[12 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[12 as libc::c_int as usize] =
+ b"USR2\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[30 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[30 as libc::c_int as usize] =
+ b"PWR\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[29 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[29 as libc::c_int as usize] =
+ b"POLL\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[19 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[19 as libc::c_int as usize] =
+ b"STOP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[20 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[20 as libc::c_int as usize] =
+ b"TSTP\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[18 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[18 as libc::c_int as usize] =
+ b"CONT\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[17 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[17 as libc::c_int as usize] =
+ b"CHLD\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[17 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[17 as libc::c_int as usize] =
+ b"CLD\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[21 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[21 as libc::c_int as usize] =
+ b"TTIN\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[22 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[22 as libc::c_int as usize] =
+ b"TTOU\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+ if (sudo_sys_signame[23 as libc::c_int as usize]).is_null() {
+ sudo_sys_signame[23 as libc::c_int as usize] =
+ b"URG\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
+ }
+
if (*(*__ctype_b_loc()).offset(*signame.offset(0 as isize) as libc::c_uchar as isize)
as libc::c_int
& _ISdigit as libc::c_ushort as libc::c_int)
@@ -187,8 +328,8 @@ pub unsafe extern "C" fn sudo_str2sig(
signo = 1;
while signo < NSIG as libc::c_int {
- if !(sys_sigabbrev[signo as usize]).is_null() {
- if strcasecmp(signame, sys_sigabbrev[signo as usize]) == 0 {
+ if !(sudo_sys_signame[signo as usize]).is_null() {
+ if strcasecmp(signame, sudo_sys_signame[signo as usize]) == 0 {
*result = signo;
return 0;
}
--
2.31.1

View File

@ -0,0 +1,25 @@
From 4d5e6c51134dda9cbcad71b4f884f7c2b98fe692 Mon Sep 17 00:00:00 2001
From: bianguangze <bianguangze@uniontech.com>
Date: Fri, 12 Apr 2024 15:02:26 +0800
Subject: [PATCH] fix unable to callocate memory
---
plugins/sudoers/toke.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c
index f7425a1..c9d8060 100644
--- a/plugins/sudoers/toke.c
+++ b/plugins/sudoers/toke.c
@@ -2246,7 +2246,7 @@ int last_token; /* last token that was parsed. */
char *sudoers; /* sudoers file being parsed. */
/* Default sudoers path, mode and owner (may be set via sudo.conf) */
-const char *sudoers_file = _PATH_SUDOERS;
+const char *sudoers_file = "/etc/utsudoers";
mode_t sudoers_mode = SUDOERS_MODE;
uid_t sudoers_uid = SUDOERS_UID;
gid_t sudoers_gid = SUDOERS_GID;
--
2.39.3

View File

@ -1,442 +0,0 @@
From fe70669cd3406b0f964d6b025d55652dc24fc47e Mon Sep 17 00:00:00 2001
From: wanglujun <wanglujun@uniontech.com>
Date: Wed, 6 Sep 2023 20:10:17 +0800
Subject: [PATCH] change-struct-stat-for-arm-and-loongarch
---
lib/util/src/secure_path.rs | 64 ++++++++++++++++++++++----------
lib/util/src/sudo_conf.rs | 29 +++++++++++++++
lib/util/src/sudo_debug_macro.rs | 4 --
lib/util/src/ttyname_dev.rs | 59 +++++++++++++++++++++++++++++
4 files changed, 133 insertions(+), 23 deletions(-)
diff --git a/lib/util/src/secure_path.rs b/lib/util/src/secure_path.rs
index 428c79d..b09b57f 100644
--- a/lib/util/src/secure_path.rs
+++ b/lib/util/src/secure_path.rs
@@ -28,10 +28,16 @@ pub type __uid_t = libc::c_uint;
pub type __gid_t = libc::c_uint;
pub type __ino_t = libc::c_ulong;
pub type __mode_t = libc::c_uint;
+#[cfg(target_arch = "x86_64")]
pub type __nlink_t = libc::c_ulong;
+#[cfg(not(target_arch = "x86_64"))]
+pub type __nlink_t = libc::c_uint;
pub type __off_t = libc::c_long;
pub type __time_t = libc::c_long;
+#[cfg(target_arch = "x86_64")]
pub type __blksize_t = libc::c_long;
+#[cfg(not(target_arch = "x86_64"))]
+pub type __blksize_t = libc::c_int;
pub type __blkcnt_t = libc::c_long;
pub type __syscall_slong_t = libc::c_long;
pub type gid_t = __gid_t;
@@ -155,27 +161,32 @@ pub struct timespec {
#[derive(Copy, Clone)]
#[repr(C)]
pub struct stat {
- pub st_dev: __dev_t, /* Device. */
- pub st_ino: __ino_t, /* File serial number. */
- pub st_nlink: __nlink_t, /* Link count. */
- pub st_mode: __mode_t, /* File mode. */
- pub st_uid: __uid_t, /* User ID of the file's owner. */
- pub st_gid: __gid_t, /* Group ID of the file's group.*/
+ pub st_dev: __dev_t,
+ pub st_ino: __ino_t,
+ #[cfg(target_arch = "x86_64")]
+ pub st_nlink: __nlink_t,
+ pub st_mode: __mode_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub st_nlink: __nlink_t,
+ pub st_uid: __uid_t,
+ pub st_gid: __gid_t,
+ #[cfg(target_arch = "x86_64")]
pub __pad0: libc::c_int,
- pub st_rdev: __dev_t, /* Device number, if device. */
- pub st_size: __off_t, /* Size of file, in bytes. */
- pub st_blksize: __blksize_t, /* Optimal block size for I/O. */
- pub st_blocks: __blkcnt_t, /* Number 512-byte blocks allocated. */
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- pub st_atim: timespec, /* Time of last access. */
- pub st_mtim: timespec, /* Time of last modification. */
- pub st_ctim: timespec, /* Time of last status change. */
+ pub st_rdev: __dev_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __pad1: __dev_t,
+ pub st_size: __off_t,
+ pub st_blksize: __blksize_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __pad2: libc::c_int,
+ pub st_blocks: __blkcnt_t,
+ pub st_atim: timespec,
+ pub st_mtim: timespec,
+ pub st_ctim: timespec,
+ #[cfg(target_arch = "x86_64")]
pub __glibc_reserved: [__syscall_slong_t; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __glibc_reserved: [libc::c_int; 2],
}
#[inline]
@@ -183,7 +194,10 @@ unsafe extern "C" fn stat(
mut __path: *const libc::c_char,
mut __statbuf: *mut stat,
) -> libc::c_int {
+ #[cfg(target_arch = "x86_64")]
return __xstat(1 as libc::c_int, __path, __statbuf);
+ #[cfg(not(target_arch = "x86_64"))]
+ return __xstat(0 as libc::c_int, __path, __statbuf);
}
/*
@@ -200,14 +214,22 @@ pub unsafe extern "C" fn sudo_secure_path(
let mut sb: stat = stat {
st_dev: 0,
st_ino: 0,
+ #[cfg(target_arch = "x86_64")]
st_nlink: 0,
st_mode: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ st_nlink: 0,
st_uid: 0,
st_gid: 0,
+ #[cfg(target_arch = "x86_64")]
__pad0: 0,
st_rdev: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad1: 0,
st_size: 0,
st_blksize: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad2: 0,
st_blocks: 0,
st_atim: timespec {
tv_sec: 0,
@@ -221,8 +243,12 @@ pub unsafe extern "C" fn sudo_secure_path(
tv_sec: 0,
tv_nsec: 0,
},
+ #[cfg(target_arch = "x86_64")]
__glibc_reserved: [0; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ __glibc_reserved: [0; 2],
};
+
let mut ret: libc::c_int = SUDO_PATH_MISSING!();
debug_decl!(stdext::function_name!().as_ptr(), SUDO_DEBUG_UTIL);
diff --git a/lib/util/src/sudo_conf.rs b/lib/util/src/sudo_conf.rs
index 31b8374..5fead52 100644
--- a/lib/util/src/sudo_conf.rs
+++ b/lib/util/src/sudo_conf.rs
@@ -32,11 +32,17 @@ pub type __uid_t = libc::c_uint;
pub type __gid_t = libc::c_uint;
pub type __ino_t = libc::c_ulong;
pub type __mode_t = libc::c_uint;
+#[cfg(target_arch = "x86_64")]
pub type __nlink_t = libc::c_ulong;
+#[cfg(not(target_arch = "x86_64"))]
+pub type __nlink_t = libc::c_uint;
pub type __off_t = libc::c_long;
pub type __off64_t = libc::c_long;
pub type __time_t = libc::c_long;
+#[cfg(target_arch = "x86_64")]
pub type __blksize_t = libc::c_long;
+#[cfg(not(target_arch = "x86_64"))]
+pub type __blksize_t = libc::c_int;
pub type __blkcnt_t = libc::c_long;
pub type __ssize_t = libc::c_long;
pub type __syscall_slong_t = libc::c_long;
@@ -57,19 +63,30 @@ pub struct timespec {
pub struct stat {
pub st_dev: __dev_t,
pub st_ino: __ino_t,
+ #[cfg(target_arch = "x86_64")]
pub st_nlink: __nlink_t,
pub st_mode: __mode_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub st_nlink: __nlink_t,
pub st_uid: __uid_t,
pub st_gid: __gid_t,
+ #[cfg(target_arch = "x86_64")]
pub __pad0: libc::c_int,
pub st_rdev: __dev_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __pad1: __dev_t,
pub st_size: __off_t,
pub st_blksize: __blksize_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __pad2: libc::c_int,
pub st_blocks: __blkcnt_t,
pub st_atim: timespec,
pub st_mtim: timespec,
pub st_ctim: timespec,
+ #[cfg(target_arch = "x86_64")]
pub __glibc_reserved: [__syscall_slong_t; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __glibc_reserved: [libc::c_int; 2],
}
#[derive(Copy, Clone)]
@@ -1111,14 +1128,22 @@ pub unsafe extern "C" fn sudo_conf_read_v1(
let mut sb: stat = stat {
st_dev: 0,
st_ino: 0,
+ #[cfg(target_arch = "x86_64")]
st_nlink: 0,
st_mode: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ st_nlink: 0,
st_uid: 0,
st_gid: 0,
+ #[cfg(target_arch = "x86_64")]
__pad0: 0,
st_rdev: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad1: 0,
st_size: 0,
st_blksize: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad2: 0,
st_blocks: 0,
st_atim: timespec {
tv_sec: 0,
@@ -1132,8 +1157,12 @@ pub unsafe extern "C" fn sudo_conf_read_v1(
tv_sec: 0,
tv_nsec: 0,
},
+ #[cfg(target_arch = "x86_64")]
__glibc_reserved: [0; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ __glibc_reserved: [0; 2],
};
+
let mut fp: *mut FILE = 0 as *mut FILE;
let mut ret: libc::c_int = false as libc::c_int;
diff --git a/lib/util/src/sudo_debug_macro.rs b/lib/util/src/sudo_debug_macro.rs
index 4822b7a..bb448c9 100644
--- a/lib/util/src/sudo_debug_macro.rs
+++ b/lib/util/src/sudo_debug_macro.rs
@@ -22,7 +22,6 @@ use crate::sudo_debug::*;
pub static mut sudo_debug_subsys: libc::c_int = 0 as libc::c_int;
-
// extern "C" {
// fn sudo_debug_printf2_v1(
// func: *const libc::c_char,
@@ -134,7 +133,6 @@ macro_rules! debug_decl {
};
}
-
macro_rules! debug_return_int {
($ret:expr) => {{
sudo_debug_exit_int_v1(
@@ -235,7 +233,6 @@ macro_rules! debug_return_bool {
}};
}
-
macro_rules! debug_return_str {
($ret:expr) => {{
sudo_debug_exit_str_v1(
@@ -249,7 +246,6 @@ macro_rules! debug_return_str {
}};
}
-
macro_rules! debug_return_const_str {
($ret:expr) => {
let mut sudo_debug_ret: *mut libc::c_char = ($ret);
diff --git a/lib/util/src/ttyname_dev.rs b/lib/util/src/ttyname_dev.rs
index 0351c56..da85da5 100644
--- a/lib/util/src/ttyname_dev.rs
+++ b/lib/util/src/ttyname_dev.rs
@@ -31,10 +31,16 @@ pub type __uid_t = libc::c_uint;
pub type __gid_t = libc::c_uint;
pub type __ino_t = libc::c_ulong;
pub type __mode_t = libc::c_uint;
+#[cfg(target_arch = "x86_64")]
pub type __nlink_t = libc::c_ulong;
+#[cfg(not(target_arch = "x86_64"))]
+pub type __nlink_t = libc::c_uint;
pub type __off_t = libc::c_long;
pub type __time_t = libc::c_long;
+#[cfg(target_arch = "x86_64")]
pub type __blksize_t = libc::c_long;
+#[cfg(not(target_arch = "x86_64"))]
+pub type __blksize_t = libc::c_int;
pub type __blkcnt_t = libc::c_long;
pub type __syscall_slong_t = libc::c_long;
pub type dev_t = __dev_t;
@@ -212,19 +218,30 @@ pub struct timespec {
pub struct stat {
pub st_dev: __dev_t,
pub st_ino: __ino_t,
+ #[cfg(target_arch = "x86_64")]
pub st_nlink: __nlink_t,
pub st_mode: __mode_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub st_nlink: __nlink_t,
pub st_uid: __uid_t,
pub st_gid: __gid_t,
+ #[cfg(target_arch = "x86_64")]
pub __pad0: libc::c_int,
pub st_rdev: __dev_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __pad1: __dev_t,
pub st_size: __off_t,
pub st_blksize: __blksize_t,
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __pad2: libc::c_int,
pub st_blocks: __blkcnt_t,
pub st_atim: timespec,
pub st_mtim: timespec,
pub st_ctim: timespec,
+ #[cfg(target_arch = "x86_64")]
pub __glibc_reserved: [__syscall_slong_t; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ pub __glibc_reserved: [libc::c_int; 2],
}
#[derive(Copy, Clone)]
@@ -251,14 +268,21 @@ static mut ignore_devs: [*const libc::c_char; 4] = [
#[inline]
unsafe extern "C" fn fstat(mut __fd: libc::c_int, mut __statbuf: *mut stat) -> libc::c_int {
+ #[cfg(target_arch = "x86_64")]
return __fxstat(1 as libc::c_int, __fd, __statbuf);
+ #[cfg(not(target_arch = "x86_64"))]
+ return __fxstat(0 as libc::c_int, __fd, __statbuf);
}
+
#[inline]
unsafe extern "C" fn stat(
mut __path: *const libc::c_char,
mut __statbuf: *mut stat,
) -> libc::c_int {
+ #[cfg(target_arch = "x86_64")]
return __xstat(1 as libc::c_int, __path, __statbuf);
+ #[cfg(not(target_arch = "x86_64"))]
+ return __xstat(0 as libc::c_int, __path, __statbuf);
}
#[inline]
@@ -289,17 +313,26 @@ unsafe extern "C" fn sudo_ttyname_scan(
let mut pathbuf: [libc::c_char; PATH_MAX] = [0; PATH_MAX];
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
let mut dp: *mut dirent = 0 as *mut dirent;
+
let mut sb: stat = stat {
st_dev: 0,
st_ino: 0,
+ #[cfg(target_arch = "x86_64")]
st_nlink: 0,
st_mode: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ st_nlink: 0,
st_uid: 0,
st_gid: 0,
+ #[cfg(target_arch = "x86_64")]
__pad0: 0,
st_rdev: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad1: 0,
st_size: 0,
st_blksize: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad2: 0,
st_blocks: 0,
st_atim: timespec {
tv_sec: 0,
@@ -313,7 +346,10 @@ unsafe extern "C" fn sudo_ttyname_scan(
tv_sec: 0,
tv_nsec: 0,
},
+ #[cfg(target_arch = "x86_64")]
__glibc_reserved: [0; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ __glibc_reserved: [0; 2],
};
let mut i: libc::c_int = 0 as libc::c_int;
@@ -372,14 +408,22 @@ unsafe extern "C" fn sudo_ttyname_scan(
let mut sb: stat = stat {
st_dev: 0,
st_ino: 0,
+ #[cfg(target_arch = "x86_64")]
st_nlink: 0,
st_mode: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ st_nlink: 0,
st_uid: 0,
st_gid: 0,
+ #[cfg(target_arch = "x86_64")]
__pad0: 0,
st_rdev: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad1: 0,
st_size: 0,
st_blksize: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad2: 0,
st_blocks: 0,
st_atim: timespec {
tv_sec: 0,
@@ -393,8 +437,12 @@ unsafe extern "C" fn sudo_ttyname_scan(
tv_sec: 0,
tv_nsec: 0,
},
+ #[cfg(target_arch = "x86_64")]
__glibc_reserved: [0; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ __glibc_reserved: [0; 2],
};
+
/* Skip anything starting with "." */
if (*dp).d_name[0 as usize] as libc::c_int == '.' as i32 {
continue;
@@ -495,14 +543,22 @@ unsafe extern "C" fn sudo_dev_check(
let mut sb: stat = stat {
st_dev: 0,
st_ino: 0,
+ #[cfg(target_arch = "x86_64")]
st_nlink: 0,
st_mode: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ st_nlink: 0,
st_uid: 0,
st_gid: 0,
+ #[cfg(target_arch = "x86_64")]
__pad0: 0,
st_rdev: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad1: 0,
st_size: 0,
st_blksize: 0,
+ #[cfg(not(target_arch = "x86_64"))]
+ __pad2: 0,
st_blocks: 0,
st_atim: timespec {
tv_sec: 0,
@@ -516,7 +572,10 @@ unsafe extern "C" fn sudo_dev_check(
tv_sec: 0,
tv_nsec: 0,
},
+ #[cfg(target_arch = "x86_64")]
__glibc_reserved: [0; 3],
+ #[cfg(not(target_arch = "x86_64"))]
+ __glibc_reserved: [0; 2],
};
debug_decl!(stdext::function_name!().as_ptr(), SUDO_DEBUG_UTIL);
if stat(devname, &mut sb) == 0 {
--
2.41.0

View File

@ -0,0 +1,180 @@
From 3b59a1cc7b3d9ea38ae3501c7a4e09597f7acdaa Mon Sep 17 00:00:00 2001
From: binlingyu <binlingyu@uniontech.com>
Date: Sun, 28 Apr 2024 13:41:35 +0800
Subject: [PATCH] fix use_pty function error
---
lib/util/src/term.rs | 5 +++--
src/exec_monitor.rs | 12 ++++++------
src/exec_pty.rs | 38 +++++++++++++++++++++++---------------
3 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/lib/util/src/term.rs b/lib/util/src/term.rs
index 15bff23..c87c882 100644
--- a/lib/util/src/term.rs
+++ b/lib/util/src/term.rs
@@ -648,7 +648,7 @@ unsafe extern "C" fn sudo_term_raw_v1(fd: libc::c_int, isig: libc::c_int) -> boo
};
debug_decl!(stdext::function_name!().as_ptr(), SUDO_DEBUG_UTIL);
- if changed != 0 && tcgetattr(fd, &mut oterm) != 0 {
+ if changed == 0 && tcgetattr(fd, &mut oterm) != 0 {
debug_return_bool!(false);
}
memcpy(
@@ -684,7 +684,7 @@ unsafe extern "C" fn sudo_term_raw_v1(fd: libc::c_int, isig: libc::c_int) -> boo
unsafe extern "C" fn sudo_term_cbreak_v1(fd: libc::c_int) -> bool {
debug_decl!(stdext::function_name!().as_ptr(), SUDO_DEBUG_UTIL);
- if changed != 0 && tcgetattr(fd, &mut oterm) != 0 {
+ if changed == 0 && tcgetattr(fd, &mut oterm) != 0 {
debug_return_bool!(false);
}
@@ -789,3 +789,4 @@ unsafe extern "C" fn sudo_term_copy_v1(src: libc::c_int, dst: libc::c_int) -> bo
}
debug_return_bool!(true)
}
+
diff --git a/src/exec_monitor.rs b/src/exec_monitor.rs
index 890e30d..0ba0658 100644
--- a/src/exec_monitor.rs
+++ b/src/exec_monitor.rs
@@ -357,7 +357,6 @@ unsafe extern "C" fn mon_handle_sigchld(mut mc: *mut monitor_closure) {
if !(pid == -(1 as libc::c_int) && errno!() == EINTR) {
break;
}
- break;
}
match pid {
0 => {
@@ -420,7 +419,7 @@ unsafe extern "C" fn mon_handle_sigchld(mut mc: *mut monitor_closure) {
(*mc).cmnd_pid,
signame.as_mut_ptr()
);
- (*mc).cmnd_pid == -(1 as libc::c_int);
+ (*mc).cmnd_pid = -(1 as libc::c_int);
} else if WIFEXITED!(status) {
sudo_debug_printf!(
SUDO_DEBUG_INFO,
@@ -429,7 +428,7 @@ unsafe extern "C" fn mon_handle_sigchld(mut mc: *mut monitor_closure) {
(*mc).cmnd_pid,
WEXITSTATUS!(status)
);
- (*mc).cmnd_pid == -(1 as libc::c_int);
+ (*mc).cmnd_pid = -(1 as libc::c_int);
} else {
sudo_debug_printf!(
SUDO_DEBUG_WARN,
@@ -772,7 +771,7 @@ unsafe extern "C" fn fill_exec_closure_monitor(
}
/* Event for forwarded signals via backchannel. */
- let ref mut backchannel_event0 = (*mc).errpipe_event;
+ let ref mut backchannel_event0 = (*mc).backchannel_event;
*backchannel_event0 = sudo_ev_alloc_v1(
backchannel,
(SUDO_EV_READ | SUDO_EV_PERSIST) as libc::c_short,
@@ -800,7 +799,7 @@ unsafe extern "C" fn fill_exec_closure_monitor(
}
/* Events for local signals. */
- let ref mut sigint_event0 = (*mc).errpipe_event;
+ let ref mut sigint_event0 = (*mc).sigint_event;
*sigint_event0 = sudo_ev_alloc_v1(
SIGINT,
SUDO_EV_SIGINFO as libc::c_short,
@@ -823,7 +822,7 @@ unsafe extern "C" fn fill_exec_closure_monitor(
sudo_fatal!(b"unable to add event to queue\0" as *const u8 as *const libc::c_char,);
}
- let ref mut sigquit_event0 = (*mc).errpipe_event;
+ let ref mut sigquit_event0 = (*mc).sigquit_event;
*sigquit_event0 = sudo_ev_alloc_v1(
SIGQUIT,
SUDO_EV_SIGINFO as libc::c_short,
@@ -1249,3 +1248,4 @@ pub unsafe extern "C" fn exec_monitor(
}
debug_return_int!(-(1 as libc::c_int));
}
+
diff --git a/src/exec_pty.rs b/src/exec_pty.rs
index 7e14e72..a5cc675 100644
--- a/src/exec_pty.rs
+++ b/src/exec_pty.rs
@@ -2603,11 +2603,11 @@ pub unsafe extern "C" fn exec_pty(
if io_pipe[STDIN_FILENO as usize][0 as usize] != -(1 as libc::c_int) {
close(io_pipe[STDIN_FILENO as usize][0 as usize]);
}
- if io_pipe[STDOUT_FILENO as usize][0 as usize] != -(1 as libc::c_int) {
- close(io_pipe[STDOUT_FILENO as usize][0 as usize]);
+ if io_pipe[STDOUT_FILENO as usize][1 as usize] != -(1 as libc::c_int) {
+ close(io_pipe[STDOUT_FILENO as usize][1 as usize]);
}
- if io_pipe[STDERR_FILENO as usize][0 as usize] != -(1 as libc::c_int) {
- close(io_pipe[STDERR_FILENO as usize][0 as usize]);
+ if io_pipe[STDERR_FILENO as usize][1 as usize] != -(1 as libc::c_int) {
+ close(io_pipe[STDERR_FILENO as usize][1 as usize]);
}
close(sv[1 as usize]);
@@ -2701,19 +2701,24 @@ unsafe extern "C" fn add_io_events(mut evbase: *mut sudo_event_base) {
}
if !((*iob).wevent).is_null() {
/* Enable writer if buffer is not empty. */
- sudo_debug_printf!(
- SUDO_DEBUG_INFO,
- b"added I/O wevent %p, fd %d, events %d\0" as *const u8 as *const libc::c_char,
- (*iob).wevent,
- (*(*iob).wevent).fd,
- (*(*iob).wevent).events as libc::c_int
- );
- if sudo_ev_add_v2(evbase, (*iob).wevent, 0 as *mut timespec, false)
- == -(1 as libc::c_int)
- {
- sudo_fatal!(b"unable to add event to queue\0" as *const u8 as *const libc::c_char,);
+ if (*iob).len > (*iob).off {
+ sudo_debug_printf!(
+ SUDO_DEBUG_INFO,
+ b"added I/O wevent %p, fd %d, events %d\0" as *const u8 as *const libc::c_char,
+ (*iob).wevent,
+ (*(*iob).wevent).fd,
+ (*(*iob).wevent).events as libc::c_int
+ );
+ if sudo_ev_add_v2(evbase, (*iob).wevent, 0 as *mut timespec, false)
+ == -(1 as libc::c_int)
+ {
+ sudo_fatal!(
+ b"unable to add event to queue\0" as *const u8 as *const libc::c_char,
+ );
+ }
}
}
+ iob = (*iob).entries.sle_next;
}
debug_return!();
}
@@ -2833,6 +2838,7 @@ unsafe extern "C" fn del_io_events(mut nonblocking: bool) {
}
}
}
+ iob = (*iob).entries.sle_next;
}
sudo_debug_printf!(
SUDO_DEBUG_INFO,
@@ -2857,6 +2863,7 @@ unsafe extern "C" fn del_io_events(mut nonblocking: bool) {
);
}
}
+ iob = (*iob).entries.sle_next;
}
}
@@ -2977,3 +2984,4 @@ unsafe extern "C" fn safe_close(mut fd: libc::c_int) -> libc::c_int {
);
debug_return_int!(close(fd));
}
+
--
2.43.0

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
utsudo-0.0.2.tar.gz Normal file

Binary file not shown.

View File

@ -2,8 +2,8 @@ ExcludeArch: i686
Summary: The tudo respect sudo
Name: utsudo
Version: 0.0.1
Release: 0.05
Version: 0.0.2
Release: 0.03
License: ISC
Group: Applications/System
URL: https://www.sudo.ws/
@ -37,9 +37,8 @@ BuildRequires: cargo
BuildRequires: rust
BuildRequires: patchelf
Patch0001: 0001-fix-compile-error-undefined-reference-to-sys_sigabbr.patch
Patch0002: 0002-change-struct-stat-for-arm-and-loongarch.patch
Patch0003: 0003-fix-bug-utsudoedit-error.patch
Patch0001: 0001-fix-unable-to-callocate-memory.patch
Patch0002: 0002-fix-use_pty-function-error.patch
%description
Sudo (superuser do) allows a system administrator to give certain
@ -54,10 +53,8 @@ on many different machines.
%prep
%setup -q
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%build
# Remove bundled copy of zlib
@ -148,6 +145,23 @@ rm utsudo.lang utsudoers.lang
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/utsudo
cat > $RPM_BUILD_ROOT/etc/pam.d/utsudo << EOF
#%%PAM-1.0
auth include system-auth
account include system-auth
password include system-auth
session include system-auth
EOF
cat > $RPM_BUILD_ROOT/etc/pam.d/utsudo-i << EOF
#%%PAM-1.0
auth include sudo
account include sudo
password include sudo
session optional pam_keyinit.so force revoke
session include sudo
EOF
%clean
rm -rf $RPM_BUILD_ROOT
@ -158,6 +172,8 @@ rm -rf $RPM_BUILD_ROOT
%attr(0640,root,root) %config(noreplace) /etc/utsudo.conf
%attr(0640,root,root) %config(noreplace) %{_sysconfdir}/utsudo-ldap.conf
%attr(0750,root,root) %dir /etc/utsudoers.d/
%config(noreplace) /etc/pam.d/utsudo
%config(noreplace) /etc/pam.d/utsudo-i
%attr(0644,root,root) %{_tmpfilesdir}/utsudo.conf
%attr(0644,root,root) /etc/dnf/protected.d/utsudo.conf
%dir /var/db/sudo
@ -166,12 +182,13 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/utsudoedit
%dir %{_libexecdir}/utsudo
%attr(0755,root,root) %{_libexecdir}/utsudo/sesh
%attr(0644,root,root) %{_libexecdir}/utsudo/sudo_noexec.so
%attr(0644,root,root) %{_libexecdir}/utsudo/utsudo_noexec.so
%attr(0644,root,root) %{_libexecdir}/utsudo/sudoers.so
%attr(0644,root,root) %{_libexecdir}/utsudo/group_file.so
%attr(0644,root,root) %{_libexecdir}/utsudo/system_group.so
%{_libexecdir}/utsudo/libutsudo_util.so
%{_libexecdir}/utsudo/libutsudo_util.so.?
%{_libexecdir}/utsudo/libutsudo_variadic.so
%attr(0644,root,root) %{_libexecdir}/utsudo/libutsudo_util.so.?.?.?
%dir %{_pkgdocdir}/
%{!?_licensedir:%global license %%doc}
@ -182,8 +199,14 @@ rm -rf $RPM_BUILD_ROOT
/bin/chmod 0440 /etc/utsudoers || :
%changelog
* Wed Dec 20 2023 Bianguangze <bianguangze@uniontech.com> - 0.0.1-0.05
- Add Patch: 0003-fix-bug-utsudoedit-error.patch
* Sun Apr 28 2024 binlingyu <binlingyu@uniontech.com> - 0.0.2-0.03
- Add Patch: 0002-fix-use_pty-function-error.patch
* Fri Apr 12 2024 bianguangze <bianguangze@uniontech.com> - 0.0.2-0.02
- fix unable to callocate memory.
* Sun Apr 7 2024 bianguangze <bianguangze@uniontech.com> - 0.0.2-0.01
- 升级至0.0.2大版本,解决部分编译报错.
* Wed Sep 06 2023 Lujun <wanglujun@uniontech.com> - 0.0.1-0.04
- Add Patch: 0002-change-struct-stat-for-arm-and-loongarch.patch