Support OpenBSD 6.0 pledge() syscall for sandboxing.

This commit is contained in:
John Hood
2016-09-18 01:32:24 -04:00
parent 5619dd47bb
commit 1077db41b6
3 changed files with 21 additions and 0 deletions
+10
View File
@@ -32,6 +32,7 @@
#include "config.h"
#include <err.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
@@ -407,6 +408,15 @@ bool STMClient::main( void )
/* initialize signal handling and structures */
main_init();
/* Drop unnecessary privileges */
#ifdef HAVE_PLEDGE
/* OpenBSD pledge() syscall */
if ( pledge( "stdio inet ioctl tty", NULL )) {
perror( "pledge() failed" );
exit( 1 );
}
#endif
/* prepare to poll for events */
Select &sel = Select::get_instance();