|
@@ -14,6 +14,15 @@
|
|
|
#include "ua_types_generated_handling.h"
|
|
|
#include "ua_securitypolicy_none.h"
|
|
|
|
|
|
+
|
|
|
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
|
+
|
|
|
+
|
|
|
+UA_NodeId unsafe_fuzz_authenticationToken = {
|
|
|
+ 0, UA_NODEIDTYPE_NUMERIC, {0}
|
|
|
+};
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -394,9 +403,21 @@ processMSG(UA_Server *server, UA_SecureChannel *channel,
|
|
|
Service_CreateSession(server, channel,
|
|
|
(const UA_CreateSessionRequest *)request,
|
|
|
(UA_CreateSessionResponse *)response);
|
|
|
+ #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
|
+
|
|
|
+
|
|
|
+ UA_CreateSessionResponse *res = (UA_CreateSessionResponse *)response;
|
|
|
+ UA_NodeId_copy(&res->authenticationToken, &unsafe_fuzz_authenticationToken);
|
|
|
+ #endif
|
|
|
goto send_response;
|
|
|
}
|
|
|
|
|
|
+ #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
|
+
|
|
|
+ if (!UA_NodeId_isNull(&unsafe_fuzz_authenticationToken))
|
|
|
+ UA_NodeId_copy(&unsafe_fuzz_authenticationToken, &requestHeader->authenticationToken);
|
|
|
+ #endif
|
|
|
+
|
|
|
|
|
|
session = UA_SecureChannel_getSession(channel, &requestHeader->authenticationToken);
|
|
|
if(!session)
|
|
@@ -492,6 +513,14 @@ send_response:
|
|
|
|
|
|
UA_deleteMembers(request, requestType);
|
|
|
UA_deleteMembers(response, responseType);
|
|
|
+
|
|
|
+ #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
|
+
|
|
|
+
|
|
|
+ if (session && session->sessionId.identifierType == UA_NODEIDTYPE_GUID &&
|
|
|
+ UA_Guid_equal(&session->sessionId.identifier.guid, &UA_GUID_NULL))
|
|
|
+ UA_Session_deleteMembersCleanup(session, server);
|
|
|
+ #endif
|
|
|
return retval;
|
|
|
}
|
|
|
|