AddressSpaceAccess_WriteValue: inhibits write of Timestamp/StatusCode when const address space is used

Description

In the SOPC_AddressSpaceAccess_WriteValue function inhibits write of Timestamp/StatusCode when const address space is used and does not allow to modify metadata of a Variable Value.

Displays a warning in log when a custom value is requested (status != Good and Ts != 0).

Code version and environment identification

Present in 1.7.2 and since address space access feature first version

Steps to reproduce

Generate a constant C address space using scripts/generate-s2opc-address-space.py --const_addspace which generate an address space with only Variable Value modifiable (and not the associated metadata Status / Timestamp). Use it in a server and during a method call use SOPC_AddressSpaceAccess_WriteValue in implementation with either a Status or Timestamp parameter not NULL.

The operation fails with OpcUa_BadWriteNotSupported because those elements are not writable in a constant address space.

Analysis

Due to specific constraints of constant address space some local write operation might be rejected.

Security impact

No security impact.

Possible fixes

In order to make use of constant address space easier on constrained environment platform, the following behavior is proposed when an optional Status or Timestamp parameter is set Check if address space is constant and if this is the case check if a custom value has been set (Status != Good and TS != 0). If a custom value has been set display a warning in log and in both cases ignore the Status/Timestamp setting for this write operation.