diff --git a/CMakeLists.txt b/CMakeLists.txt index 50c7a7c7..195a20a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ option(CONFIG_IEC61850_LOG_SERVICE "Build with support for IEC 61850 logging ser option(CONFIG_IEC61850_SERVICE_TRACKING "Build with support for IEC 61850 service tracking" ON) option(CONFIG_IEC61850_SETTING_GROUPS "Build with support for IEC 61850 setting group services" ON) option(CONFIG_IEC61850_SUPPORT_USER_READ_ACCESS_CONTROL "Allow user provided callback to control read access" ON) +option(CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT "allow only configured clients (when pre-configured by ClientLN)" OFF) set(CONFIG_REPORTING_DEFAULT_REPORT_BUFFER_SIZE "65536" CACHE STRING "Default buffer size for buffered reports in byte" ) diff --git a/config/stack_config.h.cmake b/config/stack_config.h.cmake index dd93fcce..d3ef67b5 100644 --- a/config/stack_config.h.cmake +++ b/config/stack_config.h.cmake @@ -137,7 +137,7 @@ #define CONFIG_IEC61850_BRCB_WITH_RESVTMS 1 /* allow only configured clients (when pre-configured by ClientLN) - note behavior in PIXIT Rp13 */ -#define CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT 0 +#cmakedefine01 CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT /* The default buffer size of buffered RCBs in bytes */ #cmakedefine CONFIG_REPORTING_DEFAULT_REPORT_BUFFER_SIZE @CONFIG_REPORTING_DEFAULT_REPORT_BUFFER_SIZE@ diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index cbd6e3cf..677194c1 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -1732,17 +1732,18 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme } #if (CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT == 1) - if (isIpAddressMatchingWithOwner(rc, MmsServerConnection_getClientAddress(connection)) == false) { - retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; + if (rc->resvTms == -1) { + if (isIpAddressMatchingWithOwner(rc, MmsServerConnection_getClientAddress(connection)) == false) { + retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; - if (DEBUG_IED_SERVER) - printf("IED_SERVER: client IP not matching with pre-assigned owner --> write access denied!\n"); + if (DEBUG_IED_SERVER) + printf("IED_SERVER: client IP not matching with pre-assigned owner --> write access denied!\n"); - goto exit_function; + goto exit_function; + } } #endif - if (strcmp(elementName, "RptEna") == 0) { if (value->value.boolean == true) { diff --git a/src/mms/iso_mms/common/mms_value.c b/src/mms/iso_mms/common/mms_value.c index 1281c8a8..2b604f85 100644 --- a/src/mms/iso_mms/common/mms_value.c +++ b/src/mms/iso_mms/common/mms_value.c @@ -101,6 +101,9 @@ MmsValue_newUnsignedFromBerInteger(Asn1PrimitiveValue* berInteger) bool MmsValue_equals(const MmsValue* self, const MmsValue* otherValue) { + if ((self == NULL) || (otherValue == NULL)) + return false; + if (self->type == otherValue->type) { switch (self->type) {