From 49686dc85c7ccb04625557b9947e66f120646b8f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 14 Sep 2013 18:44:28 +0200 Subject: [PATCH] Perform expiration date checking before returning share data for token. --- lib/public/share.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/public/share.php b/lib/public/share.php index 0a88ea4ea44..ea4116eaa76 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -293,7 +293,18 @@ class Share { if (\OC_DB::isError($result)) { \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result) . ', token=' . $token, \OC_Log::ERROR); } - return $result->fetchRow(); + $row = $result->fetchRow(); + + if (!empty($row['expiration'])) { + $now = new \DateTime(); + $expirationDate = new \DateTime($row['expiration'], new \DateTimeZone('UTC')); + if ($now > $expirationDate) { + self::delete($row['id']); + return false; + } + } + + return $row; } /** -- 2.39.5