Skip to content

Commit

Permalink
Fix CI Detection Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
taotieren committed May 10, 2024
1 parent 320e1fb commit 9882e6a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/pam/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ extern "C" {
extern "C" {
pub fn pam_chauthtok(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
#[allow(dead_code)]
pub type __uid_t = libc::c_uint;
pub type __gid_t = libc::c_uint;
pub type gid_t = __gid_t;

Check warning on line 246 in src/pam/sys.rs

View workflow job for this annotation

GitHub Actions / build-and-test-minimal

type alias `gid_t` is never used

Check warning on line 246 in src/pam/sys.rs

View workflow job for this annotation

GitHub Actions / build-and-test-minimal

type alias `gid_t` is never used

Check warning on line 246 in src/pam/sys.rs

View workflow job for this annotation

GitHub Actions / build-and-test

type alias `gid_t` is never used

Check warning on line 246 in src/pam/sys.rs

View workflow job for this annotation

GitHub Actions / build-and-test

type alias `gid_t` is never used

Check warning on line 246 in src/pam/sys.rs

View workflow job for this annotation

GitHub Actions / miri

type alias `gid_t` is never used
Expand Down
1 change: 1 addition & 0 deletions src/sudoers/basic_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ impl<T: Parse> Parse for Option<T> {
}

/// Parsing method for lists of items separated by a given character; this adheres to the contract of the [Parse] trait.
#[allow(clippy::multiple_bound_locations)]
pub(super) fn parse_list<T: Parse>(
sep_by: char,
max: usize,
Expand Down
8 changes: 4 additions & 4 deletions test-framework/sudo-compliance-tests/src/sudo/sudo_ps1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn ps1_env_var_is_set_when_sudo_ps1_is_set() -> Result<()> {
let sudo_env = helpers::parse_env_output(&stdout)?;

assert_eq!(Some(ps1), sudo_env.get("PS1").copied());
assert!(sudo_env.get("SUDO_PS1").is_none());
assert!(!sudo_env.contains_key("SUDO_PS1"));

Ok(())
}
Expand All @@ -43,8 +43,8 @@ fn ps1_env_var_is_not_set_when_sudo_ps1_is_set_and_flag_login_is_used() -> Resul
.stdout()?;
let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get("PS1").is_none());
assert!(sudo_env.get("SUDO_PS1").is_none());
assert!(!sudo_env.contains_key("PS1"));
assert!(!sudo_env.contains_key("SUDO_PS1"));

Ok(())
}
Expand All @@ -68,7 +68,7 @@ fn can_start_with_parentheses() -> Result<()> {
let sudo_env = helpers::parse_env_output(&stdout)?;

assert_eq!(Some(ps1), sudo_env.get("PS1").copied());
assert!(sudo_env.get("SUDO_PS1").is_none());
assert!(!sudo_env.contains_key("SUDO_PS1"));

Ok(())
}
Expand Down
16 changes: 8 additions & 8 deletions test-framework/sudo-compliance-tests/src/sudo/sudoers/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn equal_overrides(env_list: EnvList) -> Result<()> {
.stdout()?;
let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get(env_name2).is_none());
assert!(!sudo_env.contains_key(env_name2));
assert_eq!(Some(env_val1), sudo_env.get(env_name1).copied());

Ok(())
Expand Down Expand Up @@ -412,7 +412,7 @@ fn if_value_starts_with_parentheses_variable_is_removed(env_list: EnvList) -> Re
.stdout()?;
let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get(env_name).is_none());
assert!(!sudo_env.contains_key(env_name));

Ok(())
}
Expand Down Expand Up @@ -525,7 +525,7 @@ fn minus_equal_removes(env_list: EnvList) -> Result<()> {
let sudo_env = helpers::parse_env_output(&stdout)?;

assert_eq!(Some(env_val1), sudo_env.get(env_name1).copied());
assert!(sudo_env.get(env_name2).is_none());
assert!(!sudo_env.contains_key(env_name2));

Ok(())
}
Expand All @@ -550,7 +550,7 @@ fn minus_equal_an_element_not_in_the_list_is_not_an_error(env_list: EnvList) ->
let stdout = output.stdout()?;
let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get(env_name).is_none());
assert!(!sudo_env.contains_key(env_name));

Ok(())
}
Expand All @@ -576,8 +576,8 @@ fn bang_clears_the_whole_list(env_list: EnvList) -> Result<()> {

let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get(env_name1).is_none());
assert!(sudo_env.get(env_name1).is_none());
assert!(!sudo_env.contains_key(env_name1));
assert!(!sudo_env.contains_key(env_name1));

Ok(())
}
Expand All @@ -604,7 +604,7 @@ fn can_append_after_bang(env_list: EnvList) -> Result<()> {

let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get(env_name1).is_none());
assert!(!sudo_env.contains_key(env_name1));
assert_eq!(Some(env_val2), sudo_env.get(env_name2).copied());

Ok(())
Expand Down Expand Up @@ -632,7 +632,7 @@ fn can_override_after_bang(env_list: EnvList) -> Result<()> {

let sudo_env = helpers::parse_env_output(&stdout)?;

assert!(sudo_env.get(env_name1).is_none());
assert!(!sudo_env.contains_key(env_name1));
assert_eq!(Some(env_val2), sudo_env.get(env_name2).copied());

Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ fn equal_can_disable_preservation_of_vars_display_path_but_not_term() -> Result<
let sudo_env = helpers::parse_env_output(&stdout)?;

// can be disabled
assert!(sudo_env.get("DISPLAY").is_none());
assert!(!sudo_env.contains_key("DISPLAY"));
assert_eq!(Some(SUDO_ENV_DEFAULT_PATH), sudo_env.get("PATH").copied());

// cannot be disabled
Expand Down Expand Up @@ -190,7 +190,7 @@ fn minus_equal_can_disable_preservation_of_vars_display_path_but_not_term() -> R
let sudo_env = helpers::parse_env_output(&stdout)?;

// can be disabled
assert!(sudo_env.get("DISPLAY").is_none());
assert!(!sudo_env.contains_key("DISPLAY"));
assert_eq!(Some(SUDO_ENV_DEFAULT_PATH), sudo_env.get("PATH").copied());

// cannot be disabled
Expand Down Expand Up @@ -218,7 +218,7 @@ fn bang_can_disable_preservation_of_vars_display_path_but_not_term() -> Result<(
let sudo_env = helpers::parse_env_output(&stdout)?;

// can be disabled
assert!(sudo_env.get("DISPLAY").is_none());
assert!(!sudo_env.contains_key("DISPLAY"));
assert_eq!(Some(SUDO_ENV_DEFAULT_PATH), sudo_env.get("PATH").copied());

// cannot be disabled
Expand Down

0 comments on commit 9882e6a

Please sign in to comment.