15e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao#pragma once
25e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao
3b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea/*
45e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao * Copyright (C) 2017 The Android Open Source Project
5b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * All rights reserved.
6b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *
7b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * Redistribution and use in source and binary forms, with or without
8b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * modification, are permitted provided that the following conditions
9b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * are met:
10b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *  * Redistributions of source code must retain the above copyright
11b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *    notice, this list of conditions and the following disclaimer.
12b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *  * Redistributions in binary form must reproduce the above copyright
13b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *    notice, this list of conditions and the following disclaimer in
14b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *    the documentation and/or other materials provided with the
15b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *    distribution.
16b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea *
17b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea * SUCH DAMAGE.
29b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea */
30b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea
315e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao#include <grp.h>
325e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao#include <pwd.h>
336170693e28dd72a1517c267f3f62b3f37477b8bbElliott Hughes
345e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gaostruct group_state_t {
355e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  group group_;
365e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  char* group_members_[2];
375e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  char group_name_buffer_[32];
385e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  // Must be last so init_group_state can run a simple memset for the above
395e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  ssize_t getgrent_idx;
406170693e28dd72a1517c267f3f62b3f37477b8bbElliott Hughes};
41b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea
425e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gaostruct passwd_state_t {
435e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  passwd passwd_;
445e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  char name_buffer_[32];
455e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  char dir_buffer_[32];
465e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  char sh_buffer_[32];
475e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao  ssize_t getpwent_idx;
485e2285d3ccdbb64a49ad2e5e521f50c897a3954dJosh Gao};
49