mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
Merge pull request #9924 from ymartin-ovh/pr-9916
Fix `/v1/actions/` deadlock & nullptr dereference
This commit is contained in:
commit
4d9e9e7ed6
@ -642,9 +642,6 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
|
|||||||
bool ConfigItem::ActivateItems(const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated,
|
bool ConfigItem::ActivateItems(const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated,
|
||||||
bool mainConfigActivation, bool withModAttrs, const Value& cookie)
|
bool mainConfigActivation, bool withModAttrs, const Value& cookie)
|
||||||
{
|
{
|
||||||
static std::mutex mtx;
|
|
||||||
std::unique_lock<std::mutex> lock(mtx);
|
|
||||||
|
|
||||||
if (withModAttrs) {
|
if (withModAttrs) {
|
||||||
/* restore modified attributes */
|
/* restore modified attributes */
|
||||||
if (Utility::PathExists(Configuration::ModAttrPath)) {
|
if (Utility::PathExists(Configuration::ModAttrPath)) {
|
||||||
|
@ -315,11 +315,11 @@ Dictionary::Ptr ApiActions::AddComment(const ConfigObject::Ptr& object,
|
|||||||
return ApiActions::CreateResult(503, "Icinga is reloading.");
|
return ApiActions::CreateResult(503, "Icinga is reloading.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String commentName = Comment::AddComment(checkable, CommentUser,
|
Comment::Ptr comment = Comment::AddComment(checkable, CommentUser,
|
||||||
HttpUtility::GetLastParameter(params, "author"),
|
HttpUtility::GetLastParameter(params, "author"),
|
||||||
HttpUtility::GetLastParameter(params, "comment"), false, timestamp);
|
HttpUtility::GetLastParameter(params, "comment"), false, timestamp);
|
||||||
|
|
||||||
Comment::Ptr comment = Comment::GetByName(commentName);
|
String commentName = comment->GetName();
|
||||||
|
|
||||||
Dictionary::Ptr additional = new Dictionary({
|
Dictionary::Ptr additional = new Dictionary({
|
||||||
{ "name", commentName },
|
{ "name", commentName },
|
||||||
|
@ -130,7 +130,7 @@ int Comment::GetNextCommentID()
|
|||||||
return l_NextCommentID;
|
return l_NextCommentID;
|
||||||
}
|
}
|
||||||
|
|
||||||
String Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryType, const String& author,
|
Comment::Ptr Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryType, const String& author,
|
||||||
const String& text, bool persistent, double expireTime, bool sticky, const String& id, const MessageOrigin::Ptr& origin)
|
const String& text, bool persistent, double expireTime, bool sticky, const String& id, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
String fullName;
|
String fullName;
|
||||||
@ -184,7 +184,7 @@ String Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryTyp
|
|||||||
Log(LogNotice, "Comment")
|
Log(LogNotice, "Comment")
|
||||||
<< "Added comment '" << comment->GetName() << "'.";
|
<< "Added comment '" << comment->GetName() << "'.";
|
||||||
|
|
||||||
return fullName;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Comment::RemoveComment(const String& id, bool removedManually, const String& removedBy,
|
void Comment::RemoveComment(const String& id, bool removedManually, const String& removedBy,
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
static int GetNextCommentID();
|
static int GetNextCommentID();
|
||||||
|
|
||||||
static String AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
|
static Ptr AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
|
||||||
const String& author, const String& text, bool persistent, double expireTime, bool sticky = false,
|
const String& author, const String& text, bool persistent, double expireTime, bool sticky = false,
|
||||||
const String& id = String(), const MessageOrigin::Ptr& origin = nullptr);
|
const String& id = String(), const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user