|
@@ -23,6 +23,9 @@ void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
|
|
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD)
|
|
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ //bind session to channel
|
|
|
|
+ channel->session = newSession;
|
|
|
|
+
|
|
//TODO get maxResponseMessageSize internally
|
|
//TODO get maxResponseMessageSize internally
|
|
newSession->maxResponseMessageSize = request->maxResponseMessageSize;
|
|
newSession->maxResponseMessageSize = request->maxResponseMessageSize;
|
|
response->sessionId = newSession->sessionId;
|
|
response->sessionId = newSession->sessionId;
|
|
@@ -54,12 +57,10 @@ void Service_ActivateSession(UA_Server *server,UA_SecureChannel *channel,
|
|
&foundSession);
|
|
&foundSession);
|
|
|
|
|
|
if(foundSession == UA_NULL){
|
|
if(foundSession == UA_NULL){
|
|
- response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
|
|
|
|
+ response->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
UA_UserIdentityToken token;
|
|
UA_UserIdentityToken token;
|
|
UA_UserIdentityToken_init(&token);
|
|
UA_UserIdentityToken_init(&token);
|
|
size_t offset = 0;
|
|
size_t offset = 0;
|
|
@@ -78,8 +79,9 @@ void Service_ActivateSession(UA_Server *server,UA_SecureChannel *channel,
|
|
|
|
|
|
//anonymous logins
|
|
//anonymous logins
|
|
if(server->config.Login_enableAnonymous && UA_String_equalchars(&token.policyId, ANONYMOUS_POLICY)){
|
|
if(server->config.Login_enableAnonymous && UA_String_equalchars(&token.policyId, ANONYMOUS_POLICY)){
|
|
- //success - bind session to the channel
|
|
|
|
|
|
+ //success - activate
|
|
channel->session = foundSession;
|
|
channel->session = foundSession;
|
|
|
|
+ channel->session->activated = UA_TRUE;
|
|
RETURN;
|
|
RETURN;
|
|
//username logins
|
|
//username logins
|
|
}else if(server->config.Login_enableUsernamePassword && UA_String_equalchars(&token.policyId, USERNAME_POLICY)){
|
|
}else if(server->config.Login_enableUsernamePassword && UA_String_equalchars(&token.policyId, USERNAME_POLICY)){
|
|
@@ -100,8 +102,9 @@ void Service_ActivateSession(UA_Server *server,UA_SecureChannel *channel,
|
|
for(UA_UInt32 i=0;i<server->config.Login_loginsCount;++i){
|
|
for(UA_UInt32 i=0;i<server->config.Login_loginsCount;++i){
|
|
if(UA_String_equalchars(&username_token.userName, server->config.Login_usernames[i])
|
|
if(UA_String_equalchars(&username_token.userName, server->config.Login_usernames[i])
|
|
&& UA_String_equalchars(&username_token.password, server->config.Login_passwords[i])){
|
|
&& UA_String_equalchars(&username_token.password, server->config.Login_passwords[i])){
|
|
- //success - bind session to the channel
|
|
|
|
|
|
+ //success - activate
|
|
channel->session = foundSession;
|
|
channel->session = foundSession;
|
|
|
|
+ channel->session->activated = UA_TRUE;
|
|
RETURN;
|
|
RETURN;
|
|
}
|
|
}
|
|
}
|
|
}
|