xref: /dflybsd-src/crypto/openssh/platform-misc.c (revision ce74baca94b6dd2a80af6a625aba2cf14ab7fec8)
1ce74bacaSMatthew Dillon /*
2ce74bacaSMatthew Dillon  * Copyright (c) 2006 Darren Tucker.  All rights reserved.
3ce74bacaSMatthew Dillon  *
4ce74bacaSMatthew Dillon  * Permission to use, copy, modify, and distribute this software for any
5ce74bacaSMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
6ce74bacaSMatthew Dillon  * copyright notice and this permission notice appear in all copies.
7ce74bacaSMatthew Dillon  *
8ce74bacaSMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9ce74bacaSMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10ce74bacaSMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11ce74bacaSMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12ce74bacaSMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13ce74bacaSMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14ce74bacaSMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15ce74bacaSMatthew Dillon  */
16ce74bacaSMatthew Dillon 
17ce74bacaSMatthew Dillon #include "includes.h"
18ce74bacaSMatthew Dillon 
19ce74bacaSMatthew Dillon #include "openbsd-compat/openbsd-compat.h"
20ce74bacaSMatthew Dillon 
21ce74bacaSMatthew Dillon /*
22ce74bacaSMatthew Dillon  * return 1 if the specified uid is a uid that may own a system directory
23ce74bacaSMatthew Dillon  * otherwise 0.
24ce74bacaSMatthew Dillon  */
25ce74bacaSMatthew Dillon int
platform_sys_dir_uid(uid_t uid)26ce74bacaSMatthew Dillon platform_sys_dir_uid(uid_t uid)
27ce74bacaSMatthew Dillon {
28ce74bacaSMatthew Dillon 	if (uid == 0)
29ce74bacaSMatthew Dillon 		return 1;
30ce74bacaSMatthew Dillon #ifdef PLATFORM_SYS_DIR_UID
31ce74bacaSMatthew Dillon 	if (uid == PLATFORM_SYS_DIR_UID)
32ce74bacaSMatthew Dillon 		return 1;
33ce74bacaSMatthew Dillon #endif
34ce74bacaSMatthew Dillon 	return 0;
35ce74bacaSMatthew Dillon }
36