From a04d26b0d22071192f247cd52d95d4fb7070f5d6 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 6 Oct 2023 09:09:36 +0200 Subject: [PATCH] expose use_safe_putenv via Proxmox::Lib::PMG Signed-off-by: Wolfgang Bumiller --- pmg-rs/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pmg-rs/src/lib.rs b/pmg-rs/src/lib.rs index 6b7ee4c..4a91632 100644 --- a/pmg-rs/src/lib.rs +++ b/pmg-rs/src/lib.rs @@ -14,4 +14,12 @@ mod export { pub fn init() { common::logger::init("PMG_LOG", "info"); } + + /// CLI tools should call this very early. This is a workaround causing environment variable + /// manipulation to leak instead of crash. Required when calling into rust code that causes + /// `setenv` calls, particularly code using the openssl crate. + #[export] + pub fn use_safe_putenv() { + perlmod::ffi::use_safe_putenv(true); + } }