mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-25 08:09:24 +01:00
__OpenBSD__ around pledge().
This commit is contained in:
parent
487285b325
commit
6c3ade76df
4
client.c
4
client.c
@ -276,6 +276,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags)
|
|||||||
if ((ttynam = ttyname(STDIN_FILENO)) == NULL)
|
if ((ttynam = ttyname(STDIN_FILENO)) == NULL)
|
||||||
ttynam = "";
|
ttynam = "";
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
/*
|
/*
|
||||||
* Drop privileges for client. "proc exec" is needed for -c and for
|
* Drop privileges for client. "proc exec" is needed for -c and for
|
||||||
* locking (which uses system(3)).
|
* locking (which uses system(3)).
|
||||||
@ -287,6 +288,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags)
|
|||||||
*/
|
*/
|
||||||
if (pledge("stdio unix sendfd proc exec tty", NULL) != 0)
|
if (pledge("stdio unix sendfd proc exec tty", NULL) != 0)
|
||||||
fatal("pledge failed");
|
fatal("pledge failed");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Free stuff that is not used in the client. */
|
/* Free stuff that is not used in the client. */
|
||||||
options_free(&global_options);
|
options_free(&global_options);
|
||||||
@ -605,6 +607,7 @@ client_dispatch_wait(void)
|
|||||||
struct msg_stdout_data stdoutdata;
|
struct msg_stdout_data stdoutdata;
|
||||||
struct msg_stderr_data stderrdata;
|
struct msg_stderr_data stderrdata;
|
||||||
int retval;
|
int retval;
|
||||||
|
#ifdef __OpenBSD__
|
||||||
static int pledge_applied;
|
static int pledge_applied;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -618,6 +621,7 @@ client_dispatch_wait(void)
|
|||||||
fatal("pledge failed");
|
fatal("pledge failed");
|
||||||
pledge_applied = 1;
|
pledge_applied = 1;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ((n = imsg_get(&client_ibuf, &imsg)) == -1)
|
if ((n = imsg_get(&client_ibuf, &imsg)) == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user