Fix attribute validation for PUT queries

fixes #10601
This commit is contained in:
Michael Friedrich 2015-11-12 09:31:27 +01:00
parent e1b2f1750d
commit 6518f78af0
3 changed files with 10 additions and 5 deletions

View File

@ -320,7 +320,12 @@ void Downtime::TriggerDowntime(void)
{
ObjectLock olock(triggers);
BOOST_FOREACH(const String& triggerName, triggers) {
Downtime::GetByName(triggerName)->TriggerDowntime();
Downtime::Ptr downtime = Downtime::GetByName(triggerName);
if (!downtime)
continue;
downtime->TriggerDowntime();
}
}

View File

@ -76,9 +76,9 @@ class Downtime : ConfigObject < DowntimeNameComposer
[state] double trigger_time;
[config] bool fixed;
[config] double duration;
[state] name(Downtime) triggered_by;
[config] name(Downtime) triggered_by;
[config] String scheduled_by;
[config] Array::Ptr triggers {
[state] Array::Ptr triggers {
default {{{ return new Array(); }}}
};
int legacy_id;

View File

@ -71,14 +71,14 @@ String ConfigObjectUtility::CreateObjectConfig(const Type::Ptr& type, const Stri
ObjectLock olock(attrs);
BOOST_FOREACH(const Dictionary::Pair& kv, attrs) {
int fid = type->GetFieldId(kv.first);
int fid = type->GetFieldId(kv.first.SubStr(0, kv.first.FindFirstOf(".")));
if (fid < 0)
BOOST_THROW_EXCEPTION(ScriptError("Invalid attribute specified: " + kv.first));
Field field = type->GetFieldInfo(fid);
if (field.Attributes & FANoUserModify)
if (!(field.Attributes & FAConfig) || kv.first == "name")
BOOST_THROW_EXCEPTION(ScriptError("Attribute is marked for internal use only and may not be set: " + kv.first));
}
}