From: Andreas Fischer Date: Sat, 14 Sep 2013 16:44:28 +0000 (+0200) Subject: Perform expiration date checking before returning share data for token. X-Git-Tag: v5.0.13~40^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=49686dc85c7ccb04625557b9947e66f120646b8f;p=nextcloud-server.git Perform expiration date checking before returning share data for token. --- 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; } /**