Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually add the pledge files...
- Loading branch information
kristaps
committed
Nov 12, 2015
1 parent
0d48355
commit a0a8666
Showing
5 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* $Id$ */ | ||
/* | ||
* Copyright (c) 2015 Kristaps Dzonsons <kristaps@bsd.lv> | ||
* | ||
* Permission to use, copy, modify, and distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*/ | ||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#ifdef HAVE_PLEDGE | ||
|
||
#include <unistd.h> | ||
|
||
#include <stdarg.h> | ||
|
||
#include "kcgi.h" | ||
#include "extern.h" | ||
|
||
int | ||
ksandbox_pledge_init_child(void *arg, enum sandtype type) | ||
{ | ||
const char *fl; | ||
|
||
fl = "stdio"; | ||
if (SAND_CONTROL == type) | ||
fl = "stdio unix sendfd recvfd"; | ||
|
||
if (-1 == pledge(fl, NULL)) { | ||
XWARN("pledge: %s", | ||
SAND_CONTROL == type ? | ||
"control" : "worker"); | ||
return(0); | ||
} | ||
return(1); | ||
} | ||
|
||
#else | ||
int dummy; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <unistd.h> | ||
|
||
#include <stdio.h> | ||
|
||
int | ||
main(void) | ||
{ | ||
if (-1 == pledge("stdio", NULL)) { | ||
perror("pledge"); | ||
return(1); | ||
} | ||
return(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<article data-sblg-article="1" data-sblg-tags="version"> | ||
<header> | ||
<h1>0.7.4</h1> | ||
<address>Kristaps Dzonsons</address> | ||
<time datetime="2015-11-12">2015-11-12</time> | ||
</header> | ||
<aside> | ||
<div> | ||
Replace support for tame(2) (which was never enabled in the operating system) with the renamed <a | ||
href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/pledge.2">pledge(2)</a>. | ||
From a patch by James Turner—thank you! | ||
</div> | ||
</aside> | ||
</article> |