From a321c5427ada6f5dcd97e1abfbea505a67f83233 Mon Sep 17 00:00:00 2001 From: Tanguy Le Faucheur Date: Mon, 20 Nov 2023 09:58:22 +0100 Subject: [PATCH] small adjustments --- app.php | 4 +++- lib/cryptography.class.php | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app.php b/app.php index a3c83ef..43d4f70 100644 --- a/app.php +++ b/app.php @@ -243,7 +243,9 @@ $f3->route('POST /share', $symmetricKey = $_COOKIE[$hash]; $encryptor = new CryptographyClass($_COOKIE[$hash], $f3->get('PDF_STORAGE_PATH').$hash); - $encryptor->encrypt(); + if (!$encryptor->encrypt()) { + $f3->error(403); + }; $f3->reroute($f3->get('REVERSE_PROXY_URL').'/signature/'.$hash."#sk:".$symmetricKey); diff --git a/lib/cryptography.class.php b/lib/cryptography.class.php index 5c873f6..7081f80 100644 --- a/lib/cryptography.class.php +++ b/lib/cryptography.class.php @@ -29,9 +29,10 @@ class CryptographyClass $result = shell_exec($command); if ($result === false) { echo "Cypher failure"; - exit; + return $result; } $this->hardUnlink($file); + return $result; } } @@ -46,7 +47,7 @@ class CryptographyClass } $this->hardUnlink($file); } - return true; + return $result; } public static function hardUnlink($element) {