kernel - CAM cleanup 3/N - Remove unnecessary mplocks
[dragonfly.git] / crypto / openssh / platform-pledge.c
blob4a6ec15e1b2d68fd042f9563a91280b66e9cb7c3
1 /*
2 * Copyright (c) 2015 Joyent, Inc
3 * Author: Alex Wilson <alex.wilson@joyent.com>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include "includes.h"
20 #include <sys/types.h>
22 #include <stdarg.h>
23 #include <unistd.h>
25 #include "platform.h"
27 #include "openbsd-compat/openbsd-compat.h"
30 * Drop any fine-grained privileges that are not needed for post-startup
31 * operation of ssh-agent
33 * Should be as close as possible to pledge("stdio cpath unix id proc exec", ...)
35 void
36 platform_pledge_agent(void)
38 #ifdef USE_SOLARIS_PRIVS
40 * Note: Solaris priv dropping is closer to tame() than pledge(), but
41 * we will use what we have.
43 solaris_drop_privs_root_pinfo_net();
44 #endif
48 * Drop any fine-grained privileges that are not needed for post-startup
49 * operation of sftp-server
51 void
52 platform_pledge_sftp_server(void)
54 #ifdef USE_SOLARIS_PRIVS
55 solaris_drop_privs_pinfo_net_fork_exec();
56 #endif
60 * Drop any fine-grained privileges that are not needed for the post-startup
61 * operation of the SSH client mux
63 * Should be as close as possible to pledge("stdio proc tty", ...)
65 void
66 platform_pledge_mux(void)
68 #ifdef USE_SOLARIS_PRIVS
69 solaris_drop_privs_root_pinfo_net_exec();
70 #endif