From fbccd91322412b84fac047351bb3641a5c3c3411 Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Tue, 28 May 2024 15:30:42 +0530 Subject: [PATCH 1/5] fix for wrong date values --- CHANGES_NEXT_RELEASE | 1 + src/lib/common/globals.cpp | 19 + .../wrong_date_values_in_expires_field.test | 358 ++++++++++++++++++ 3 files changed, 378 insertions(+) create mode 100644 test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e8ee65ca95..c1ae92d17c 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,2 +1,3 @@ - Fix: simplified GET /version operation, without including "libversions" field (add ?options=libVersions to get it) - Fix: lighter operation to get databases list from MongoDB (#4517) +- Fix: wrong date values should not allowed in subscription's expires field (#4541) diff --git a/src/lib/common/globals.cpp b/src/lib/common/globals.cpp index 511dbd9d0d..0dd8b886d1 100644 --- a/src/lib/common/globals.cpp +++ b/src/lib/common/globals.cpp @@ -606,6 +606,25 @@ double parse8601Time(const std::string& ss) time.tm_min = m; // 0-59 time.tm_sec = (int) s; // 0-61 (0-60 in C++11) + const int minYear = 0; + const int minMonth = 0; + const int maxMonth = 11; + const int minDay = 1; + const int maxDay = 31; + const int minHour = 0; + const int maxHour = 23; + const int minMinute = 0; + const int maxMinute = 59; + const int minSecond = 0; + const int maxSecond = 59; + + if (time.tm_year < minYear || time.tm_mon < minMonth || time.tm_mon > maxMonth || time.tm_mday < minDay || + time.tm_mday > maxDay || time.tm_hour < minHour || time.tm_hour > maxHour || time.tm_min < minMinute || + time.tm_min > maxMinute || time.tm_sec < minSecond || time.tm_sec > maxSecond) + { + return -1; + } + int64_t totalSecs = timegm(&time) - offset; float millis = s - (int) s; double timestamp = totalSecs; diff --git a/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test new file mode 100644 index 0000000000..a90e17a916 --- /dev/null +++ b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test @@ -0,0 +1,358 @@ +# Copyright 2024 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es + +# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh + +--NAME-- +Wrong date values are not supported in 'expires' field of subscription + +--SHELL-INIT-- +dbInit CB +brokerStart CB + +--SHELL-- + +# +# 01. Create a subscription with an wrong date value in the 'seconds' component of the 'expires' field, see error +# 02. Create a subscription with an wrong date value in the 'minutes' component of the 'expires' field, see error +# 03. Create a subscription with an wrong date value in the 'hours' component of the 'expires' field, see error +# 04. Create a subscription with an wrong date value in the 'days' component of the 'expires' field, see error +# 05. Create a subscription with an wrong date value in the 'months' component of the 'expires' field, see error +# 06. Create a subscription with an wrong date value in the 'years' component of the 'expires' field, see error +# 07. Create a subscription with an valid date value in 'expires' field, (success case) +# + + +echo "01. Create a subscription with an wrong date value in the 'seconds' component of the 'expires' field, see error" +echo "===============================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-12-21T17:16:63.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "02. Create a subscription with an wrong date value in the 'minutes' component of the 'expires' field, see error" +echo "===============================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-12-21T17:65:03.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "03. Create a subscription with an wrong date value in the 'hours' component of the 'expires' field, see error" +echo "=============================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-12-21T25:16:11.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "04. Create a subscription with an wrong date value in the 'days' component of the 'expires' field, see error" +echo "============================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-12-34T17:16:23.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "05. Create a subscription with an wrong date value in the 'months' component of the 'expires' field, see error" +echo "==============================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-13-21T17:16:43.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "06. Create a subscription with an wrong date value in the 'years' component of the 'expires' field, see error" +echo "=============================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "1822-12-21T17:16:23.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "07. Create a subscription with an valid date value in 'expires' field, (success case)" +echo "=====================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2025-12-31T23:59:59.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +--REGEXPECT-- +01. Create a subscription with an wrong date value in the 'seconds' component of the 'expires' field, see error +=============================================================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +02. Create a subscription with an wrong date value in the 'minutes' component of the 'expires' field, see error +=============================================================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +03. Create a subscription with an wrong date value in the 'hours' component of the 'expires' field, see error +============================================================================================================= +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +04. Create a subscription with an wrong date value in the 'days' component of the 'expires' field, see error +============================================================================================================ +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +05. Create a subscription with an wrong date value in the 'months' component of the 'expires' field, see error +============================================================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +06. Create a subscription with an wrong date value in the 'years' component of the 'expires' field, see error +============================================================================================================= +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +07. Create a subscription with an valid date value in 'expires' field, (success case) +===================================================================================== +HTTP/1.1 201 Created +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Location: /v2/subscriptions/REGEX([0-9a-f]{24}) +Content-Length: 0 + + + +--TEARDOWN-- +brokerStop CB +dbDrop CB + From 75fab951320476046ddd2ffd98aea11667695f7d Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Tue, 28 May 2024 17:09:05 +0530 Subject: [PATCH 2/5] corrected failed FT --- .../error_messages_for_invalid_tenant_in_v2.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functionalTest/cases/1087_error_handling/error_messages_for_invalid_tenant_in_v2.test b/test/functionalTest/cases/1087_error_handling/error_messages_for_invalid_tenant_in_v2.test index 722655fa24..c9e78a26de 100644 --- a/test/functionalTest/cases/1087_error_handling/error_messages_for_invalid_tenant_in_v2.test +++ b/test/functionalTest/cases/1087_error_handling/error_messages_for_invalid_tenant_in_v2.test @@ -41,7 +41,7 @@ payload='{ "timestamp_0": { "type": "DateTime", - "value": "017-06-17T07:21:24.238Z", + "value": "2017-06-17T07:21:24.238Z", "metadata": { "very_hot_1": { From 1a824bf514b1b75fb43b7320ba893211bfc4666c Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Thu, 6 Jun 2024 17:44:16 +0530 Subject: [PATCH 3/5] updated code and FT for correct no of days in a month --- src/lib/common/globals.cpp | 48 ++- .../wrong_number_of_days_in_day_field.test | 392 ++++++++++++++++++ 2 files changed, 439 insertions(+), 1 deletion(-) create mode 100644 test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test diff --git a/src/lib/common/globals.cpp b/src/lib/common/globals.cpp index 0dd8b886d1..3bdbb39a93 100644 --- a/src/lib/common/globals.cpp +++ b/src/lib/common/globals.cpp @@ -534,6 +534,52 @@ static int timezoneOffset(const char* tz) +/***************************************************************************** +* +* isLeapYear - +* +* This code will check, if the given year is a leap year or not. +* +*/ +bool isLeapYear(int year) +{ + if (year % 4 != 0) + { + return false; + } + if (year % 100 == 0 && year % 400 != 0) + { + return false; + } + return true; +} + + + +/***************************************************************************** +* +* daysInMonth - +* +* This code will check correct number of days in given month. +* +*/ +int daysInMonth(int year, int month) +{ + if (month == 1) //february + { + return isLeapYear(year) ? 29 : 28; + } + // for April, June, September, November + if (month == 3 || month == 5 || month == 8 || month == 10) + { + return 30; + } + // For all other months (Jan, March, May, July, Aug, October, December) + return 31; +} + + + /***************************************************************************** * * parse8601Time - @@ -610,7 +656,7 @@ double parse8601Time(const std::string& ss) const int minMonth = 0; const int maxMonth = 11; const int minDay = 1; - const int maxDay = 31; + const int maxDay = daysInMonth(y, time.tm_mon);; const int minHour = 0; const int maxHour = 23; const int minMinute = 0; diff --git a/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test new file mode 100644 index 0000000000..cc73b6296b --- /dev/null +++ b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test @@ -0,0 +1,392 @@ +# Copyright 2024 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es + +# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh + +--NAME-- +Check number of days in 'days' field for a month + +--SHELL-INIT-- +dbInit CB +brokerStart CB + +--SHELL-- + +# +# 01. Create a subscription with the wrong days value for 'Jan' month, see error +# 02. Create a subscription with the valid days value for 'Jan' month, (success case) +# 03. Create a subscription with the wrong days value for 'Feb' month (Non-leap year), see error +# 04. Create a subscription with the valid days value for 'Feb' month (Non-leap year), (success case) +# 05. Create a subscription with the wrong days value for 'Feb' month (Leap Year), see error +# 06. Create a subscription with the valid days value for 'Feb' month (Leap-Year), (success case) +# 07. Create a subscription with the wrong days value for 'June' month, see error +# 08. Create a subscription with the valid days value for 'June' month, (success case) +# + + +echo "01. Create a subscription with the wrong days value for 'Jan' month, see error" +echo "==============================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-01-32T17:16:03.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "02. Create a subscription with the valid days value for 'Jan' month, (success case)" +echo "===================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-01-31T17:15:03.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "03. Create a subscription with the wrong days value for 'Feb' month (Non-leap year), see error" +echo "==============================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2024-02-29T25:16:11.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "04. Create a subscription with the valid days value for 'Feb' month (Non-leap year), (success case)" +echo "===================================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2022-02-28T17:16:23.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "05. Create a subscription with the wrong days value for 'Feb' month (Leap Year), see error" +echo "==========================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2024-02-30T17:16:43.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "06. Create a subscription with the valid days value for 'Feb' month (Leap-Year), (success case)" +echo "===============================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2024-02-29T17:16:23.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "07. Create a subscription with the wrong days value for 'June' month, see error" +echo "===============================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2025-06-31T23:59:59.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +echo "08. Create a subscription with the valid days value for 'June' month, (success case)" +echo "====================================================================================" +payload='{ + "subject": { + "entities": [ + { + "id": "Room1", + "type": "Room" + } + ], + "condition": { + "attrs": [ + "pressure" + ] + } + }, + "notification": { + "http": { + "url": "http://localhost:'$LISTENER_PORT'/notify" + }, + "attrs": [ + "pressure" + ] + }, + "expires": "2025-06-30T23:59:59.00Z" +}' +orionCurl --url /v2/subscriptions --payload "$payload" +echo +echo + + +--REGEXPECT-- +01. Create a subscription with the wrong days value for 'Jan' month, see error +============================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +02. Create a subscription with the valid days value for 'Jan' month, (success case) +=================================================================================== +HTTP/1.1 201 Created +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Location: /v2/subscriptions/REGEX([0-9a-f]{24}) +Content-Length: 0 + + + +03. Create a subscription with the wrong days value for 'Feb' month (Non-leap year), see error +============================================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +04. Create a subscription with the valid days value for 'Feb' month (Non-leap year), (success case) +=================================================================================================== +HTTP/1.1 201 Created +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Location: /v2/subscriptions/REGEX([0-9a-f]{24}) +Content-Length: 0 + + + +05. Create a subscription with the wrong days value for 'Feb' month (Leap Year), see error +========================================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +06. Create a subscription with the valid days value for 'Feb' month (Leap-Year), (success case) +=============================================================================================== +HTTP/1.1 201 Created +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Location: /v2/subscriptions/REGEX([0-9a-f]{24}) +Content-Length: 0 + + + +07. Create a subscription with the wrong days value for 'June' month, see error +=============================================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 68 + +{ + "description": "expires has an invalid format", + "error": "BadRequest" +} + + +08. Create a subscription with the valid days value for 'June' month, (success case) +==================================================================================== +HTTP/1.1 201 Created +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Location: /v2/subscriptions/REGEX([0-9a-f]{24}) +Content-Length: 0 + + + +--TEARDOWN-- +brokerStop CB +dbDrop CB + From d2e95bc86d1155c87e9435c5beeac7d8d22dc64b Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Fri, 7 Jun 2024 16:45:44 +0530 Subject: [PATCH 4/5] updated code as per comment --- src/lib/common/globals.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/common/globals.cpp b/src/lib/common/globals.cpp index 3bdbb39a93..2bc490b004 100644 --- a/src/lib/common/globals.cpp +++ b/src/lib/common/globals.cpp @@ -543,15 +543,16 @@ static int timezoneOffset(const char* tz) */ bool isLeapYear(int year) { - if (year % 4 != 0) + // ref: https://www.geeksforgeeks.org/program-check-given-year-leap-year/ + if (year % 400 == 0) { - return false; + return true; } - if (year % 100 == 0 && year % 400 != 0) + if ((year % 4 == 0) && (year % 100 != 0)) { - return false; + return true; } - return true; + return false; } From 3d2a20ea930247d454c288ce983fdab791fea6bf Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Fri, 7 Jun 2024 18:02:44 +0530 Subject: [PATCH 5/5] updated FT typo --- .../wrong_date_values_in_expires_field.test | 2 +- .../wrong_number_of_days_in_day_field.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test index a90e17a916..0c566d00e3 100644 --- a/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test +++ b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_date_values_in_expires_field.test @@ -219,7 +219,7 @@ payload='{ "pressure" ] }, - "expires": "1822-12-21T17:16:23.00Z" + "expires": "1899-12-21T17:16:23.00Z" }' orionCurl --url /v2/subscriptions --payload "$payload" echo diff --git a/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test index cc73b6296b..93656da64e 100644 --- a/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test +++ b/test/functionalTest/cases/4541_wrong_date_values_in_subscription/wrong_number_of_days_in_day_field.test @@ -127,7 +127,7 @@ payload='{ "pressure" ] }, - "expires": "2024-02-29T25:16:11.00Z" + "expires": "2100-02-29T12:16:11.00Z" }' orionCurl --url /v2/subscriptions --payload "$payload" echo