From 4e38d4bba7d145376e9779979c00211145d3095e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Tue, 29 Aug 2023 19:19:16 -0300 Subject: [PATCH] #1846: use setenv call in Linux to avoid problems reading APFS passwords in TSK --- iped-engine/src/main/java/iped/engine/util/CLibrary.java | 4 +++- iped-engine/src/main/java/iped/engine/util/Util.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iped-engine/src/main/java/iped/engine/util/CLibrary.java b/iped-engine/src/main/java/iped/engine/util/CLibrary.java index d8a7cc5039..4255d050b2 100644 --- a/iped-engine/src/main/java/iped/engine/util/CLibrary.java +++ b/iped-engine/src/main/java/iped/engine/util/CLibrary.java @@ -5,7 +5,9 @@ public interface CLibrary extends Library { int _putenv(String value); - + int putenv(String value); + void setenv(String name, String value, boolean overwrite); + } diff --git a/iped-engine/src/main/java/iped/engine/util/Util.java b/iped-engine/src/main/java/iped/engine/util/Util.java index 45aba656f2..b489e11a9a 100644 --- a/iped-engine/src/main/java/iped/engine/util/Util.java +++ b/iped-engine/src/main/java/iped/engine/util/Util.java @@ -485,7 +485,7 @@ public static void setEnvVar(String key, String value) { if (C_Library == null) { C_Library = (CLibrary) Native.loadLibrary("c", CLibrary.class); } - C_Library.putenv(key + "=" + value); + C_Library.setenv(key, value, true); } }