b8bd1990aa
The bulk of this commit just changes std::vector<std::string> to StringVector when we deal with tokens from a websocket message. The less boring part of it is the new StringVector class, which is a wrapper around std::vector<std::string>, and provides the same API, except that operator[] returns a string, not a string&, and this allows returning an empty string in case that prevents reading past the end of the underlying array. This means in case client code forgets to check size() before invoking operator[], we don't crash. (See the ~3 previous commits which fixed such crashes.) Later the ctor could be changed to take a single underlying string to avoid lots of tiny allocations, that's not yet done in this commit. Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
29 lines
855 B
C++
29 lines
855 B
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* 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/.
|
|
*/
|
|
#ifndef INCLUDED_SECCOMP_HPP
|
|
#define INCLUDED_SECCOMP_HPP
|
|
|
|
#include <Protocol.hpp>
|
|
|
|
namespace Seccomp {
|
|
enum Type { KIT, WSD };
|
|
|
|
/// Lock-down a process hard - @returns true on success.
|
|
bool lockdown(Type type);
|
|
};
|
|
|
|
namespace Rlimit {
|
|
/// Handles setconfig command with limit_... subcommands.
|
|
/// Returns true iff it handled the command, regardless of success/failure.
|
|
bool handleSetrlimitCommand(const StringVector& tokens);
|
|
};
|
|
|
|
#endif
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|