1dfb98e35SAlex Richardson /*- 2dfb98e35SAlex Richardson * SPDX-License-Identifier: BSD-2-Clause 3dfb98e35SAlex Richardson * 4dfb98e35SAlex Richardson * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org> 5dfb98e35SAlex Richardson * 6dfb98e35SAlex Richardson * This software was developed by SRI International and the University of 7dfb98e35SAlex Richardson * Cambridge Computer Laboratory (Department of Computer Science and 8dfb98e35SAlex Richardson * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the 9dfb98e35SAlex Richardson * DARPA SSITH research programme. 10dfb98e35SAlex Richardson * 11dfb98e35SAlex Richardson * This software was developed by SRI International and the University of 12dfb98e35SAlex Richardson * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 13dfb98e35SAlex Richardson * ("CTSRD"), as part of the DARPA CRASH research programme. 14dfb98e35SAlex Richardson * 15dfb98e35SAlex Richardson * Redistribution and use in source and binary forms, with or without 16dfb98e35SAlex Richardson * modification, are permitted provided that the following conditions 17dfb98e35SAlex Richardson * are met: 18dfb98e35SAlex Richardson * 1. Redistributions of source code must retain the above copyright 19dfb98e35SAlex Richardson * notice, this list of conditions and the following disclaimer. 20dfb98e35SAlex Richardson * 2. Redistributions in binary form must reproduce the above copyright 21dfb98e35SAlex Richardson * notice, this list of conditions and the following disclaimer in the 22dfb98e35SAlex Richardson * documentation and/or other materials provided with the distribution. 23dfb98e35SAlex Richardson * 24dfb98e35SAlex Richardson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 25dfb98e35SAlex Richardson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26dfb98e35SAlex Richardson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27dfb98e35SAlex Richardson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 28dfb98e35SAlex Richardson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29dfb98e35SAlex Richardson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30dfb98e35SAlex Richardson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31dfb98e35SAlex Richardson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32dfb98e35SAlex Richardson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33dfb98e35SAlex Richardson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34dfb98e35SAlex Richardson * SUCH DAMAGE. 35dfb98e35SAlex Richardson */ 36dfb98e35SAlex Richardson 37dfb98e35SAlex Richardson /* 38dfb98e35SAlex Richardson * When building pwd_mkdb we need to use target systems definition of 39dfb98e35SAlex Richardson * struct passwd. This protects against future changes to struct passwd and 40dfb98e35SAlex Richardson * is essential to allow cross-building from Linux/macOS hosts since the 41dfb98e35SAlex Richardson * structure is not compatible there. 42dfb98e35SAlex Richardson */ 43dfb98e35SAlex Richardson #include <stdint.h> 44dfb98e35SAlex Richardson #include <stddef.h> 45dfb98e35SAlex Richardson /* 46dfb98e35SAlex Richardson * Note: pwd_mkdb always stores uint32_t for all integer fields (including 47dfb98e35SAlex Richardson * time_t!) so these definitions do not need to match sys/sys/_types.h 48dfb98e35SAlex Richardson */ 49dfb98e35SAlex Richardson typedef uint32_t _bootstrap_gid_t; 50dfb98e35SAlex Richardson typedef uint32_t _bootstrap_uid_t; 51dfb98e35SAlex Richardson typedef uint64_t _bootstrap_time_t; 52dfb98e35SAlex Richardson #define _GID_T_DECLARED 53dfb98e35SAlex Richardson #define _TIME_T_DECLARED 54dfb98e35SAlex Richardson #define _UID_T_DECLARED 55dfb98e35SAlex Richardson #define _SIZE_T_DECLARED 56dfb98e35SAlex Richardson 57dfb98e35SAlex Richardson #define gid_t _bootstrap_gid_t 58dfb98e35SAlex Richardson #define uid_t _bootstrap_uid_t 59dfb98e35SAlex Richardson #define time_t _bootstrap_time_t 60dfb98e35SAlex Richardson #define passwd _bootstrap_passwd 61*b05fc77aSAlex Richardson #include "../../../include/pwd.h" 62dfb98e35SAlex Richardson #undef gid_t 63dfb98e35SAlex Richardson #undef uid_t 64dfb98e35SAlex Richardson #undef time_t 65