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