summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2017-08-25 13:25:01 +1000
committerDamien Miller <djm@mindrot.org>2017-08-25 13:25:01 +1000
commit878e029797cfc9754771d6f6ea17f8c89e11d225 (patch)
tree4531486041197612181ea62f3a33cf9f7c342558
parent07949bfe9133234eddd01715592aa0dde67745f0 (diff)
Split platform_sys_dir_uid into its own file
platform.o is too heavy for libssh.a use; it calls into the server on many platforms. Move just the function needed by misc.c into its own file.
-rw-r--r--Makefile.in4
-rw-r--r--platform-misc.c35
-rw-r--r--platform.c16
3 files changed, 37 insertions, 18 deletions
diff --git a/Makefile.in b/Makefile.in
index 632975b1a..c52ce191f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -92,13 +92,13 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
92 kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \ 92 kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
93 kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \ 93 kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \
94 kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \ 94 kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \
95 platform-pledge.o platform-tracing.o platform.o 95 platform-pledge.o platform-tracing.o platform-misc.o
96 96
97SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ 97SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
98 sshconnect.o sshconnect2.o mux.o 98 sshconnect.o sshconnect2.o mux.o
99 99
100SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \ 100SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \
101 audit.o audit-bsm.o audit-linux.o \ 101 audit.o audit-bsm.o audit-linux.o platform.o \
102 sshpty.o sshlogin.o servconf.o serverloop.o \ 102 sshpty.o sshlogin.o servconf.o serverloop.o \
103 auth.o auth2.o auth-options.o session.o \ 103 auth.o auth2.o auth-options.o session.o \
104 auth2-chall.o groupaccess.o \ 104 auth2-chall.o groupaccess.o \
diff --git a/platform-misc.c b/platform-misc.c
new file mode 100644
index 000000000..3f3967049
--- /dev/null
+++ b/platform-misc.c
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2006 Darren Tucker. All rights reserved.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "includes.h"
18
19#include "openbsd-compat/openbsd-compat.h"
20
21/*
22 * return 1 if the specified uid is a uid that may own a system directory
23 * otherwise 0.
24 */
25int
26platform_sys_dir_uid(uid_t uid)
27{
28 if (uid == 0)
29 return 1;
30#ifdef PLATFORM_SYS_DIR_UID
31 if (uid == PLATFORM_SYS_DIR_UID)
32 return 1;
33#endif
34 return 0;
35}
diff --git a/platform.c b/platform.c
index 973a63e40..18c7751de 100644
--- a/platform.c
+++ b/platform.c
@@ -197,19 +197,3 @@ platform_krb5_get_principal_name(const char *pw_name)
197 return NULL; 197 return NULL;
198#endif 198#endif
199} 199}
200
201/*
202 * return 1 if the specified uid is a uid that may own a system directory
203 * otherwise 0.
204 */
205int
206platform_sys_dir_uid(uid_t uid)
207{
208 if (uid == 0)
209 return 1;
210#ifdef PLATFORM_SYS_DIR_UID
211 if (uid == PLATFORM_SYS_DIR_UID)
212 return 1;
213#endif
214 return 0;
215}