Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools/compat - Replace pwcache(3) if necessary (pwcache_user...



details:   https://anonhg.NetBSD.org/src/rev/1b3d84da9c76
branches:  trunk
changeset: 521132:1b3d84da9c76
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jan 24 04:05:27 2002 +0000

description:
- Replace pwcache(3) if necessary (pwcache_userdb(3) is checked for).
  Tested on -current and 1.5.3.
- Wrap some long lines.

diffstat:

 tools/compat/Makefile      |   9 ++--
 tools/compat/compat_defs.h |  15 ++++++++-
 tools/compat/config.h.in   |   3 +-
 tools/compat/configure     |  77 +++++++++++++++++++++++----------------------
 tools/compat/configure.ac  |   5 +-
 5 files changed, 63 insertions(+), 46 deletions(-)

diffs (truncated from 380 to 300 lines):

diff -r 31e7e8c8633b -r 1b3d84da9c76 tools/compat/Makefile
--- a/tools/compat/Makefile     Thu Jan 24 03:58:09 2002 +0000
+++ b/tools/compat/Makefile     Thu Jan 24 04:05:27 2002 +0000
@@ -1,10 +1,10 @@
-#      $NetBSD: Makefile,v 1.4 2002/01/21 23:35:14 lukem Exp $
+#      $NetBSD: Makefile,v 1.5 2002/01/24 04:05:27 lukem Exp $
 
 HOSTLIB=       nbcompat
 
 SRCS=          basename.c dirname.c err.c fgetln.c flock.c fparseln.c \
-               getmode.c pread.c pwrite.c setprogname.c strlcat.c strlcpy.c \
-               vis.c
+               getmode.c pread.c pwcache.c pwrite.c setprogname.c \
+               strlcat.c strlcpy.c vis.c
 HOST_CPPFLAGS+=        -I. -I${.CURDIR} -DHAVE_CONFIG_H
 
 .PATH:         ${.CURDIR}/../../lib/libc/gen \
@@ -12,7 +12,8 @@
                ${.CURDIR}/../../lib/libutil \
 
 DPSRCS=                config.h
-CLEANFILES=    config.cache config.log config.status config.stamp confdefs.h defs.mk
+CLEANFILES=    config.cache config.log config.status config.stamp \
+               confdefs.h defs.mk
 
 # Get components of Berkeley DB.
 _CURDIR:=      ${.CURDIR}
diff -r 31e7e8c8633b -r 1b3d84da9c76 tools/compat/compat_defs.h
--- a/tools/compat/compat_defs.h        Thu Jan 24 03:58:09 2002 +0000
+++ b/tools/compat/compat_defs.h        Thu Jan 24 04:05:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_defs.h,v 1.1 2002/01/22 20:42:59 thorpej Exp $  */
+/*     $NetBSD: compat_defs.h,v 1.2 2002/01/24 04:05:27 lukem Exp $    */
 
 #ifndef        __NETBSD_COMPAT_DEFS_H__
 #define        __NETBSD_COMPAT_DEFS_H__
@@ -8,8 +8,10 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <grp.h>
 #include <limits.h>
 #include <paths.h>
+#include <pwd.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -88,6 +90,17 @@
 ssize_t pread(int, void *, size_t, off_t);
 #endif
 
+#if !HAVE_PWCACHE_USERDB
+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));
+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 !HAVE_PWRITE
 ssize_t pwrite(int, const void *, size_t, off_t);
 #endif
diff -r 31e7e8c8633b -r 1b3d84da9c76 tools/compat/config.h.in
--- a/tools/compat/config.h.in  Thu Jan 24 03:58:09 2002 +0000
+++ b/tools/compat/config.h.in  Thu Jan 24 04:05:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.h.in,v 1.6 2002/01/22 20:42:59 thorpej Exp $    */
+/*     $NetBSD: config.h.in,v 1.7 2002/01/24 04:05:27 lukem Exp $      */
 
 #ifndef        __NETBSD_COMPAT_CONFIG_H__
 #define        __NETBSD_COMPAT_CONFIG_H__
@@ -24,6 +24,7 @@
 #undef HAVE_FPARSELN
 #undef HAVE_FUTIMES
 #undef HAVE_PREAD
+#undef HAVE_PWCACHE_USERDB
 #undef HAVE_PWRITE
 #undef HAVE_SETPROGNAME
 #undef HAVE_STRLCAT
diff -r 31e7e8c8633b -r 1b3d84da9c76 tools/compat/configure
--- a/tools/compat/configure    Thu Jan 24 03:58:09 2002 +0000
+++ b/tools/compat/configure    Thu Jan 24 04:05:27 2002 +0000
@@ -2593,16 +2593,17 @@
 
 fi
 
