- IED SERVER: fixed bug when calling write access handler (when access policy DENY)

pull/71/head
Michael Zillgith 7 years ago
parent eacdfa953d
commit b5cb80868c

@ -132,8 +132,13 @@ writeAccessHandler (DataAttribute* dataAttribute, MmsValue* value, ClientConnect
{ {
void* securityToken = ClientConnection_getSecurityToken(connection); void* securityToken = ClientConnection_getSecurityToken(connection);
if (securityToken != password2) if (dataAttribute == IEDMODEL_GenericIO_LLN0_ModAuto_setVal)
printf("Write access to LLN0.ModAuto.setVal: %i\n", MmsValue_getBoolean(value));
if (securityToken != password2) {
printf(" Access denied\n");
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
}
return DATA_ACCESS_ERROR_SUCCESS; return DATA_ACCESS_ERROR_SUCCESS;
} }
@ -167,6 +172,9 @@ int main(int argc, char** argv) {
IedServer_setControlHandler(iedServer, IEDMODEL_GenericIO_GGIO1_SPCSO4, IedServer_setControlHandler(iedServer, IEDMODEL_GenericIO_GGIO1_SPCSO4,
(ControlHandler) controlHandlerForBinaryOutput, IEDMODEL_GenericIO_GGIO1_SPCSO4); (ControlHandler) controlHandlerForBinaryOutput, IEDMODEL_GenericIO_GGIO1_SPCSO4);
/* Allow only write access to settings that have a handler */
IedServer_setWriteAccessPolicy(iedServer, IEC61850_FC_SP, ACCESS_POLICY_DENY);
/* Set write access handler */ /* Set write access handler */
IedServer_handleWriteAccess(iedServer, IEDMODEL_GenericIO_LLN0_ModAuto_setVal, writeAccessHandler, NULL); IedServer_handleWriteAccess(iedServer, IEDMODEL_GenericIO_LLN0_ModAuto_setVal, writeAccessHandler, NULL);

@ -2079,8 +2079,12 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
} }
else { /* if ACCESS_POLICY_DENY only allow direct access to handled data attribute */ else { /* if ACCESS_POLICY_DENY only allow direct access to handled data attribute */
if (dataAttribute->mmsValue == cachedValue) { if (dataAttribute->mmsValue == cachedValue) {
ClientConnection clientConnection = private_IedServer_getClientConnectionByHandle(self->iedServer,
connection);
MmsDataAccessError handlerResult = MmsDataAccessError handlerResult =
accessHandler->handler(dataAttribute, value, (ClientConnection) connection, accessHandler->handler(dataAttribute, value, clientConnection,
accessHandler->parameter); accessHandler->parameter);
if (handlerResult == DATA_ACCESS_ERROR_SUCCESS) { if (handlerResult == DATA_ACCESS_ERROR_SUCCESS) {

Loading…
Cancel
Save