From 6f87665745cd432f025215bb259a974dc434964e Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 9 Jun 2025 12:00:41 +0200 Subject: use unique tmp name for auth token file (#426) * use Oid to generate unique name since std::tmpnam is not good practice --- src/zenhttp/httpclientauth.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/zenhttp/httpclientauth.cpp b/src/zenhttp/httpclientauth.cpp index 916b25bff..39efe1d0c 100644 --- a/src/zenhttp/httpclientauth.cpp +++ b/src/zenhttp/httpclientauth.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -94,9 +95,8 @@ namespace zen { namespace httpclientauth { CreateProcOptions ProcOptions; - const std::string AuthTokenPath = ".zen-auth-oidctoken"; - - auto _ = MakeGuard([AuthTokenPath]() { RemoveFile(AuthTokenPath); }); + const std::filesystem::path AuthTokenPath(std::filesystem::temp_directory_path() / fmt::format(".zen-auth-{}", Oid::NewOid())); + auto _ = MakeGuard([AuthTokenPath]() { RemoveFile(AuthTokenPath); }); const std::string ProcArgs = fmt::format("{} --AuthConfigUrl {} --OutFile {} --Unattended={}", OidcExecutablePath, -- cgit v1.2.3