-for ac_func in basename dirname fgetln flock fparseln futimes pread pwrite setprogname strlcat strlcpy
+for ac_func in basename dirname fgetln flock fparseln futimes \
+       pread pwcache_userdb pwrite setprogname strlcat strlcpy
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:2599: checking for $ac_func" >&5
+echo "$as_me:2600: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2605 "configure"
+#line 2606 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -2633,16 +2634,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:2636: \"$ac_link\"") >&5
+if { (eval echo "$as_me:2637: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:2639: \$? = $ac_status" >&5
+  echo "$as_me:2640: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:2642: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2643: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2645: \$? = $ac_status" >&5
+  echo "$as_me:2646: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -2652,7 +2653,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:2655: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:2656: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -2665,7 +2666,7 @@
 # regcomp() and regexec() are also names of functions in the old V8
 # regexp package.  To avoid them, we need to find out who has regfree().
 
-echo "$as_me:2668: checking for regfree in -lregex" >&5
+echo "$as_me:2669: checking for regfree in -lregex" >&5
 echo $ECHO_N "checking for regfree in -lregex... $ECHO_C" >&6
 if test "${ac_cv_lib_regex_regfree+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2673,7 +2674,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lregex  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 2676 "configure"
+#line 2677 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -2692,16 +2693,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:2695: \"$ac_link\"") >&5
+if { (eval echo "$as_me:2696: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:2698: \$? = $ac_status" >&5
+  echo "$as_me:2699: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:2701: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2702: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2704: \$? = $ac_status" >&5
+  echo "$as_me:2705: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_regex_regfree=yes
 else
@@ -2712,7 +2713,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:2715: result: $ac_cv_lib_regex_regfree" >&5
+echo "$as_me:2716: result: $ac_cv_lib_regex_regfree" >&5
 echo "${ECHO_T}$ac_cv_lib_regex_regfree" >&6
 if test $ac_cv_lib_regex_regfree = yes; then
   cat >>confdefs.h <<EOF
@@ -2723,7 +2724,7 @@
 
 fi
 
-echo "$as_me:2726: checking for library containing regfree" >&5
+echo "$as_me:2727: checking for library containing regfree" >&5
 echo $ECHO_N "checking for library containing regfree... $ECHO_C" >&6
 if test "${ac_cv_search_regfree+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2731,7 +2732,7 @@
   ac_func_search_save_LIBS=$LIBS
 ac_cv_search_regfree=no
 cat >conftest.$ac_ext <<_ACEOF
-#line 2734 "configure"
+#line 2735 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -2750,16 +2751,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:2753: \"$ac_link\"") >&5
+if { (eval echo "$as_me:2754: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:2756: \$? = $ac_status" >&5
+  echo "$as_me:2757: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:2759: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2760: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2762: \$? = $ac_status" >&5
+  echo "$as_me:2763: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_search_regfree="none required"
 else
@@ -2771,7 +2772,7 @@
   for ac_lib in rx posix; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
     cat >conftest.$ac_ext <<_ACEOF
-#line 2774 "configure"
+#line 2775 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -2790,16 +2791,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:2793: \"$ac_link\"") >&5
+if { (eval echo "$as_me:2794: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:2796: \$? = $ac_status" >&5
+  echo "$as_me:2797: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:2799: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2800: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2802: \$? = $ac_status" >&5
+  echo "$as_me:2803: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_search_regfree="-l$ac_lib"
 break
@@ -2812,7 +2813,7 @@
 fi
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:2815: result: $ac_cv_search_regfree" >&5
+echo "$as_me:2816: result: $ac_cv_search_regfree" >&5
 echo "${ECHO_T}$ac_cv_search_regfree" >&6
 if test "$ac_cv_search_regfree" != no; then
   test "$ac_cv_search_regfree" = "none required" || LIBS="$ac_cv_search_regfree $LIBS"
@@ -2898,7 +2899,7 @@
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:2901: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:2902: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -3070,7 +3071,7 @@
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:3073: error: ambiguous option: $1
+    { { echo "$as_me:3074: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -3089,7 +3090,7 @@
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:3092: error: unrecognized option: $1
+  -*) { { echo "$as_me:3093: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -3126,7 +3127,7 @@
   # Handling of arguments.
   "defs.mk" ) CONFIG_FILES="$CONFIG_FILES defs.mk" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-  *) { { echo "$as_me:3129: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:3130: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -3324,7 +3325,7 @@
   esac



Home | Main Index | Thread Index | Old Index