blob: 696df26b63d49c3bdf3dc488dee8f584fd42853d [file] [log] [blame]
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -07001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* This file is used to define the properties of the filesystem
18** images generated by build tools (mkbootfs and mkyaffs2image) and
19** by the device side of adb.
20*/
21
Mark Salyzyn68651142015-04-01 09:24:22 -070022#define LOG_TAG "fs_config"
Mark Salyzyn4e5f71a2015-04-01 09:24:22 -070023
Mark Salyzyn68651142015-04-01 09:24:22 -070024#define _GNU_SOURCE
25
26#include <errno.h>
27#include <fcntl.h>
28#include <stdbool.h>
29#include <stdint.h>
30#include <stdio.h>
31#include <stdlib.h>
32#include <string.h>
Mark Salyzyn68651142015-04-01 09:24:22 -070033#include <sys/stat.h>
34#include <sys/types.h>
35
Mark Salyzyn30f991f2017-01-10 13:19:54 -080036#include <log/log.h>
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -070037#include <private/android_filesystem_config.h>
Mark Salyzynfd5b4252015-04-16 08:13:32 -070038#include <utils/Compat.h>
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -070039
Mark Salyzyn4232b372015-04-16 08:40:55 -070040#ifndef O_BINARY
41#define O_BINARY 0
42#endif
43
Mark Salyzyn68651142015-04-01 09:24:22 -070044/* The following structure is stored little endian */
45struct fs_path_config_from_file {
46 uint16_t len;
47 uint16_t mode;
48 uint16_t uid;
49 uint16_t gid;
50 uint64_t capabilities;
51 char prefix[];
52} __attribute__((__aligned__(sizeof(uint64_t))));
53
54/* My kingdom for <endian.h> */
Mark Salyzyn166e24c2017-03-20 08:15:40 -070055static inline uint16_t get2LE(const uint8_t* src) { return src[0] | (src[1] << 8); }
Mark Salyzyn68651142015-04-01 09:24:22 -070056
Mark Salyzyn166e24c2017-03-20 08:15:40 -070057static inline uint64_t get8LE(const uint8_t* src) {
Mark Salyzyn68651142015-04-01 09:24:22 -070058 uint32_t low, high;
59
60 low = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
61 high = src[4] | (src[5] << 8) | (src[6] << 16) | (src[7] << 24);
Mark Salyzyn166e24c2017-03-20 08:15:40 -070062 return ((uint64_t)high << 32) | (uint64_t)low;
Mark Salyzyn68651142015-04-01 09:24:22 -070063}
64
Mark Salyzyn166e24c2017-03-20 08:15:40 -070065#define ALIGN(x, alignment) (((x) + ((alignment)-1)) & ~((alignment)-1))
Mark Salyzyn5d9e5ef2015-04-01 11:02:00 -070066
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -070067/* Rules for directories.
68** These rules are applied based on "first match", so they
69** should start with the most specific path and work their
70** way up to the root.
71*/
72
73static const struct fs_path_config android_dirs[] = {
Mark Salyzyn166e24c2017-03-20 08:15:40 -070074 /* clang-format off */
Mark Salyzync4f9f4c2017-03-20 08:15:40 -070075 { 00770, AID_SYSTEM, AID_CACHE, 0, "cache" },
76 { 00500, AID_ROOT, AID_ROOT, 0, "config" },
77 { 00771, AID_SYSTEM, AID_SYSTEM, 0, "data/app" },
78 { 00771, AID_SYSTEM, AID_SYSTEM, 0, "data/app-private" },
79 { 00771, AID_SYSTEM, AID_SYSTEM, 0, "data/app-ephemeral" },
80 { 00771, AID_ROOT, AID_ROOT, 0, "data/dalvik-cache" },
81 { 00771, AID_SYSTEM, AID_SYSTEM, 0, "data/data" },
82 { 00771, AID_SHELL, AID_SHELL, 0, "data/local/tmp" },
83 { 00771, AID_SHELL, AID_SHELL, 0, "data/local" },
84 { 00770, AID_DHCP, AID_DHCP, 0, "data/misc/dhcp" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -070085 { 00771, AID_SHARED_RELRO, AID_SHARED_RELRO, 0, "data/misc/shared_relro" },
Mark Salyzync4f9f4c2017-03-20 08:15:40 -070086 { 01771, AID_SYSTEM, AID_MISC, 0, "data/misc" },
87 { 00775, AID_MEDIA_RW, AID_MEDIA_RW, 0, "data/media/Music" },
88 { 00775, AID_MEDIA_RW, AID_MEDIA_RW, 0, "data/media" },
89 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest" },
90 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest64" },
91 { 00775, AID_ROOT, AID_ROOT, 0, "data/preloads" },
92 { 00771, AID_SYSTEM, AID_SYSTEM, 0, "data" },
93 { 00755, AID_ROOT, AID_SYSTEM, 0, "mnt" },
94 { 00755, AID_ROOT, AID_ROOT, 0, "root" },
95 { 00750, AID_ROOT, AID_SHELL, 0, "sbin" },
96 { 00777, AID_ROOT, AID_ROOT, 0, "sdcard" },
97 { 00751, AID_ROOT, AID_SDCARD_R, 0, "storage" },
98 { 00755, AID_ROOT, AID_SHELL, 0, "system/bin" },
99 { 00755, AID_ROOT, AID_ROOT, 0, "system/etc/ppp" },
100 { 00755, AID_ROOT, AID_SHELL, 0, "system/vendor" },
101 { 00755, AID_ROOT, AID_SHELL, 0, "system/xbin" },
102 { 00755, AID_ROOT, AID_SHELL, 0, "vendor" },
103 { 00755, AID_ROOT, AID_ROOT, 0, 0 },
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700104 /* clang-format on */
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700105};
106
107/* Rules for files.
108** These rules are applied based on "first match", so they
109** should start with the most specific path and work their
110** way up to the root. Prefixes ending in * denotes wildcard
111** and will allow partial matches.
112*/
Mark Salyzyn68651142015-04-01 09:24:22 -0700113static const char conf_dir[] = "/system/etc/fs_config_dirs";
114static const char conf_file[] = "/system/etc/fs_config_files";
115
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700116static const struct fs_path_config android_files[] = {
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700117 /* clang-format off */
Mark Salyzyna45eae92017-03-20 08:53:24 -0700118 { 00644, AID_SYSTEM, AID_SYSTEM, 0, "data/app/*" },
119 { 00644, AID_SYSTEM, AID_SYSTEM, 0, "data/app-ephemeral/*" },
120 { 00644, AID_SYSTEM, AID_SYSTEM, 0, "data/app-private/*" },
121 { 00644, AID_APP, AID_APP, 0, "data/data/*" },
122 { 00644, AID_MEDIA_RW, AID_MEDIA_RW, 0, "data/media/*" },
123 { 00640, AID_ROOT, AID_SHELL, 0, "data/nativetest/tests.txt" },
124 { 00640, AID_ROOT, AID_SHELL, 0, "data/nativetest64/tests.txt" },
125 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest/*" },
126 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest64/*" },
127 { 00600, AID_ROOT, AID_ROOT, 0, "default.prop" },
128 { 00600, AID_ROOT, AID_ROOT, 0, "odm/build.prop" },
129 { 00600, AID_ROOT, AID_ROOT, 0, "odm/default.prop" },
130 { 00750, AID_ROOT, AID_SHELL, 0, "sbin/fs_mgr" },
131 { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/crash_dump32" },
132 { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/crash_dump64" },
133 { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/debuggerd" },
134 { 00750, AID_ROOT, AID_ROOT, 0, "system/bin/install-recovery.sh" },
135 { 00700, AID_ROOT, AID_ROOT, 0, "system/bin/secilc" },
136 { 00750, AID_ROOT, AID_ROOT, 0, "system/bin/uncrypt" },
137 { 00600, AID_ROOT, AID_ROOT, 0, "system/build.prop" },
138 { 00444, AID_ROOT, AID_ROOT, 0, conf_dir + 1 },
139 { 00444, AID_ROOT, AID_ROOT, 0, conf_file + 1 },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700140 { 00440, AID_ROOT, AID_SHELL, 0, "system/etc/init.goldfish.rc" },
141 { 00550, AID_ROOT, AID_SHELL, 0, "system/etc/init.goldfish.sh" },
142 { 00550, AID_ROOT, AID_SHELL, 0, "system/etc/init.ril" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700143 { 00555, AID_ROOT, AID_ROOT, 0, "system/etc/ppp/*" },
144 { 00555, AID_ROOT, AID_ROOT, 0, "system/etc/rc.*" },
Tao Baoc6e93fe2015-07-18 19:46:16 -0700145 { 00440, AID_ROOT, AID_ROOT, 0, "system/etc/recovery.img" },
Mark Salyzyna45eae92017-03-20 08:53:24 -0700146 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/build.prop" },
147 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/default.prop" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700148
Nick Kralevichcbbc6612015-11-30 09:17:18 -0800149 /* the following two files are INTENTIONALLY set-uid, but they
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700150 * are NOT included on user builds. */
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700151 { 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/procmem" },
Mark Salyzyna45eae92017-03-20 08:53:24 -0700152 { 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700153
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700154 /* the following files have enhanced capabilities and ARE included
155 * in user builds. */
Mark Salyzyna45eae92017-03-20 08:53:24 -0700156 { 00700, AID_SYSTEM, AID_SHELL, CAP_MASK_LONG(CAP_BLOCK_SUSPEND),
157 "system/bin/inputflinger" },
Mark Salyzyn0d2a1dc2016-10-28 12:41:17 -0700158 { 00550, AID_LOGD, AID_LOGD, CAP_MASK_LONG(CAP_SYSLOG) |
159 CAP_MASK_LONG(CAP_AUDIT_CONTROL) |
160 CAP_MASK_LONG(CAP_SETGID),
161 "system/bin/logd" },
162 { 00750, AID_ROOT, AID_SHELL, CAP_MASK_LONG(CAP_SETUID) |
163 CAP_MASK_LONG(CAP_SETGID),
164 "system/bin/run-as" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700165
Tim Murray3a29e342016-06-17 14:02:16 -0700166 /* Support FIFO scheduling mode in SurfaceFlinger. */
Mark Salyzyna45eae92017-03-20 08:53:24 -0700167 { 00755, AID_SYSTEM, AID_GRAPHICS, CAP_MASK_LONG(CAP_SYS_NICE),
168 "system/bin/surfaceflinger" },
Tim Murray3a29e342016-06-17 14:02:16 -0700169
Christopher Wileya7608832016-07-12 14:30:21 -0700170 /* Support hostapd administering a network interface. */
Mark Salyzyn0d2a1dc2016-10-28 12:41:17 -0700171 { 00755, AID_WIFI, AID_WIFI, CAP_MASK_LONG(CAP_NET_ADMIN) |
172 CAP_MASK_LONG(CAP_NET_RAW),
173 "system/bin/hostapd" },
Christopher Wileya7608832016-07-12 14:30:21 -0700174
Mark Salyzyna45eae92017-03-20 08:53:24 -0700175 /* Support Bluetooth legacy hal accessing /sys/class/rfkill */
176 { 00700, AID_BLUETOOTH, AID_BLUETOOTH, CAP_MASK_LONG(CAP_NET_ADMIN),
177 "vendor/bin/hw/android.hardware.bluetooth@1.0-service" },
178
Mitchell Willsd44d3b52016-09-02 11:14:35 -0700179 /* Support wifi_hal_legacy administering a network interface. */
Mark Salyzyn0d2a1dc2016-10-28 12:41:17 -0700180 { 00755, AID_WIFI, AID_WIFI, CAP_MASK_LONG(CAP_NET_ADMIN) |
181 CAP_MASK_LONG(CAP_NET_RAW),
Steven Morelandb7ca9232017-02-13 17:21:17 -0800182 "vendor/bin/hw/android.hardware.wifi@1.0-service" },
Mitchell Willsd44d3b52016-09-02 11:14:35 -0700183
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700184 /* A non-privileged zygote that spawns
185 * isolated processes for web rendering. */
Robert Seseka2ceaf62016-09-21 17:01:36 -0400186 { 0750, AID_ROOT, AID_ROOT, CAP_MASK_LONG(CAP_SETUID) |
187 CAP_MASK_LONG(CAP_SETGID) |
Mark Salyzyn0d2a1dc2016-10-28 12:41:17 -0700188 CAP_MASK_LONG(CAP_SETPCAP),
189 "system/bin/webview_zygote32" },
Robert Seseka2ceaf62016-09-21 17:01:36 -0400190 { 0750, AID_ROOT, AID_ROOT, CAP_MASK_LONG(CAP_SETUID) |
191 CAP_MASK_LONG(CAP_SETGID) |
Mark Salyzyn0d2a1dc2016-10-28 12:41:17 -0700192 CAP_MASK_LONG(CAP_SETPCAP),
193 "system/bin/webview_zygote64" },
Robert Seseka2ceaf62016-09-21 17:01:36 -0400194
Mark Salyzyna45eae92017-03-20 08:53:24 -0700195 /* generic defaults */
196 { 00755, AID_ROOT, AID_ROOT, 0, "bin/*" },
197 { 00640, AID_ROOT, AID_SHELL, 0, "fstab.*" },
198 { 00750, AID_ROOT, AID_SHELL, 0, "init*" },
199 { 00750, AID_ROOT, AID_SHELL, 0, "sbin/*" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700200 { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" },
201 { 00755, AID_ROOT, AID_ROOT, 0, "system/lib/valgrind/*" },
202 { 00755, AID_ROOT, AID_ROOT, 0, "system/lib64/valgrind/*" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700203 { 00755, AID_ROOT, AID_SHELL, 0, "system/vendor/bin/*" },
Erik Klinea5a9c742016-05-27 13:13:07 +0900204 { 00755, AID_ROOT, AID_SHELL, 0, "system/vendor/xbin/*" },
Mark Salyzyna45eae92017-03-20 08:53:24 -0700205 { 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700206 { 00755, AID_ROOT, AID_SHELL, 0, "vendor/bin/*" },
Erik Klinea5a9c742016-05-27 13:13:07 +0900207 { 00755, AID_ROOT, AID_SHELL, 0, "vendor/xbin/*" },
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700208 { 00644, AID_ROOT, AID_ROOT, 0, 0 },
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700209 /* clang-format on */
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700210};
211
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700212static int fs_config_open(int dir, const char* target_out_path) {
Mark Salyzyn68651142015-04-01 09:24:22 -0700213 int fd = -1;
214
Thierry Strudeldf33ffa2015-07-09 09:50:31 -0700215 if (target_out_path && *target_out_path) {
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700216 /* target_out_path is the path to the directory holding content of
217 * system partition but as we cannot guaranty it ends with '/system'
218 * we need this below skip_len logic */
219 char* name = NULL;
Thierry Strudeldf33ffa2015-07-09 09:50:31 -0700220 int target_out_path_len = strlen(target_out_path);
221 int skip_len = strlen("/system");
222
223 if (target_out_path[target_out_path_len] == '/') {
224 skip_len++;
225 }
Elliott Hughes8b262b92015-07-24 20:02:31 -0700226 if (asprintf(&name, "%s%s", target_out_path, (dir ? conf_dir : conf_file) + skip_len) != -1) {
Mark Salyzyn4232b372015-04-16 08:40:55 -0700227 fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_BINARY));
Mark Salyzyn68651142015-04-01 09:24:22 -0700228 free(name);
229 }
230 }
231 if (fd < 0) {
Mark Salyzyn4232b372015-04-16 08:40:55 -0700232 fd = TEMP_FAILURE_RETRY(open(dir ? conf_dir : conf_file, O_RDONLY | O_BINARY));
Mark Salyzyn68651142015-04-01 09:24:22 -0700233 }
234 return fd;
235}
236
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700237static bool fs_config_cmp(bool dir, const char* prefix, size_t len, const char* path, size_t plen) {
Mark Salyzyn68651142015-04-01 09:24:22 -0700238 if (dir) {
239 if (plen < len) {
240 return false;
241 }
242 } else {
243 /* If name ends in * then allow partial matches. */
244 if (prefix[len - 1] == '*') {
245 return !strncmp(prefix, path, len - 1);
246 }
247 if (plen != len) {
248 return false;
249 }
250 }
251 return !strncmp(prefix, path, len);
252}
253
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700254void fs_config(const char* path, int dir, const char* target_out_path, unsigned* uid, unsigned* gid,
255 unsigned* mode, uint64_t* capabilities) {
256 const struct fs_path_config* pc;
257 size_t plen;
258 int fd;
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700259
260 if (path[0] == '/') {
261 path++;
262 }
263
Mark Salyzyn7e826332015-04-15 22:30:30 +0000264 plen = strlen(path);
Mark Salyzyn68651142015-04-01 09:24:22 -0700265
Thierry Strudeldf33ffa2015-07-09 09:50:31 -0700266 fd = fs_config_open(dir, target_out_path);
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700267 if (fd >= 0) {
268 struct fs_path_config_from_file header;
269
270 while (TEMP_FAILURE_RETRY(read(fd, &header, sizeof(header))) == sizeof(header)) {
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700271 char* prefix;
272 uint16_t host_len = get2LE((const uint8_t*)&header.len);
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700273 ssize_t len, remainder = host_len - sizeof(header);
Mark Salyzyn68651142015-04-01 09:24:22 -0700274 if (remainder <= 0) {
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700275 ALOGE("%s len is corrupted", dir ? conf_dir : conf_file);
Mark Salyzyn68651142015-04-01 09:24:22 -0700276 break;
277 }
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700278 prefix = calloc(1, remainder);
279 if (!prefix) {
280 ALOGE("%s out of memory", dir ? conf_dir : conf_file);
281 break;
Mark Salyzyn68651142015-04-01 09:24:22 -0700282 }
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700283 if (TEMP_FAILURE_RETRY(read(fd, prefix, remainder)) != remainder) {
284 free(prefix);
285 ALOGE("%s prefix is truncated", dir ? conf_dir : conf_file);
286 break;
287 }
288 len = strnlen(prefix, remainder);
Mark Salyzyn68651142015-04-01 09:24:22 -0700289 if (len >= remainder) { /* missing a terminating null */
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700290 free(prefix);
Mark Salyzyn68651142015-04-01 09:24:22 -0700291 ALOGE("%s is corrupted", dir ? conf_dir : conf_file);
Mark Salyzyn68651142015-04-01 09:24:22 -0700292 break;
293 }
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700294 if (fs_config_cmp(dir, prefix, len, path, plen)) {
295 free(prefix);
296 close(fd);
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700297 *uid = get2LE((const uint8_t*)&(header.uid));
298 *gid = get2LE((const uint8_t*)&(header.gid));
299 *mode = (*mode & (~07777)) | get2LE((const uint8_t*)&(header.mode));
300 *capabilities = get8LE((const uint8_t*)&(header.capabilities));
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700301 return;
Mark Salyzyn68651142015-04-01 09:24:22 -0700302 }
Mark Salyzyn7977cc62015-04-15 19:27:39 -0700303 free(prefix);
Mark Salyzyn7e826332015-04-15 22:30:30 +0000304 }
Mark Salyzyn68651142015-04-01 09:24:22 -0700305 close(fd);
Mark Salyzyn68651142015-04-01 09:24:22 -0700306 }
307
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700308 for (pc = dir ? android_dirs : android_files; pc->prefix; pc++) {
Mark Salyzyn68651142015-04-01 09:24:22 -0700309 if (fs_config_cmp(dir, pc->prefix, strlen(pc->prefix), path, plen)) {
310 break;
Mark Salyzyn8b2c7de2015-04-01 07:42:01 -0700311 }
312 }
313 *uid = pc->uid;
314 *gid = pc->gid;
315 *mode = (*mode & (~07777)) | pc->mode;
316 *capabilities = pc->capabilities;
317}
Mark Salyzyn5d9e5ef2015-04-01 11:02:00 -0700318
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700319ssize_t fs_config_generate(char* buffer, size_t length, const struct fs_path_config* pc) {
320 struct fs_path_config_from_file* p = (struct fs_path_config_from_file*)buffer;
Mark Salyzyn5d9e5ef2015-04-01 11:02:00 -0700321 size_t len = ALIGN(sizeof(*p) + strlen(pc->prefix) + 1, sizeof(uint64_t));
322
323 if ((length < len) || (len > UINT16_MAX)) {
324 return -ENOSPC;
325 }
326 memset(p, 0, len);
327 uint16_t host_len = len;
Mark Salyzyn166e24c2017-03-20 08:15:40 -0700328 p->len = get2LE((const uint8_t*)&host_len);
329 p->mode = get2LE((const uint8_t*)&(pc->mode));
330 p->uid = get2LE((const uint8_t*)&(pc->uid));
331 p->gid = get2LE((const uint8_t*)&(pc->gid));
332 p->capabilities = get8LE((const uint8_t*)&(pc->capabilities));
Mark Salyzyn5d9e5ef2015-04-01 11:02:00 -0700333 strcpy(p->prefix, pc->prefix);
334 return len;
335}