Procházet zdrojové kódy

[FIX] Check timestamp values in request header

 - The server application should check the timestamp value in the
   header according to CTT test cases in the version 1.03.341.385
 - Timestamp is checked in the request headers before dispatching
   to services
 - This fix will resolve the following test cases
 - ViewTranslateBrowsePath -> Err-024.js
 - ViewRegisterNodes -> Err-009.js, Err-014.js
 - View Minimum Continuation Point 01 -> Err-010.js

Signed-off-by: Jayanth Velusamy <jayanth.v@kalycito.com>
Jayanth Velusamy před 5 roky
rodič
revize
5358b4bde0
1 změnil soubory, kde provedl 7 přidání a 0 odebrání
  1. 7 0
      src/server/ua_server_binary.c

+ 7 - 0
src/server/ua_server_binary.c

@@ -12,6 +12,7 @@
  *    Copyright 2016 (c) TorbenD
  *    Copyright 2017 (c) frax2222
  *    Copyright 2017 (c) Mark Giraud, Fraunhofer IOSB
+ *    Copyright 2019 (c) Kalycito Infotech Private Limited
  */
 
 #include "ua_server_internal.h"
@@ -558,6 +559,12 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
     ((UA_ResponseHeader*)response)->requestHandle = requestHeader->requestHandle;
     ((UA_ResponseHeader*)response)->timestamp = UA_DateTime_now();
 
+    /* Check timestamp in the request header */
+    if(!(requestHeader->timestamp)) {
+        return sendServiceFault(channel, msg, requestPos, responseType,
+                                requestId, UA_STATUSCODE_BADINVALIDTIMESTAMP);
+    }
+
     /* Process normal services before initializing the message context.
      * Some services may initialize new message contexts and to support network
      * layers only providing one send buffer, only one message context can be