Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2012 12:44:22 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241731 - in head: contrib/libc-pwcache include lib/libc/gen
Message-ID:  <201210191244.q9JCiMMl091879@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Fri Oct 19 12:44:22 2012
New Revision: 241731
URL: http://svn.freebsd.org/changeset/base/241731

Log:
  Replace our version of the pwcache(3) API with NetBSD's implementation.
  
  This adds two features:
   * uid_from_user() and gid_from_group() as the reverse of user_from_uid()
     and groups_from_gid().
   * pwcache_userdb() and pwcache_groupdb() which allow alternative lookup
     functions to be used.  For example lookups from passwd and group
     databases in a non-standard location.

Added:
  head/contrib/libc-pwcache/
     - copied from r241235, vendor/NetBSD/libc-pwcache/dist/
Deleted:
  head/lib/libc/gen/pwcache.3
  head/lib/libc/gen/pwcache.c
Modified:
  head/contrib/libc-pwcache/pwcache.3   (contents, props changed)
  head/contrib/libc-pwcache/pwcache.c   (contents, props changed)
  head/contrib/libc-pwcache/pwcache.h   (contents, props changed)
  head/include/grp.h
  head/include/pwd.h
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/gen/Symbol.map

Modified: head/contrib/libc-pwcache/pwcache.3
==============================================================================
--- vendor/NetBSD/libc-pwcache/dist/pwcache.3	Fri Oct  5 20:19:28 2012	(r241235)
+++ head/contrib/libc-pwcache/pwcache.3	Fri Oct 19 12:44:22 2012	(r241731)
@@ -1,4 +1,5 @@
 .\"	$NetBSD: pwcache.3,v 1.17 2008/05/02 18:11:04 martin Exp $
+.\"	$FreeBSD$
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -55,7 +56,7 @@
 .\"
 .\"     @(#)pwcache.3	8.1 (Berkeley) 6/9/93
 .\"
-.Dd January 24, 2002
+.Dd October 19, 2012
 .Dt PWCACHE 3
 .Os
 .Sh NAME
@@ -217,4 +218,6 @@ The
 and
 .Fn pwcache_groupdb
 functions first appeared in
-.Nx 1.6 .
+.Nx 1.6
+and
+.Fx 10.0 .

Modified: head/contrib/libc-pwcache/pwcache.c
==============================================================================
--- vendor/NetBSD/libc-pwcache/dist/pwcache.c	Fri Oct  5 20:19:28 2012	(r241235)
+++ head/contrib/libc-pwcache/pwcache.c	Fri Oct 19 12:44:22 2012	(r241731)
@@ -77,6 +77,7 @@ static char sccsid[] = "@(#)cache.c	8.1 
 __RCSID("$NetBSD: pwcache.c,v 1.31 2010/03/23 20:28:59 drochner Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
+__FBSDID("$FreeBSD$");
 
 #include "namespace.h"
 
@@ -91,6 +92,8 @@ __RCSID("$NetBSD: pwcache.c,v 1.31 2010/
 #include <string.h>
 #include <unistd.h>
 
+#define	_DIAGASSERT(x)	assert((x))
+
 #if HAVE_NBTOOL_CONFIG_H
 /* XXX Now, re-apply the renaming that we undid above. */
 #define	group_from_gid	__nbcompat_group_from_gid

Modified: head/contrib/libc-pwcache/pwcache.h
==============================================================================
--- vendor/NetBSD/libc-pwcache/dist/pwcache.h	Fri Oct  5 20:19:28 2012	(r241235)
+++ head/contrib/libc-pwcache/pwcache.h	Fri Oct 19 12:44:22 2012	(r241731)
@@ -1,4 +1,5 @@
 /*	$NetBSD: pwcache.h,v 1.5 2003/11/10 08:51:51 wiz Exp $	*/
+/*	$FreeBSD$	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.

Modified: head/include/grp.h
==============================================================================
--- head/include/grp.h	Fri Oct 19 12:28:26 2012	(r241730)
+++ head/include/grp.h	Fri Oct 19 12:44:22 2012	(r241731)
@@ -69,6 +69,10 @@ struct group	*getgrgid(gid_t);
 struct group	*getgrnam(const char *);
 #if __BSD_VISIBLE
 const char	*group_from_gid(gid_t, int);
+int		 gid_from_group(const char *, gid_t *);
+int		 pwcache_groupdb(int (*)(int), void (*)(void),
+		    struct group * (*)(const char *),
+		    struct group * (*)(gid_t));
 #endif
 #if __BSD_VISIBLE || __XSI_VISIBLE
 /* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */

Modified: head/include/pwd.h
==============================================================================
--- head/include/pwd.h	Fri Oct 19 12:28:26 2012	(r241730)
+++ head/include/pwd.h	Fri Oct 19 12:44:22 2012	(r241731)
@@ -165,6 +165,10 @@ int		 getpwuid_r(uid_t, struct passwd *,
 int		 getpwent_r(struct passwd *, char *, size_t, struct passwd **);
 int		 setpassent(int);
 const char	*user_from_uid(uid_t, int);
+int		 uid_from_user(const char *, uid_t *);
+int		 pwcache_userdb(int (*)(int), void (*)(void),
+		    struct passwd * (*)(const char *),
+		    struct passwd * (*)(uid_t));
 #endif
 __END_DECLS
 

Modified: head/lib/libc/gen/Makefile.inc
==============================================================================
--- head/lib/libc/gen/Makefile.inc	Fri Oct 19 12:28:26 2012	(r241730)
+++ head/lib/libc/gen/Makefile.inc	Fri Oct 19 12:44:22 2012	(r241731)
@@ -24,7 +24,7 @@ SRCS+=  __getosreldate.c __xuname.c \
 	lockf.c lrand48.c mrand48.c nftw.c nice.c \
 	nlist.c nrand48.c opendir.c \
 	pause.c pmadvise.c popen.c posix_spawn.c \
-	psignal.c pututxline.c pw_scan.c pwcache.c \
+	psignal.c pututxline.c pw_scan.c \
 	raise.c readdir.c readpassphrase.c rewinddir.c \
 	scandir.c seed48.c seekdir.c semctl.c \
 	setdomainname.c sethostname.c setjmperr.c setmode.c \
@@ -36,6 +36,9 @@ SRCS+=  __getosreldate.c __xuname.c \
 	usleep.c utime.c utxdb.c valloc.c vis.c wait.c wait3.c waitpid.c \
 	wordexp.c
 
+.PATH: ${.CURDIR}/../../contrib/libc-pwcache
+SRCS+=	pwcache.c pwcache.h
+
 MISRCS+=modf.c
 
 CANCELPOINTS_SRCS=sem.c sem_new.c

Modified: head/lib/libc/gen/Symbol.map
==============================================================================
--- head/lib/libc/gen/Symbol.map	Fri Oct 19 12:28:26 2012	(r241730)
+++ head/lib/libc/gen/Symbol.map	Fri Oct 19 12:44:22 2012	(r241731)
@@ -387,6 +387,10 @@ FBSD_1.3 {
 	 fdlopen;
 	__FreeBSD_libc_enter_restricted_mode;
 	getcontextx;
+	gid_from_group;
+	pwcache_userdb;
+	pwcache_groupdb;
+	uid_from_user;
 };
 
 FBSDprivate_1.0 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210191244.q9JCiMMl091879>