Date: Sun, 30 Dec 2012 01:32:16 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r244849 - projects/mtree/tools/build Message-ID: <201212300132.qBU1WGj1091445@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Sun Dec 30 01:32:15 2012 New Revision: 244849 URL: http://svnweb.freebsd.org/changeset/base/244849 Log: Make the gid_from_group and uid_from_user stubs actually work so install works as expected. We may yet want to implement user and group cache support so -N works and we can eliminate the need to bootstrap new user entries in passwd and groups. Modified: projects/mtree/tools/build/pwcache-stub.c Modified: projects/mtree/tools/build/pwcache-stub.c ============================================================================== --- projects/mtree/tools/build/pwcache-stub.c Sun Dec 30 00:58:37 2012 (r244848) +++ projects/mtree/tools/build/pwcache-stub.c Sun Dec 30 01:32:15 2012 (r244849) @@ -29,13 +29,13 @@ */ #include <sys/cdefs.h> +#include <sys/param.h> + +#include <grp.h> #include <pwd.h> __FBSDID("$FreeBSD$"); -struct group; -struct passwd; - int pwcache_groupdb( int (*a_setgroupent)(int) __unused, @@ -59,15 +59,23 @@ pwcache_userdb( } int -gid_from_group(const char *group __unused, gid_t *gid __unused) +gid_from_group(const char *group, gid_t *gid) { - - return (-1); + struct group *grp; + + if ((grp = getgrnam(group)) == NULL) + return (-1); + *gid = grp->gr_gid; + return (0); } int -uid_from_user(const char *user __unused, uid_t *uid __unused) +uid_from_user(const char *user, uid_t *uid) { + struct passwd *pwd; - return(-1); + if ((pwd = getpwnam(user)) == NULL) + return(-1); + *uid = pwd->pw_uid; + return(0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212300132.qBU1WGj1091445>