libreoffice-online/wsd/ServerAuditUtil.hpp
Michael Meeks d65e227905 Attempt to fix curious assertion around ServerAuditUtil.
[ websrv_poll ] SIG   Fatal signal received: SIGABRT code: 18446744073709551610 for address: 0x730000696e
  Backtrace 26990 - wsd 24.04.4.4snapshot 07bc101:
    __GI_abort                                     glibc-2.27/stdlib/abort.c:81
    __GI___pthread_mutex_lock                      glibc-2.27/nptl/../nptl/pthread_mutex_lock.c:67
    ServerAuditUtil::set(std::string, std::string) /usr/include/c++/12/bits/std_mutex.h:103
    SocketDisposition::execute()                   /usr/include/c++/12/bits/std_function.h:591
    SocketPoll::poll(long)                         /usr/include/c++/12/bits/shared_ptr_base.h:1070

  Also cleanup member naming to match the COOL standard.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4fd6f4d57c3cbfe1edf7121895e5dab7e13fa4fc
2024-07-10 08:32:07 +01:00

40 lines
967 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* Copyright the Collabora Online contributors.
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <string>
#include <map>
#include <mutex>
/** This class helps to build list of security warnings for a server instance
*/
class ServerAuditUtil
{
mutable std::mutex _mutex;
// <code, status>
std::map<std::string, std::string> _entries;
bool _disabled;
public:
ServerAuditUtil();
std::string getResultsJSON() const;
void set(std::string code, std::string status);
void disable() { _disabled = true; }
bool isDisabled() const { return _disabled; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */