Browse Source

server: CTT - Fix usage of incorrect Reference type

Signed-off-by: Jayanth Velusamy <jayanth.v@kalycito.com>
Jayanth Velusamy 4 years ago
parent
commit
787a24ea7f
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/server/ua_services_nodemanagement.c

+ 8 - 0
src/server/ua_services_nodemanagement.c

@@ -923,6 +923,14 @@ recursiveTypeCheckAddChildren(UA_Server *server, UA_Session *session,
             return retval;
         }
 
+        /* Check NodeClass for 'hasSubtype'. UA_NODECLASS_VARIABLE not allowed to have subtype */
+        if((node->nodeClass == UA_NODECLASS_VARIABLE) && (UA_NodeId_equal(
+                &node->references->referenceTypeId, &hasSubtype))) {
+            UA_LOG_INFO_SESSION(&server->config.logger, session,
+                                            "AddNodes: VariableType not allowed to have HasSubType");
+            return UA_STATUSCODE_BADREFERENCENOTALLOWED;
+        }
+
         /* Check if all attributes hold the constraints of the type now. The initial
          * attributes must type-check. The constructor might change the attributes
          * again. Then, the changes are type-checked by the normal write service. */