diff -Nru rust-selinux-0.3.2/Cargo.toml rust-selinux-0.4.1/Cargo.toml --- rust-selinux-0.3.2/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 +++ rust-selinux-0.4.1/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 @@ -12,7 +12,7 @@ [package] edition = "2021" name = "selinux" -version = "0.3.2" +version = "0.4.1" authors = ["Koutheir Attouchi "] description = "Flexible Mandatory Access Control for Linux" documentation = "https://docs.rs/selinux" @@ -35,13 +35,13 @@ resolver = "1" [dependencies.bitflags] -version = "1.3" +version = "2.1" [dependencies.libc] version = "0.2" [dependencies.once_cell] -version = "1.16" +version = "1.17" [dependencies.reference-counted-singleton] version = "0.1" @@ -56,10 +56,10 @@ version = "1.5" [dev-dependencies.serial_test] -version = "0.9" +version = "2.0" [dev-dependencies.socketpair] -version = "0.17" +version = "0.19" [dev-dependencies.tempfile] -version = "3.3" +version = "3.5" diff -Nru rust-selinux-0.3.2/Cargo.toml.orig rust-selinux-0.4.1/Cargo.toml.orig --- rust-selinux-0.3.2/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 @@ -3,7 +3,7 @@ [package] name = "selinux" description = "Flexible Mandatory Access Control for Linux" -version = "0.3.2" # Update version in `html_root_url`. +version = "0.4.1" # Update version in `html_root_url`. authors = ["Koutheir Attouchi "] edition = "2021" readme = "../README.md" @@ -17,12 +17,12 @@ thiserror = { version = "1.0" } selinux-sys = { version = "0.6" } libc = { version = "0.2" } -bitflags = { version = "1.3" } -once_cell = { version = "1.16" } +bitflags = { version = "2.1" } +once_cell = { version = "1.17" } reference-counted-singleton = { version = "0.1" } [dev-dependencies] assert_matches = { version = "1.5" } -tempfile = { version = "3.3" } -serial_test = { version = "0.9" } -socketpair = { version = "0.17" } +tempfile = { version = "3.5" } +serial_test = { version = "2.0" } +socketpair = { version = "0.19" } diff -Nru rust-selinux-0.3.2/.cargo_vcs_info.json rust-selinux-0.4.1/.cargo_vcs_info.json --- rust-selinux-0.3.2/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 +++ rust-selinux-0.4.1/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 @@ -1,6 +1,6 @@ { "git": { - "sha1": "aa0fe914b0cc4f461f4b417f61c8cec290bd9218" + "sha1": "cfb4f6dd8b427626a7a322449767ada4fee54925" }, "path_in_vcs": "selinux" } \ No newline at end of file diff -Nru rust-selinux-0.3.2/debian/cargo-checksum.json rust-selinux-0.4.1/debian/cargo-checksum.json --- rust-selinux-0.3.2/debian/cargo-checksum.json 2022-11-27 08:30:51.000000000 +0000 +++ rust-selinux-0.4.1/debian/cargo-checksum.json 2023-06-24 09:00:01.000000000 +0000 @@ -1 +1 @@ -{"package":"b775d14782780e48a0c6529fe027454a80a66df85d1d9a2ea4de747f3295daf4","files":{}} +{"package":"6b5ff8f655381fc80f470384da0a461b19b7bf18d685639ccf6df0abd3d2363d","files":{}} diff -Nru rust-selinux-0.3.2/debian/changelog rust-selinux-0.4.1/debian/changelog --- rust-selinux-0.3.2/debian/changelog 2022-11-27 08:30:51.000000000 +0000 +++ rust-selinux-0.4.1/debian/changelog 2023-06-24 09:00:01.000000000 +0000 @@ -1,3 +1,9 @@ +rust-selinux (0.4.1-1) unstable; urgency=medium + + * Package selinux 0.4.1 from crates.io using debcargo 2.6.0 + + -- Sylvestre Ledru Sat, 24 Jun 2023 11:00:01 +0200 + rust-selinux (0.3.2-1) unstable; urgency=medium * Team upload. diff -Nru rust-selinux-0.3.2/debian/control rust-selinux-0.4.1/debian/control --- rust-selinux-0.3.2/debian/control 2022-11-27 08:30:51.000000000 +0000 +++ rust-selinux-0.4.1/debian/control 2023-06-24 09:00:01.000000000 +0000 @@ -6,9 +6,9 @@ cargo:native , rustc:native , libstd-rust-dev , - librust-bitflags-1+default-dev (>= 1.3-~~) , + librust-bitflags-2+default-dev (>= 2.1-~~) , librust-libc-0.2+default-dev , - librust-once-cell-1+default-dev (>= 1.16-~~) , + librust-once-cell-1+default-dev (>= 1.17-~~) , librust-reference-counted-singleton-0.1+default-dev , librust-selinux-sys-0.6+default-dev , librust-thiserror-1+default-dev @@ -26,9 +26,9 @@ Multi-Arch: same Depends: ${misc:Depends}, - librust-bitflags-1+default-dev (>= 1.3-~~), + librust-bitflags-2+default-dev (>= 2.1-~~), librust-libc-0.2+default-dev, - librust-once-cell-1+default-dev (>= 1.16-~~), + librust-once-cell-1+default-dev (>= 1.17-~~), librust-reference-counted-singleton-0.1+default-dev, librust-selinux-sys-0.6+default-dev, librust-thiserror-1+default-dev @@ -36,10 +36,10 @@ librust-selinux+default-dev (= ${binary:Version}), librust-selinux-0-dev (= ${binary:Version}), librust-selinux-0+default-dev (= ${binary:Version}), - librust-selinux-0.3-dev (= ${binary:Version}), - librust-selinux-0.3+default-dev (= ${binary:Version}), - librust-selinux-0.3.2-dev (= ${binary:Version}), - librust-selinux-0.3.2+default-dev (= ${binary:Version}) + librust-selinux-0.4-dev (= ${binary:Version}), + librust-selinux-0.4+default-dev (= ${binary:Version}), + librust-selinux-0.4.1-dev (= ${binary:Version}), + librust-selinux-0.4.1+default-dev (= ${binary:Version}) Description: Flexible Mandatory Access Control for Linux - Rust source code This package contains the source for the Rust selinux crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-selinux-0.3.2/debian/copyright.debcargo.hint rust-selinux-0.4.1/debian/copyright.debcargo.hint --- rust-selinux-0.3.2/debian/copyright.debcargo.hint 2022-11-27 08:30:51.000000000 +0000 +++ rust-selinux-0.4.1/debian/copyright.debcargo.hint 2023-06-24 09:00:01.000000000 +0000 @@ -14,8 +14,8 @@ Files: debian/* Copyright: - 2021-2022 Debian Rust Maintainers - 2021-2022 Sylvestre Ledru + 2021-2023 Debian Rust Maintainers + 2021-2023 Sylvestre Ledru License: MIT License: MIT diff -Nru rust-selinux-0.3.2/debian/tests/control rust-selinux-0.4.1/debian/tests/control --- rust-selinux-0.3.2/debian/tests/control 2022-11-27 08:30:51.000000000 +0000 +++ rust-selinux-0.4.1/debian/tests/control 2023-06-24 09:00:01.000000000 +0000 @@ -1,14 +1,14 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test selinux 0.3.2 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test selinux 0.4.1 --all-targets --all-features Features: test-name=rust-selinux:@ -Depends: dh-cargo (>= 18), librust-assert-matches-1+default-dev (>= 1.5-~~), librust-serial-test-0.9+default-dev, librust-socketpair-0.17+default-dev, librust-tempfile-3+default-dev (>= 3.3-~~), @ +Depends: dh-cargo (>= 18), librust-assert-matches-1+default-dev (>= 1.5-~~), librust-serial-test-2+default-dev, librust-socketpair-0.19+default-dev, librust-tempfile-3+default-dev (>= 3.5-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test selinux 0.3.2 --all-targets +Test-Command: /usr/share/cargo/bin/cargo-auto-test selinux 0.4.1 --all-targets Features: test-name=librust-selinux-dev:default -Depends: dh-cargo (>= 18), librust-assert-matches-1+default-dev (>= 1.5-~~), librust-serial-test-0.9+default-dev, librust-socketpair-0.17+default-dev, librust-tempfile-3+default-dev (>= 3.3-~~), @ +Depends: dh-cargo (>= 18), librust-assert-matches-1+default-dev (>= 1.5-~~), librust-serial-test-2+default-dev, librust-socketpair-0.19+default-dev, librust-tempfile-3+default-dev (>= 3.5-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test selinux 0.3.2 --all-targets --no-default-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test selinux 0.4.1 --all-targets --no-default-features Features: test-name=librust-selinux-dev: -Depends: dh-cargo (>= 18), librust-assert-matches-1+default-dev (>= 1.5-~~), librust-serial-test-0.9+default-dev, librust-socketpair-0.17+default-dev, librust-tempfile-3+default-dev (>= 3.3-~~), @ +Depends: dh-cargo (>= 18), librust-assert-matches-1+default-dev (>= 1.5-~~), librust-serial-test-2+default-dev, librust-socketpair-0.19+default-dev, librust-tempfile-3+default-dev (>= 3.5-~~), @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-selinux-0.3.2/README.md rust-selinux-0.4.1/README.md --- rust-selinux-0.3.2/README.md 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/README.md 2006-07-24 01:21:28.000000000 +0000 @@ -6,7 +6,7 @@ SELinux is a flexible Mandatory Access Control for Linux. -This crate supports `libselinux` from version `2.8` to `3.4`. +This crate supports `libselinux` from version `2.8` to `3.5`. Later versions might still be compatible. This crate exposes neither *deprecated* nor *undocumented* SELinux API functions and types. @@ -51,7 +51,7 @@ ### Build system This crate uses only `cargo` as a build system. Usual commands are used to -perform most operations, e.g., `build`, `test`, `fmt`. +perform most operations, *e.g.*, `build`, `test`, `fmt`. > Code is read many time more that written, so this crate's code is always > formatted using `cargo fmt`. @@ -78,7 +78,7 @@ - The file system must be correctly configured. - The user space must have access to SELinux, usually via `libselinux`. -[Red Hat Enterprise Linux]-like distributions (e.g., [Fedora], [CentOS], +[Red Hat Enterprise Linux]-like distributions (*e.g.*, [Fedora], [CentOS], [RockyLinux]) are suitable for testing this crate, either on hardware or inside virtual machines, but not in containers. diff -Nru rust-selinux-0.3.2/src/avc/mod.rs rust-selinux-0.4.1/src/avc/mod.rs --- rust-selinux-0.3.2/src/avc/mod.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/avc/mod.rs 2006-07-24 01:21:28.000000000 +0000 @@ -38,7 +38,7 @@ /// /// The `options` parameter produces zero or more `(type, value)` tuples, where: /// - `type` is one of `selinux_sys::AVC_OPT_*` values, - /// e.g., [`selinux_sys::AVC_OPT_SETENFORCE`]. + /// *e.g.*, [`selinux_sys::AVC_OPT_SETENFORCE`]. /// - `value` is a pointer whose semantics are specific to `type`. /// /// Attempting to initialize the access vector cache while it is still diff -Nru rust-selinux-0.3.2/src/avc/tests.rs rust-selinux-0.4.1/src/avc/tests.rs --- rust-selinux-0.3.2/src/avc/tests.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/avc/tests.rs 2006-07-24 01:21:28.000000000 +0000 @@ -21,7 +21,7 @@ fn access_vector_cache_initialize() { match super::AccessVectorCache::initialize(&[]) { Ok(avc) => { - let _ignored = format!("{:?}", avc); + let _ignored = format!("{avc:?}"); } Err(err) => { @@ -36,7 +36,7 @@ match super::AccessVectorCache::initialize(options) { Ok(avc) => { - let _ignored = format!("{:?}", avc); + let _ignored = format!("{avc:?}"); } Err(err) => { diff -Nru rust-selinux-0.3.2/src/call_back/tests.rs rust-selinux-0.4.1/src/call_back/tests.rs --- rust-selinux-0.3.2/src/call_back/tests.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/call_back/tests.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,5 +1,6 @@ #![cfg(all(test, target_os = "linux", not(target_env = "kernel")))] +use core::mem; use std::fmt; use std::os::raw::{c_char, c_int, c_void}; @@ -8,6 +9,8 @@ T: super::CallBack + Default + fmt::Debug, ::CallBackType: fmt::Debug + Eq + Copy + Sized, { + // TODO: We need to arrange for the call back to be actually called. + let _ignored = format!("{:?}", T::default()); let old_call_back = T::get_call_back(); @@ -27,8 +30,14 @@ #[test] fn log() { + // # Safety + // // For now, stable Rust does not allow defining variadic functions. - template::(unsafe { *(libc::abort as *const _) }); + // Once that becomes possible, we should define a variadic function that + // calls libc::abort(), and call that instead. + // For the moment, we allow calling abort() with a different prototype, + // which only "works" in some ABIs, and probably fails horribly in others. + template::(unsafe { mem::transmute(libc::abort as unsafe extern "C" fn() -> !) }); } #[test] diff -Nru rust-selinux-0.3.2/src/context_restore/mod.rs rust-selinux-0.4.1/src/context_restore/mod.rs --- rust-selinux-0.3.2/src/context_restore/mod.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/context_restore/mod.rs 2006-07-24 01:21:28.000000000 +0000 @@ -115,7 +115,7 @@ /// Count, but otherwise ignore, errors during the file tree walk. /// - /// This flag is supported only by `libselinux` version `3.4` or later. + /// This flag requires `libselinux` version `3.4` or later. const COUNT_ERRORS = 0x20000; } } @@ -211,8 +211,9 @@ /// Restore file(s) default SELinux security contexts. /// /// If `threads_count` is zero, then: - /// - If `selinux_restorecon_parallel()` is supported by `libselinux`, then this operation will - /// use as many threads as the number of online processor cores present. + /// - If `selinux_restorecon_parallel()` is supported by `libselinux` (version 3.4 or later), + /// then this operation will use as many threads as the number of online processor + /// cores present. /// - Otherwise, this operation will run in one thread. /// /// When this method succeeds: @@ -277,8 +278,11 @@ } } - Ok(flags.contains(RestoreFlags::COUNT_ERRORS).then(|| unsafe { - u64::from((OptionalNativeFunctions::get().selinux_restorecon_get_skipped_errors)()) + Ok(flags.contains(RestoreFlags::COUNT_ERRORS).then(|| { + #[allow(clippy::useless_conversion)] + u64::from(unsafe { + (OptionalNativeFunctions::get().selinux_restorecon_get_skipped_errors)() + }) })) } diff -Nru rust-selinux-0.3.2/src/label/mod.rs rust-selinux-0.4.1/src/label/mod.rs --- rust-selinux-0.3.2/src/label/mod.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/label/mod.rs 2006-07-24 01:21:28.000000000 +0000 @@ -270,6 +270,8 @@ /// Retrieve the partial matches digest and the xattr digest that applies /// to the supplied path. /// + /// This function requires `libselinux` version `3.0` or later. + /// /// See: `selabel_get_digests_all_partial_matches()`. #[doc(alias = "selabel_get_digests_all_partial_matches")] pub fn get_digests_all_partial_matches_by_path( diff -Nru rust-selinux-0.3.2/src/lib.rs rust-selinux-0.4.1/src/lib.rs --- rust-selinux-0.3.2/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,6 +1,6 @@ #![cfg(all(target_os = "linux", not(target_env = "kernel")))] #![doc = include_str!("../README.md")] -#![doc(html_root_url = "https://docs.rs/selinux/0.3.2")] +#![doc(html_root_url = "https://docs.rs/selinux/0.4.1")] #![allow(clippy::upper_case_acronyms)] #![warn( missing_docs, @@ -247,15 +247,42 @@ /// See: `getprevcon()`. #[doc(alias = "getprevcon")] pub fn previous(raw_format: bool) -> Result { - let (proc, proc_name): (unsafe extern "C" fn(_) -> _, _) = if raw_format { - (selinux_sys::getprevcon_raw, "getprevcon_raw()") - } else { - (selinux_sys::getprevcon, "getprevcon()") - }; + Self::previous_of_process(None, raw_format) + } + /// Return the security context, of the current or specified process, before the last exec. + /// + /// If `process_id` is `None`, then the current process is queried. + /// + /// Specifying a particular process id (`process_id.is_some()`) requires `libselinux` version + /// `3.5` or later. + /// + /// See: `getprevcon()`, `getpidprevcon()`. + #[doc(alias = "getprevcon")] + #[doc(alias = "getpidprevcon")] + pub fn previous_of_process(process_id: Option, raw_format: bool) -> Result { let mut context: *mut c_char = ptr::null_mut(); - let r = unsafe { proc(&mut context) }; - Self::from_result(proc_name, r, context, raw_format) + + if let Some(process_id) = process_id { + let onf = OptionalNativeFunctions::get(); + let (proc, proc_name): (unsafe extern "C" fn(_, _) -> _, _) = if raw_format { + (onf.getpidprevcon_raw, "getpidprevcon_raw()") + } else { + (onf.getpidprevcon, "getpidprevcon()") + }; + + let r = unsafe { proc(process_id, &mut context) }; + Self::from_result_with_pid(proc_name, r, context, process_id, raw_format) + } else { + let (proc, proc_name): (unsafe extern "C" fn(_) -> _, _) = if raw_format { + (selinux_sys::getprevcon_raw, "getprevcon_raw()") + } else { + (selinux_sys::getprevcon, "getprevcon()") + }; + + let r = unsafe { proc(&mut context) }; + Self::from_result(proc_name, r, context, raw_format) + } } /// Set the current security context of the process to this context. @@ -893,6 +920,8 @@ /// This checks against the `mlsvalidatetrans` and `validatetrans` /// constraints in the loaded policy. /// + /// This function requires `libselinux` version `3.0` or later. + /// /// See: `security_validatetrans()`. #[doc(alias = "security_validatetrans")] pub fn validate_transition( @@ -1753,7 +1782,7 @@ } else { unsafe { CStr::from_ptr(ptr) }.to_string_lossy() }; - write!(f, "{}", s) + write!(f, "{s}") } } @@ -1993,7 +2022,9 @@ ret_val_to_result("selinux_set_mapping()", r) } -/// Flush the SELinux class cache, e.g., upon a policy reload. +/// Flush the SELinux class cache, *e.g.*, upon a policy reload. +/// +/// This function requires `libselinux` version `3.1` or later. /// /// See: `selinux_flush_class_cache()`. #[doc(alias = "selinux_flush_class_cache")] diff -Nru rust-selinux-0.3.2/src/policy/mod.rs rust-selinux-0.4.1/src/policy/mod.rs --- rust-selinux-0.3.2/src/policy/mod.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/policy/mod.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,7 +1,7 @@ #[cfg(test)] mod tests; -use std::os::raw::{c_char, c_int, c_uint}; +use std::os::raw::{c_char, c_int, c_uint, c_void}; use std::path::Path; use std::{io, ptr}; @@ -12,9 +12,13 @@ /// /// See: `security_load_policy()`. #[doc(alias = "security_load_policy")] -pub fn load(policy_bytes: &mut [u8]) -> Result<()> { - let data = policy_bytes.as_mut_ptr().cast(); - let r = unsafe { selinux_sys::security_load_policy(data, policy_bytes.len()) }; +pub fn load(policy_bytes: &[u8]) -> Result<()> { + // security_load_policy() declares "data" as a constant pointer starting from libselinux + // version 3.5. + // Previous supported versions have the same security_load_policy() implementation, but declare + // "data" as a mutable pointer, even though it is never modified. + let data = policy_bytes.as_ptr() as *mut c_void; + let r = unsafe { selinux_sys::security_load_policy(data.cast(), policy_bytes.len()) }; ret_val_to_result("security_load_policy()", r) } diff -Nru rust-selinux-0.3.2/src/policy/tests.rs rust-selinux-0.4.1/src/policy/tests.rs --- rust-selinux-0.3.2/src/policy/tests.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/policy/tests.rs 2006-07-24 01:21:28.000000000 +0000 @@ -44,8 +44,8 @@ #[test] fn load() { - let mut policy_bytes = []; - super::load(&mut policy_bytes).unwrap_err(); + let policy_bytes = []; + super::load(&policy_bytes).unwrap_err(); } #[test] diff -Nru rust-selinux-0.3.2/src/tests.rs rust-selinux-0.4.1/src/tests.rs --- rust-selinux-0.3.2/src/tests.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/tests.rs 2006-07-24 01:21:28.000000000 +0000 @@ -685,7 +685,7 @@ #[test] fn kernel_support() { let r = super::kernel_support(); - let _ignored = format!("{:?}", r); + let _ignored = format!("{r:?}"); } #[test] @@ -703,7 +703,7 @@ #[test] fn current_mode() { let r = super::current_mode(); - let _ignored = format!("{:?}", r); + let _ignored = format!("{r:?}"); } #[test] diff -Nru rust-selinux-0.3.2/src/utils/mod.rs rust-selinux-0.4.1/src/utils/mod.rs --- rust-selinux-0.3.2/src/utils/mod.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-selinux-0.4.1/src/utils/mod.rs 2006-07-24 01:21:28.000000000 +0000 @@ -183,6 +183,14 @@ /// Since version 3.4 pub(crate) selinux_restorecon_get_skipped_errors: unsafe extern "C" fn() -> c_ulong, + + /// Since version 3.5 + pub(crate) getpidprevcon: + unsafe extern "C" fn(pid: selinux_sys::pid_t, con: *mut *mut c_char) -> c_int, + + /// Since version 3.5 + pub(crate) getpidprevcon_raw: + unsafe extern "C" fn(pid: selinux_sys::pid_t, con: *mut *mut c_char) -> c_int, } /// Addresses of optionally-implemented functions by libselinux. @@ -201,6 +209,8 @@ selinux_restorecon_parallel: Self::not_impl_selinux_restorecon_parallel, selinux_restorecon_get_skipped_errors: Self::not_impl_selinux_restorecon_get_skipped_errors, + getpidprevcon: Self::not_impl_getpidprevcon, + getpidprevcon_raw: Self::not_impl_getpidprevcon, } } } @@ -283,6 +293,16 @@ if !f.is_null() { self.selinux_restorecon_get_skipped_errors = unsafe { mem::transmute(f) }; } + + let f = unsafe { libc::dlsym(lib_handle, "getpidprevcon\0".as_ptr().cast()) }; + if !f.is_null() { + self.getpidprevcon = unsafe { mem::transmute(f) }; + } + + let f = unsafe { libc::dlsym(lib_handle, "getpidprevcon_raw\0".as_ptr().cast()) }; + if !f.is_null() { + self.getpidprevcon_raw = unsafe { mem::transmute(f) }; + } } unsafe extern "C" fn not_impl_security_reject_unknown() -> c_int { @@ -336,4 +356,12 @@ unsafe extern "C" fn not_impl_selinux_restorecon_get_skipped_errors() -> c_ulong { 0 } + + unsafe extern "C" fn not_impl_getpidprevcon( + _pid: selinux_sys::pid_t, + _con: *mut *mut c_char, + ) -> c_int { + Error::set_errno(libc::ENOSYS); + -1_i32 + } }