Przeglądaj źródła

[CTT] Disable timestamp check in FindServerRequest

 - Some OPC UA reference client have issue in establishing a
   connection due to request header timestamp = '0'

Signed-off-by: Jayanth Velusamy <jayanth.v@kalycito.com>
Jayanth Velusamy 4 lat temu
rodzic
commit
28072cee92
1 zmienionych plików z 13 dodań i 0 usunięć
  1. 13 0
      examples/server_ctt.c

+ 13 - 0
examples/server_ctt.c

@@ -571,6 +571,7 @@ usage(void) {
                    "\t[--revocationlist <rv1.crl> <rv2.crl> ...]\n"
                    "\t[--enableUnencrypted]\n"
                    "\t[--enableOutdatedSecurityPolicy]\n"
+                   "\t[--enableTimestampCheck]\n"
 #endif
                    "\t[--enableAnonymous]\n");
 }
@@ -625,6 +626,7 @@ int main(int argc, char **argv) {
     char filetype = ' '; /* t==trustlist, l == issuerList, r==revocationlist */
     UA_Boolean enableUnencr = false;
     UA_Boolean enableSec = false;
+    UA_Boolean enableTime = false;
 
 #endif
 
@@ -649,6 +651,11 @@ int main(int argc, char **argv) {
             continue;
         }
 
+        if(strcmp(argv[pos], "--enableTimestampCheck") == 0) {
+            enableTime = true;
+            continue;
+        }
+
         if(strcmp(argv[pos], "--trustlist") == 0) {
             filetype = 't';
             continue;
@@ -728,6 +735,12 @@ int main(int argc, char **argv) {
     if(!enableSec)
         disableOutdatedSecurityPolicy(&config);
 
+    /* If RequestTimestamp is '0', log the warning and proceed */
+    config.verifyRequestTimestamp = UA_RULEHANDLING_WARN;
+
+    if(enableTime)
+        config.verifyRequestTimestamp = UA_RULEHANDLING_DEFAULT;
+
 #else
     UA_ServerConfig_setMinimal(&config, 4840, &certificate);
 #endif