Module Name:    src
Committed By:   tron
Date:           Wed Nov 11 21:53:46 UTC 2009

Modified Files:
        src/tools/compat: compat_defs.h

Log Message:
Revert most of revision 1.73:
We cannot user_from_uid(3) or group_from_gid(3) unless the system
also supports pwcache_userdb(3) and pwcache_groupdb(3). The build will
use the hosts password and user database otherwise. Switch back to the
old behaviour to only the native functions if they are all present.
This fixes cross builds under Mac OS X and FreeBSD.

Fix based on problem analysis provided by Akihiko Hayashi.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/tools/compat/compat_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.74 src/tools/compat/compat_defs.h:1.75
--- src/tools/compat/compat_defs.h:1.74	Fri Nov  6 18:26:06 2009
+++ src/tools/compat/compat_defs.h	Wed Nov 11 21:53:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.74 2009/11/06 18:26:06 joerg Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.75 2009/11/11 21:53:46 tron Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -345,34 +345,15 @@
  * XXX host system has all of these functions, all of their interfaces
  * XXX and interactions are exactly the same as in our libc/libutil -- ugh.
  */
-#if !HAVE_USER_FROM_UID
-# define user_from_uid __nbcompat_user_from_uid
-# undef HAVE_DECL_USER_FROM_UID
-#endif
-
-#if !HAVE_UID_FROM_USER
-# define uid_from_user __nbcompat_uid_from_user
-# undef HAVE_DECL_UID_FROM_USER
-#endif
-
-#if !HAVE_PWCACHE_USERDB
-# define pwcache_userdb __nbcompat_pwcache_userdb
-# undef HAVE_DECL_PWCACHE_USERDB
-#endif
-
-#if !HAVE_GROUP_FROM_GID
-# define group_from_gid __nbcompat_group_from_gid
-# undef HAVE_DECL_GROUP_FROM_GID
-#endif
-
-#if !HAVE_GID_FROM_GROUP
-# define gid_from_group __nbcompat_gid_from_group
-# undef HAVE_DECL_GID_FROM_GROUP
-#endif
-
-#if !HAVE_PWCACHE_GROUDB
-# define pwcache_groupdb __nbcompat_pwcache_groupdb
-# undef HAVE_DECL_PWCACHE_GROUPDB
+#if !HAVE_USER_FROM_UID || !HAVE_UID_FROM_USER || !HAVE_GROUP_FROM_GID || \
+    !HAVE_GID_FROM_GROUP || !HAVE_PWCACHE_USERDB || !HAVE_PWCACHE_GROUDB
+/* Make them use our version */
+#  define user_from_uid __nbcompat_user_from_uid
+#  define uid_from_user __nbcompat_uid_from_user
+#  define pwcache_userdb __nbcompat_pwcache_userdb
+#  define group_from_gid __nbcompat_group_from_gid
+#  define gid_from_group __nbcompat_gid_from_group
+#  define pwcache_groupdb __nbcompat_pwcache_groupdb
 #endif
 
 #if !HAVE_DECL_UID_FROM_USER
@@ -385,7 +366,7 @@
 
 #if !HAVE_DECL_PWCACHE_USERDB
 int pwcache_userdb(int (*)(int), void (*)(void),
-    struct passwd * (*)(const char *), struct passwd * (*)(uid_t));
+                struct passwd * (*)(const char *), struct passwd * (*)(uid_t));
 #endif
 
 #if !HAVE_DECL_GID_FROM_GROUP

Reply via email to