|
@@ -83,9 +83,8 @@ void Service_ActivateSession(UA_Server *server,UA_SecureChannel *channel,
|
|
//todo cleanup session
|
|
//todo cleanup session
|
|
RETURN;
|
|
RETURN;
|
|
}
|
|
}
|
|
-
|
|
|
|
//username logins
|
|
//username logins
|
|
- if(UA_String_equalchars(&token.policyId, USERNAME_POLICY)){
|
|
|
|
|
|
+ else if(UA_String_equalchars(&token.policyId, USERNAME_POLICY)){
|
|
if(!server->config.Login_enableUsernamePassword){
|
|
if(!server->config.Login_enableUsernamePassword){
|
|
response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
//todo cleanup session
|
|
//todo cleanup session
|
|
@@ -99,6 +98,12 @@ void Service_ActivateSession(UA_Server *server,UA_SecureChannel *channel,
|
|
//todo cleanup session
|
|
//todo cleanup session
|
|
RETURN;
|
|
RETURN;
|
|
}
|
|
}
|
|
|
|
+ if(username_token.userName.length == -1 && username_token.password.length == -1){
|
|
|
|
+ //empty username and password
|
|
|
|
+ response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
|
|
+ //todo cleanup session
|
|
|
|
+ RETURN;
|
|
|
|
+ }
|
|
UA_Boolean matched = UA_FALSE;
|
|
UA_Boolean matched = UA_FALSE;
|
|
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])
|
|
@@ -109,10 +114,14 @@ void Service_ActivateSession(UA_Server *server,UA_SecureChannel *channel,
|
|
}
|
|
}
|
|
if(!matched){
|
|
if(!matched){
|
|
//no username/pass matched
|
|
//no username/pass matched
|
|
- response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
|
|
|
|
+ response->responseHeader.serviceResult = UA_STATUSCODE_BADUSERACCESSDENIED;
|
|
//todo cleanup session
|
|
//todo cleanup session
|
|
RETURN;
|
|
RETURN;
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
|
|
+ //todo cleanup session
|
|
|
|
+ RETURN;
|
|
}
|
|
}
|
|
|
|
|
|
//success - bind session to the channel
|
|
//success - bind session to the channel
|
|
@@ -130,7 +139,7 @@ void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_Close
|
|
(const UA_NodeId*)&request->requestHeader.authenticationToken, &foundSession);
|
|
(const UA_NodeId*)&request->requestHeader.authenticationToken, &foundSession);
|
|
|
|
|
|
if(foundSession == UA_NULL){
|
|
if(foundSession == UA_NULL){
|
|
- response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
|
|
|
|
|
|
+ response->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|