From 76a0a4400815b5978ef8ff25aacdafb9fa168cb9 Mon Sep 17 00:00:00 2001 From: Marc Schoolderman Date: Fri, 10 May 2024 14:05:54 +0200 Subject: [PATCH] run cargo minify again + remove related test cases --- src/pam/sys.rs | 404 ------------------------------------------------- 1 file changed, 404 deletions(-) diff --git a/src/pam/sys.rs b/src/pam/sys.rs index 165d38885..2d8029d02 100644 --- a/src/pam/sys.rs +++ b/src/pam/sys.rs @@ -240,410 +240,6 @@ 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; -pub type uid_t = __uid_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct passwd { - pub pw_name: *mut libc::c_char, - pub pw_passwd: *mut libc::c_char, - pub pw_uid: __uid_t, - pub pw_gid: __gid_t, - pub pw_gecos: *mut libc::c_char, - pub pw_dir: *mut libc::c_char, - pub pw_shell: *mut libc::c_char, -} -#[test] -fn bindgen_test_layout_passwd() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::align_of::(), - ::std::mem::align_of::<*mut libc::c_char>(), - concat!("Alignment of ", stringify!(passwd)) - ); - let mut offset: usize = 0; - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_name) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_name) - ) - ); - offset = - aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_passwd) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_passwd) - ) - ); - offset = aligned_offset::<__uid_t>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_uid) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_uid) - ) - ); - offset = aligned_offset::<__gid_t>(offset + ::std::mem::size_of::<__uid_t>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_gid) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_gid) - ) - ); - offset = aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<__gid_t>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_gecos) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_gecos) - ) - ); - offset = - aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_dir) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_dir) - ) - ); - offset = - aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pw_shell) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(passwd), - "::", - stringify!(pw_shell) - ) - ); - offset = - aligned_offset::<*mut libc::c_void>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - ::std::mem::size_of::(), - offset, - concat!("Size of: ", stringify!(passwd)) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct group { - pub gr_name: *mut libc::c_char, - pub gr_passwd: *mut libc::c_char, - pub gr_gid: __gid_t, - pub gr_mem: *mut *mut libc::c_char, -} -#[test] -fn bindgen_test_layout_group() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::align_of::(), - ::std::mem::align_of::<*mut libc::c_char>(), - concat!("Alignment of ", stringify!(group)) - ); - let mut offset: usize = 0; - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gr_name) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(group), - "::", - stringify!(gr_name) - ) - ); - offset = - aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gr_passwd) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(group), - "::", - stringify!(gr_passwd) - ) - ); - offset = aligned_offset::<__gid_t>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gr_gid) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(group), - "::", - stringify!(gr_gid) - ) - ); - offset = aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<__gid_t>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gr_mem) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(group), - "::", - stringify!(gr_mem) - ) - ); - offset = - aligned_offset::<*mut libc::c_void>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - ::std::mem::size_of::(), - offset, - concat!("Size of: ", stringify!(group)) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct spwd { - pub sp_namp: *mut libc::c_char, - pub sp_pwdp: *mut libc::c_char, - pub sp_lstchg: libc::c_long, - pub sp_min: libc::c_long, - pub sp_max: libc::c_long, - pub sp_warn: libc::c_long, - pub sp_inact: libc::c_long, - pub sp_expire: libc::c_long, - pub sp_flag: libc::c_ulong, -} -#[test] -fn bindgen_test_layout_spwd() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::align_of::(), - ::std::mem::align_of::<*mut libc::c_char>(), - concat!("Alignment of ", stringify!(spwd)) - ); - let mut offset: usize = 0; - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_namp) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_namp) - ) - ); - offset = - aligned_offset::<*mut libc::c_char>(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_pwdp) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_pwdp) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::<*mut libc::c_char>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_lstchg) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_lstchg) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_min) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_min) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_max) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_max) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_warn) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_warn) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_inact) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_inact) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_expire) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_expire) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sp_flag) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(spwd), - "::", - stringify!(sp_flag) - ) - ); - offset = aligned_offset::<*mut libc::c_void>(offset + ::std::mem::size_of::()); - assert_eq!( - ::std::mem::size_of::(), - offset, - concat!("Size of: ", stringify!(spwd)) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct pam_modutil_privs { - pub grplist: *mut gid_t, - pub number_of_groups: libc::c_int, - pub allocated: libc::c_int, - pub old_gid: gid_t, - pub old_uid: uid_t, - pub is_dropped: libc::c_int, -} -#[test] -fn bindgen_test_layout_pam_modutil_privs() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::align_of::(), - ::std::mem::align_of::<*mut gid_t>(), - concat!("Alignment of ", stringify!(pam_modutil_privs)) - ); - let mut offset: usize = 0; - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).grplist) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(pam_modutil_privs), - "::", - stringify!(grplist) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::<*mut gid_t>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).number_of_groups) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(pam_modutil_privs), - "::", - stringify!(number_of_groups) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).allocated) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(pam_modutil_privs), - "::", - stringify!(allocated) - ) - ); - offset = aligned_offset::<__gid_t>(offset + ::std::mem::size_of::()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).old_gid) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(pam_modutil_privs), - "::", - stringify!(old_gid) - ) - ); - offset = aligned_offset::<__uid_t>(offset + ::std::mem::size_of::<__gid_t>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).old_uid) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(pam_modutil_privs), - "::", - stringify!(old_uid) - ) - ); - offset = aligned_offset::(offset + ::std::mem::size_of::<__uid_t>()); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).is_dropped) as usize - ptr as usize }, - offset, - concat!( - "Offset of field: ", - stringify!(pam_modutil_privs), - "::", - stringify!(is_dropped) - ) - ); - offset = aligned_offset::<*mut libc::c_void>(offset + ::std::mem::size_of::()); - assert_eq!( - ::std::mem::size_of::(), - offset, - concat!("Size of: ", stringify!(pam_modutil_privs)) - ); -} #[cfg(test)] fn aligned_offset(offset: usize) -> usize {