Przeglądaj źródła

Compatibililty issue: Siemens OPC Scout V10 sent an empty policyId -> removed the check to insure interoperability

Stasik0 9 lat temu
rodzic
commit
af628ae9af
1 zmienionych plików z 9 dodań i 4 usunięć
  1. 9 4
      src/server/ua_services_session.c

+ 9 - 4
src/server/ua_services_session.c

@@ -61,10 +61,15 @@ void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
 
     UA_String ap = UA_STRING(ANONYMOUS_POLICY);
     UA_String up = UA_STRING(USERNAME_POLICY);
-    if(token.policyId.data == UA_NULL) {
-        /* 1) no policy defined */
-        response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
-    } else if(server->config.Login_enableAnonymous && UA_String_equal(&token.policyId, &ap)) {
+    //(Compatibility notice)
+    //Siemens OPC Scout v10 provides an empty policyId, this is not okay
+    //For compatibility we will assume that empty policyId == ANONYMOUS_POLICY
+    //if(token.policyId.data == UA_NULL) {
+    //    /* 1) no policy defined */
+    //    response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
+    //} else
+    //(End Compatibility notice)
+    if(server->config.Login_enableAnonymous && (token.policyId.data == UA_NULL || UA_String_equal(&token.policyId, &ap))) {
         /* 2) anonymous logins */
         if(foundSession->channel && foundSession->channel != channel)
             UA_SecureChannel_detachSession(foundSession->channel, foundSession);