Salīdzināt revīzijas
8 Revīzijas
WIP/cpp20
...
5570154113
Autors | SHA1 | Datums | |
---|---|---|---|
5570154113 | |||
4f6bcd27b4 | |||
bbe74a2c50 | |||
5db9305408 | |||
c90e26a374 | |||
b297498ca9 | |||
fdcef18861 | |||
75268e0073 |
2
cache/fscache.cpp
ārējs
2
cache/fscache.cpp
ārējs
@ -46,7 +46,7 @@ void FsCache::removePrefix(std::string_view prefix)
|
||||
// TODO: lock dir
|
||||
for(auto &entry : std::filesystem::directory_iterator(std::filesystem::path{this->path}))
|
||||
{
|
||||
if(std::string_view(entry.path().filename().c_str()).starts_with(prefix) == 0)
|
||||
if(std::string_view(entry.path().filename().c_str()).starts_with(prefix))
|
||||
{
|
||||
std::filesystem::remove_all(entry);
|
||||
}
|
||||
|
@ -25,7 +25,11 @@ Response HandlerSearch::handleRequest(const Request &r)
|
||||
std::string q = r.get("q");
|
||||
if(q.empty())
|
||||
{
|
||||
return errorResponse("Missing search term", "No search term supplied");
|
||||
TemplatePage searchForm = this->templ->getPage("searchform");
|
||||
response.setBody(searchForm.render());
|
||||
response.setStatus(200);
|
||||
setGeneralVars(searchForm);
|
||||
return response;
|
||||
}
|
||||
|
||||
auto pageDao = this->database->createPageDao();
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <filesystem>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/capability.h>
|
||||
#define HAVE_LANDLOCK 0
|
||||
#include <qssb.h>
|
||||
#include "../logger.h"
|
||||
#include "../utils.h"
|
||||
@ -59,18 +60,25 @@ bool SandboxLinux::enable(std::vector<std::string> fsPaths)
|
||||
policy->not_dumpable = 1;
|
||||
policy->no_new_privs = 1;
|
||||
policy->mount_path_policies_to_chroot = 1;
|
||||
/* TODO: as said, a whitelist approach is better. As such, this list is bound to be incomplete in the
|
||||
* sense that more could be listed here and some critical ones are probably missing */
|
||||
|
||||
/* TODO: use qssb groups */
|
||||
long blacklisted_syscalls[] = {QSSB_SYS(setuid), QSSB_SYS(connect), QSSB_SYS(chroot), QSSB_SYS(pivot_root),
|
||||
QSSB_SYS(mount), QSSB_SYS(setns), QSSB_SYS(unshare), QSSB_SYS(ptrace),
|
||||
QSSB_SYS(personality), QSSB_SYS(prctl), QSSB_SYS(execveat), QSSB_SYS(execve),
|
||||
QSSB_SYS(fork)};
|
||||
qssb_append_syscalls_policy(policy, QSSB_SYSCALL_DENY_KILL_PROCESS, blacklisted_syscalls,
|
||||
sizeof(blacklisted_syscalls) / sizeof(blacklisted_syscalls[0]));
|
||||
qssb_append_syscall_default_policy(policy, QSSB_SYSCALL_ALLOW);
|
||||
|
||||
if(qssb_append_group_syscall_policy(policy, QSSB_SYSCALL_ALLOW, QSSB_SYSCGROUP_DEFAULT_ALLOW) != 0)
|
||||
{
|
||||
Logger::error() << "Sandbox: Failed to add whitelist!";
|
||||
qssb_free_policy(policy);
|
||||
return false;
|
||||
}
|
||||
if(qssb_append_group_syscall_policy(policy, QSSB_SYSCALL_ALLOW, QSSB_SYSCGROUP_SOCKET | QSSB_SYSCGROUP_FUTEX | QSSB_SYSCGROUP_PATH | QSSB_SYSCGROUP_SCHED) != 0)
|
||||
{
|
||||
Logger::error() << "Sandbox: Failed to add socket group!";
|
||||
qssb_free_policy(policy);
|
||||
return false;
|
||||
}
|
||||
if(qssb_append_syscall_default_policy(policy, QSSB_SYSCALL_DENY_KILL_PROCESS) != 0)
|
||||
{
|
||||
Logger::error() << "Sandbox: Default policy";
|
||||
qssb_free_policy(policy);
|
||||
return false;
|
||||
}
|
||||
if(qssb_enable_policy(policy) != 0)
|
||||
{
|
||||
Logger::error() << "Sandbox: Activation of seccomp blacklist failed!";
|
||||
|
Submodule submodules/qssb.h updated: 0d7c5bd6d4...d847d0f996
@ -6,16 +6,15 @@
|
||||
<title>{qswiki:var:title}</title>
|
||||
<body>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
||||
</ul>
|
||||
<ul id="nav">
|
||||
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
||||
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
||||
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
||||
</ul>
|
||||
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
||||
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
||||
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
||||
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
||||
<li id="searchlink"><a href="{qswiki:config:linksearch}">Search</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id="right" class="search">
|
||||
<li><div><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form></div></li>
|
||||
<ul id="right" class="search">
|
||||
<li><div id="searchbar"><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form></div></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -6,20 +6,15 @@
|
||||
<title>{qswiki:var:title}</title>
|
||||
<body>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
||||
</ul>
|
||||
<ul id="nav">
|
||||
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
||||
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
||||
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
||||
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li id="searchlink"><a href="{qswiki:config:linksearch}">Search</a></li>
|
||||
{qswiki:var:headerlinks}
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
<ul id="right" class="search">
|
||||
<li><div><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" value="search here" onfocus="this.value=''" name="q"/></form></div></li>
|
||||
<li><div id="searchbar"><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" value="search here" onfocus="this.value=''" name="q"/></form></div></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
|
7
template/quitesimple/searchform
Parasts fails
7
template/quitesimple/searchform
Parasts fails
@ -0,0 +1,7 @@
|
||||
{qswiki:include:general_header}
|
||||
<main id="content">
|
||||
<h2>Search</h2><br>
|
||||
Search content of pages:
|
||||
<form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form>
|
||||
</main>
|
||||
{qswiki:include:general_footer}
|
@ -23,7 +23,7 @@ h1, h2, h3
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
nav
|
||||
@ -37,6 +37,7 @@ nav
|
||||
grid-area: nav;
|
||||
|
||||
}
|
||||
|
||||
nav ul
|
||||
{
|
||||
background-color: #062463;
|
||||
@ -47,16 +48,12 @@ nav ul
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
|
||||
}
|
||||
|
||||
nav li
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
nav a, nav a:visited
|
||||
@ -68,7 +65,6 @@ nav a, nav a:visited
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 100%;
|
||||
|
||||
}
|
||||
|
||||
nav a:hover, nav a:focus
|
||||
@ -81,8 +77,6 @@ nav a:hover, nav a:focus
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
|
||||
a, a:visited
|
||||
{
|
||||
color: #062463;;
|
||||
@ -92,40 +86,36 @@ a:hover
|
||||
{
|
||||
background-color: #062463;
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
#content
|
||||
{
|
||||
padding: 15px;
|
||||
font-family: monospace;
|
||||
font-size: 14pt;
|
||||
flex: 1;
|
||||
grid-area: main
|
||||
padding: 15px;
|
||||
font-family: monospace;
|
||||
font-size: 14pt;
|
||||
flex: 1;
|
||||
grid-area: main
|
||||
}
|
||||
|
||||
#sidebar
|
||||
{
|
||||
grid-area: side;
|
||||
|
||||
grid-area: side;
|
||||
}
|
||||
|
||||
#sidebar ul
|
||||
{
|
||||
list-style-type: none;
|
||||
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#sidebar a, a:visited
|
||||
{
|
||||
color: #062463;
|
||||
|
||||
}
|
||||
|
||||
#sidebar a:hover
|
||||
{
|
||||
background-color: #062463;
|
||||
color: white;
|
||||
background-color: #062463;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#content a, a:visited
|
||||
@ -135,11 +125,10 @@ list-style-type: none;
|
||||
|
||||
#content a:hover
|
||||
{
|
||||
background-color: #062463;
|
||||
color: white;
|
||||
|
||||
|
||||
background-color: #062463;
|
||||
color: white;
|
||||
}
|
||||
|
||||
footer
|
||||
{
|
||||
width: 100%;
|
||||
@ -160,6 +149,7 @@ footer ul
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
footer li
|
||||
{
|
||||
margin: 0;
|
||||
@ -168,14 +158,12 @@ footer li
|
||||
line-height: 45px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
//flex: 1 1 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer a, a:visited
|
||||
{
|
||||
text-decoration: none;
|
||||
|
||||
color: white;
|
||||
display: inline-block;
|
||||
}
|
||||
@ -190,7 +178,7 @@ footer a:hover, ul#nav a:focus
|
||||
|
||||
#cats
|
||||
{
|
||||
background-color: #062463;
|
||||
background-color: #062463;
|
||||
}
|
||||
|
||||
.letter_search_result
|
||||
@ -198,20 +186,27 @@ background-color: #062463;
|
||||
text-decoration: underline;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ol
|
||||
{
|
||||
counter-reset: item;
|
||||
}
|
||||
|
||||
.indexlink
|
||||
{
|
||||
display: block;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.notexists
|
||||
{
|
||||
color: red !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#searchlink
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media screen and (orientation: portrait)
|
||||
{
|
||||
@ -219,13 +214,23 @@ display: block;
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#footer li:nth-child(-n+2)
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#footer li:nth-of-type(3)
|
||||
{
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#searchlink {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#searchbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user