Переглянути джерело

workaround to get some clients working

Stasik0 10 роки тому
батько
коміт
ddc388fe04
1 змінених файлів з 12 додано та 0 видалено
  1. 12 0
      src/server/ua_securechannel_manager.c

+ 12 - 0
src/server/ua_securechannel_manager.c

@@ -66,6 +66,12 @@ UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_Conne
     entry->channel.securityToken.createdAt       = UA_DateTime_now();
     entry->channel.securityToken.revisedLifetime = (request->requestedLifetime > cm->maxChannelLifetime) ?
                                                    cm->maxChannelLifetime : request->requestedLifetime;
+    //FIXME: pragmatic workaround to get clients requesting lifetime of 0 working
+    if(entry->channel.securityToken.revisedLifetime == 0){
+        entry->channel.securityToken.revisedLifetime = cm->maxChannelLifetime;
+        //FIXME: I'd log it, but there is no pointer to the logger
+        printf("Warning: client requests token lifetime of 0 in OpenSecureChannelRequest setting it to %llu\n", cm->maxChannelLifetime);
+    }
 
     UA_ByteString_copy(&request->clientNonce, &entry->channel.clientNonce);
     entry->channel.serverAsymAlgSettings.securityPolicyUri =
@@ -93,6 +99,12 @@ UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_Conn
     channel->securityToken.createdAt       = UA_DateTime_now(); // todo: is wanted?
     channel->securityToken.revisedLifetime = (request->requestedLifetime > cm->maxChannelLifetime) ?
                                              cm->maxChannelLifetime : request->requestedLifetime;
+    //FIXME: pragmatic workaround to get clients requesting lifetime of 0 working
+    if(channel->securityToken.revisedLifetime == 0){
+        channel->securityToken.revisedLifetime = cm->maxChannelLifetime;
+        //FIXME: I'd log it, but there is no pointer to the logger
+        printf("Warning: client requests token lifetime of 0 in renewing SecureChannel setting it to %llu\n", cm->maxChannelLifetime);
+    }
 
     if(channel->serverNonce.data != UA_NULL)
         UA_ByteString_deleteMembers(&channel->serverNonce);