diff --git a/evcontroller.c b/evcontroller.c index 85ca22b4..33fb9abc 100644 --- a/evcontroller.c +++ b/evcontroller.c @@ -920,19 +920,32 @@ int EVCGetPar(pEVControl self, char *name, float *fVal) int EVCSetPar(pEVControl self, char *name, float fVal, SConnection * pCon) { ObPar *pPar = NULL; - char pBueffel[512]; int iRet, savedStatus; assert(self); assert(pCon); - savedStatus = GetStatus(); /* fool status check in ObParSet (avoid "Cannot change parameter while running" message */ - SetStatus(eBatch); - iRet = ObParSet(self->pParam, self->pName, name, fVal, pCon); - SetStatus(savedStatus); - if (!iRet) { - return iRet; + /* find the parameter */ + pPar = ObParFind(self->pParam, name); + if (pPar == NULL) { + SCPrintf(pCon, eError, "ERROR: %s.%s parameter not found", + self->pName, name); + return 0; } + + /* DO NOT CHECK RUNNING STATE, this is not needed */ + + /* check permission */ + if (!SCMatchRights(pCon, pPar->iCode)) { + SCPrintf(pCon, eError, "ERROR: Insufficient privilege to change %s.%s", + self->pName, name); + return 0; + } + + /* passed all tests: do It! */ + pPar->fVal = fVal; + + iRet = 1; if (self->iTcl) { iRet = UpdateTclVariable(self->pDriv, name, fVal); }