From 434787a63a33bdbcb4daa6f1306b25bfc95eff30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Sep 2024 11:19:54 +0200 Subject: [PATCH] DOS protection is per week instead of month --- htdocs/core/lib/public.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/public.lib.php b/htdocs/core/lib/public.lib.php index ecc75de10da..0ce710517de 100644 --- a/htdocs/core/lib/public.lib.php +++ b/htdocs/core/lib/public.lib.php @@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; /** - * Check if the object exceeded the number of posts for a specific ip - * @param object $object Object to check - * @param int $nb_post_max Number max of posts + * Check if the object exceeded the number of posts for a specific ip in the same week * - * @return int return <0 if error, >0 if OK + * @param object $object Object to check + * @param int $nb_post_max Number max of posts + * @return int Return <0 if error, >0 if OK */ function checkNbPostsForASpeceificIp($object, $nb_post_max) { @@ -42,7 +42,7 @@ function checkNbPostsForASpeceificIp($object, $nb_post_max) $nb_post_ip = 0; $now = dol_now(); - $minmonthpost = dol_time_plus_duree($now, -1, "m"); + $minmonthpost = dol_time_plus_duree($now, -1, "w"); if (empty($object->ip)) { $object->ip = getUserRemoteIP();