Browse Source

Fixed absence of (valid) outputArgument node crashing the call service; Fixed namespace compiler assuming browsenames always having the same nsIndex as their parent node.

ichrispa 9 years ago
parent
commit
e593780654
2 changed files with 11 additions and 4 deletions
  1. 6 3
      src/server/ua_services_call.c
  2. 5 1
      tools/pyUANamespace/open62541_MacroHelper.py

+ 6 - 3
src/server/ua_services_call.c

@@ -181,8 +181,8 @@ void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *
         const UA_VariableNode *outputArguments = getArgumentsVariableNode(server, methodCalled,
                                                                           UA_STRING("OutputArguments"));
         if(!outputArguments) {
+            // A MethodNode must have an OutputArguments variable (which may be empty)
             rs->statusCode = UA_STATUSCODE_BADINTERNALERROR;
-            UA_NodeStore_release((const UA_Node*)outputArguments);
             continue;
         }
         
@@ -196,8 +196,11 @@ void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *
         }
         else
             rs->statusCode = UA_STATUSCODE_BADNOTWRITABLE; // There is no NOTEXECUTABLE?
-
-        UA_NodeStore_release((const UA_Node*)outputArguments);
+            
+        /* FIXME: Verify Output Argument count, types and sizes */
+        if(outputArguments) {
+            UA_NodeStore_release((const UA_Node*)outputArguments);
+        }
         UA_NodeStore_release((const UA_Node *)withObject);
         UA_NodeStore_release((const UA_Node *)methodCalled);
     }

+ 5 - 1
tools/pyUANamespace/open62541_MacroHelper.py

@@ -106,7 +106,11 @@ class open62541_MacroHelper():
 
     code.append(nodetype + " *" + node.getCodePrintableID() + " = " + nodetype + "_new();")
     if not "browsename" in self.supressGenerationOfAttribute:
-      code.append(node.getCodePrintableID() + "->browseName = UA_QUALIFIEDNAME_ALLOC(" +  str(node.id().ns) + ", \"" + node.browseName() + "\");")
+      extrNs = node.browseName().split(":")
+      if len(extrNs) > 1:
+        code.append(node.getCodePrintableID() + "->browseName = UA_QUALIFIEDNAME_ALLOC(" +  str(extrNs[0]) + ", \"" + extrNs[1] + "\");")
+      else:
+        code.append(node.getCodePrintableID() + "->browseName = UA_QUALIFIEDNAME_ALLOC(0, \"" + node.browseName() + "\");")
     if not "displayname" in self.supressGenerationOfAttribute:
       code.append(node.getCodePrintableID() + "->displayName = UA_LOCALIZEDTEXT_ALLOC(\"en_US\", \"" +  node.displayName() + "\");")
     if not "description" in self.supressGenerationOfAttribute: