svn commit: r244849 - projects/mtree/tools/build
Brooks Davis
brooks at FreeBSD.org
Sun Dec 30 01:32:16 UTC 2012
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);
}
More information about the svn-src-projects
mailing list