From b41dca52762c5188638236ae81b9f4597bb29ac9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 9 Nov 2022 11:14:12 -0500 Subject: pwcache: Fill the user/group caches lazily Iterating all the users/groups can be expensive, especially with NSS. Android has so many that it doesn't even return them all from get{pw,gr}ent() for performance reasons, leading to incorrect behaviour of -user/-group/etc. --- src/ctx.h | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'src/ctx.h') diff --git a/src/ctx.h b/src/ctx.h index 6c4ef33..d32db59 100644 --- a/src/ctx.h +++ b/src/ctx.h @@ -106,10 +106,8 @@ struct bfs_ctx { /** Colored stderr. */ struct CFILE *cerr; - /** User table. */ + /** User cache. */ struct bfs_users *users; - /** The error that occurred parsing the user table, if any. */ - int users_error; /** Group table. */ struct bfs_groups *groups; /** The error that occurred parsing the group table, if any. */ @@ -137,26 +135,6 @@ struct bfs_ctx { */ struct bfs_ctx *bfs_ctx_new(void); -/** - * Get the users table. - * - * @param ctx - * The bfs context. - * @return - * The cached users table, or NULL on failure. - */ -const struct bfs_users *bfs_ctx_users(const struct bfs_ctx *ctx); - -/** - * Get the groups table. - * - * @param ctx - * The bfs context. - * @return - * The cached groups table, or NULL on failure. - */ -const struct bfs_groups *bfs_ctx_groups(const struct bfs_ctx *ctx); - /** * Get the mount table. * -- cgit v1.2.3