summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2010-08-12 21:02:58 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-20 16:20:09 +0100
commitb5b3825ce6df45b16e1f3e15001da213bc8b0a55 (patch)
treeb2577de0765074d6e2bdbbdf1862220b52e8d7c1 /meta
parent735210556dc709b3c2367389fa6ea9c0109412b1 (diff)
downloadopenembedded-core-b5b3825ce6df45b16e1f3e15001da213bc8b0a55.tar.gz
openembedded-core-b5b3825ce6df45b16e1f3e15001da213bc8b0a55.tar.bz2
openembedded-core-b5b3825ce6df45b16e1f3e15001da213bc8b0a55.zip
unfs-server: new userspace nfs recipe
This is a simple userspace NFS server, derived from one which was previously used in openSUSE 10.x. Wind River contributed many of the patches. This package is not intended for target installations, only -native and -nativesdk use. Enabling nativesdk for readline, sqlite3, and pseudo was required, as well as a few new autoconf siteconfig entries. Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/pseudo/pseudo_git.bb2
-rw-r--r--meta/packages/readline/readline.inc2
-rw-r--r--meta/packages/sqlite/sqlite3.inc2
-rw-r--r--meta/packages/tasks/task-sdk-host.bb2
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/001-2.2b47-2.2b51.patch2344
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/002-destdir.patch68
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/003-manpages.patch28
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/004-strsignal.patch48
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/005-sys-time.patch29
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/006-reiserfs.patch1272
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/007-map.patch78
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/008-configure.patch13
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/009-multirw.patch15
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/010-realpath.patch30
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/011-fno-strict-aliasing.patch13
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/012-nostrip.patch13
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/013-mntpathlen.patch32
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/014-uninitialized.patch12
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/015-setattr.patch26
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/016-makefile.in.patch14
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/017-wrs-dynamic-rpc.patch258
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/018-remove-tcp-wrappers.patch20
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch125
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/020-undefined-chmod-fix.patch18
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/021-nolibwrap.patch20
-rw-r--r--meta/packages/unfs-server/unfs-server-2.2beta47/022-add-close-on-exec-descriptors.patch61
-rw-r--r--meta/packages/unfs-server/unfs-server_2.2beta47.bb71
-rw-r--r--meta/site/ix86-common10
-rw-r--r--meta/site/x86_64-linux12
29 files changed, 4634 insertions, 4 deletions
diff --git a/meta/packages/pseudo/pseudo_git.bb b/meta/packages/pseudo/pseudo_git.bb
index 59fa2645fd..4cb483ea60 100644
--- a/meta/packages/pseudo/pseudo_git.bb
+++ b/meta/packages/pseudo/pseudo_git.bb
@@ -42,6 +42,6 @@ do_install () {
fi
}
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/packages/readline/readline.inc b/meta/packages/readline/readline.inc
index f8bb45abea..966def992d 100644
--- a/meta/packages/readline/readline.inc
+++ b/meta/packages/readline/readline.inc
@@ -32,4 +32,4 @@ do_install_append () {
oe_libinstall -so -C shlib libreadline ${D}${libdir}
}
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/packages/sqlite/sqlite3.inc b/meta/packages/sqlite/sqlite3.inc
index 1b23818ad6..61bc0800c2 100644
--- a/meta/packages/sqlite/sqlite3.inc
+++ b/meta/packages/sqlite/sqlite3.inc
@@ -30,4 +30,4 @@ FILES_libsqlite-dev = "${libdir}/*.a ${libdir}/*.la ${libdir}/*.so \
FILES_libsqlite-doc = "${docdir} ${mandir} ${infodir}"
AUTO_LIBNAME_PKGS = "libsqlite"
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/packages/tasks/task-sdk-host.bb b/meta/packages/tasks/task-sdk-host.bb
index 08208bf6c8..bccf48dbde 100644
--- a/meta/packages/tasks/task-sdk-host.bb
+++ b/meta/packages/tasks/task-sdk-host.bb
@@ -18,6 +18,8 @@ RDEPENDS_${PN} = "\
pkgconfig-nativesdk \
qemu-nativesdk \
qemu-helper-nativesdk \
+ pseudo-nativesdk \
+ unfs-server-nativesdk \
opkg-nativesdk \
"
diff --git a/meta/packages/unfs-server/unfs-server-2.2beta47/001-2.2b47-2.2b51.patch b/meta/packages/unfs-server/unfs-server-2.2beta47/001-2.2b47-2.2b51.patch
new file mode 100644
index 0000000000..886ce92b34
--- /dev/null
+++ b/meta/packages/unfs-server/unfs-server-2.2beta47/001-2.2b47-2.2b51.patch
@@ -0,0 +1,2344 @@
+# Patch origin: nfs-server source RPM from openSUSE 10.3
+
+diff -urN nfs-server-2.2beta47/.version nfs-server-2.2beta51/.version
+--- nfs-server-2.2beta47/.version Tue Sep 7 09:47:27 1999
++++ nfs-server-2.2beta51/.version Fri Nov 8 14:45:36 2002
+@@ -1 +1 @@
+-2.2beta46
++2.2beta51
+diff -urN nfs-server-2.2beta47/ChangeLog nfs-server-2.2beta51/ChangeLog
+--- nfs-server-2.2beta47/ChangeLog Wed Nov 10 10:17:51 1999
++++ nfs-server-2.2beta51/ChangeLog Fri Nov 8 14:45:36 2002
+@@ -1,8 +1,59 @@
++Thu Nov 9 17:03:05 2000
++
++ * No longer use OPEN_MAX
++
++ * Reworked configure.in, BUILD script no longer needed
++ (nor functioning)
++
++ * Be more anal about matching cached fh's and real files.
++ In addition to the psi, we also store dev/ino/type now
++ and match that in fh_find.
++
++ * Write pidfiles
++
++ * Support nosetuid
++
++Wed Feb 9 14:52:34 2000
++
++ * auth_init.c didn't properly parse options--rot_squash
++ which is obviously a typo was parsed as ro.
++ Thanks to Jan Steffan for complaining about this :-)
++
++Mon Jan 31 11:48:34 2000
++
++ * Fixed Y2K bug in logging.c.
++ Thanks to Jonathan Hankins <jhankins@homewood.k12.al.us>.
++
++Thu Dec 9 11:14:21 1999
++
++ * Fix handling of NFS-mounted and /proc directories.
++ They weren't properly hidden.
++ Thanks to Dick Streefland <dick_streefland@tasking.com>
++ for the report and a first patch.
++
+ Wed Nov 10 10:17:16 1999
+
+ * Security fix for buffer overflow in fh_buildpath
+ No thanks to Mariusz who reported it to bugtraq
+ rather than me.
++
++Wed Nov 09 17:10:00 1999
++
++ * Workaround for broken Solaris clients that can't handle
++ atime/mtime/ctime of 0.
++ Thanks to Frank Wuebbelin for his problem report and
++ testing the fix.
++
++ * Fixed typo in exports.man
++
++Tue Nov 2 10:31:14 1999
++
++ * Patch for mode 0100 and 0100 executables by
++ Michael Deutschmann <michael@talamasca.wkpowerlink.com>
++
++ * Common startup stuff for all daemons.
++ Inspired by code sent to me by someone (sorry, I forgot
++ your name, and the mail's gone!)
+
+ Wed Sep 8 09:07:38 1999
+
+diff -urN nfs-server-2.2beta47/Makefile.in nfs-server-2.2beta51/Makefile.in
+--- nfs-server-2.2beta47/Makefile.in Tue Jun 22 14:53:10 1999
++++ nfs-server-2.2beta51/Makefile.in Fri Nov 8 14:45:36 2002
+@@ -17,23 +17,30 @@
+
+ #### Start of system configuration section. ####
+
+-srcdir = @srcdir@
+-VPATH = @srcdir@
++srcdir = @srcdir@
++VPATH = @srcdir@
+
+-CC = @CC@
+-AR = ar
+-RANLIB = @RANLIB@
+-
+-INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 755
+-INSTALL_DATA = @INSTALL_DATA@
+-MAKEINFO = makeinfo
+-TEXI2DVI = texi2dvi
+-RPCGEN = @RPCGEN@ @RPCGEN_C@
++CC = @CC@
++AR = ar
++RANLIB = @RANLIB@
++
++INSTALL = @INSTALL@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 755
++INSTALL_DATA = @INSTALL_DATA@
++MAKEINFO = makeinfo
++TEXI2DVI = texi2dvi
++RPCGEN = @RPCGEN@ @RPCGEN_C@
+
+ # General compile options and libs:
+-DEFS = @DEFS@ $(NFSD_DEFS)
+-LIBS = libnfs.a @LIBS@
++DEFS = @DEFS@ $(NFSD_DEFS)
++LIBS = libnfs.a @LIBS@
++
++# Ugidd support
++UGIDD_PROG = @UGIDD_PROG@
++UGIDD_MAN = @UGIDD_MAN@
++
++# New inode mapping scheme
++DEVTAB_FILE = $(install_prefix)@PATH_DEVTAB@
+
+ # Compile options for nfsd:
+ # CALL_PROFILING
+@@ -80,9 +87,6 @@
+
+ #### End of system configuration section. ####
+
+-# include site-specific defintions generated by BUILD.
+-include site.mk
+-
+ SHELL = /bin/sh
+
+ SRCS = version.c logging.c fh.c devtab.c \
+@@ -96,19 +100,19 @@
+ utimes.c mkdir.c rename.c getopt.c getopt_long.c \
+ alloca.c mountlist.c xmalloc.c \
+ xstrdup.c strdup.c strstr.c nfsmounted.c faccess.c \
+- haccess.c failsafe.c signals.c
++ haccess.c daemon.c signals.c
+ XDRFILES = mount.x nfs_prot.x
+ GENFILES = mount.h mount_xdr.c mount_svc.c nfs_prot.h nfs_prot_xdr.c \
+ ugid.h ugid_xdr.c ugid_clnt.c
+ HDRS = system.h nfsd.h auth.h fh.h logging.h fakefsuid.h \
+ rpcmisc.h faccess.h rquotad.h rquota.h haccess.h
+-LIBHDRS = fsusage.h getopt.h mountlist.h failsafe.h signals.h
++LIBHDRS = fsusage.h getopt.h mountlist.h daemon.h signals.h
+ MANPAGES5 = exports
+ MANPAGES8p = mountd nfsd $(UGIDD_MAN)
+ MANPAGES8 = showmount
+ MANPAGES = $(MANPAGES5) $(MANPAGES8p) $(MANPAGES8)
+ LIBOBJS = version.o fsusage.o mountlist.o xmalloc.o xstrdup.o \
+- nfsmounted.o faccess.o haccess.o failsafe.o \
++ nfsmounted.o faccess.o haccess.o daemon.o \
+ signals.o @LIBOBJS@ @ALLOCA@
+ OBJS = logging.o fh.o devtab.o auth_init.o auth_clnt.o auth.o
+ NFSD_OBJS = nfsd.o rpcmisc.o nfs_dispatch.o getattr.o setattr.o \
+@@ -174,15 +178,13 @@
+ ${srcdir}/mkinstalldirs $(bindir) $(man5dir) $(man8dir)
+
+ $(rpcprefix)mountd: $(MOUNTD_OBJS) libnfs.a
+- $(CC) $(LDFLAGS) -o $@ $(MOUNTD_OBJS) $(LIBS) \
+- $(LIBWRAP_DIR) $(LIBWRAP_LIB)
++ $(CC) $(LDFLAGS) -o $@ $(MOUNTD_OBJS) $(LIBS)
+
+ $(rpcprefix)nfsd: $(NFSD_OBJS) libnfs.a
+ $(CC) $(LDFLAGS) -o $@ $(NFSD_OBJS) $(LIBS)
+
+ $(rpcprefix)ugidd: $(UGIDD_OBJS) libnfs.a
+- $(CC) $(LDFLAGS) -o $@ $(UGIDD_OBJS) $(LIBS) \
+- $(LIBWRAP_DIR) $(LIBWRAP_LIB)
++ $(CC) $(LDFLAGS) -o $@ $(UGIDD_OBJS) $(LIBS)
+
+ showmount: $(SHOWMOUNT_OBJS) libnfs.a
+ $(CC) $(LDFLAGS) -o $@ $(SHOWMOUNT_OBJS) $(LIBS)
+diff -urN nfs-server-2.2beta47/aclocal.m4 nfs-server-2.2beta51/aclocal.m4
+--- nfs-server-2.2beta47/aclocal.m4 Fri Jun 11 12:04:22 1999
++++ nfs-server-2.2beta51/aclocal.m4 Fri Nov 8 14:45:36 2002
+@@ -221,20 +221,14 @@
+ ])dnl
+ dnl *********** libwrap bug **************
+ define(AC_LIBWRAP_BUG,
+- [if test -f site.mk; then
+- . ./site.mk
+- fi
+- if test ! -z "$LIBWRAP_DIR"; then
++ [if test "$ac_cv_lib_wrap_main" = yes; then
+ AC_MSG_CHECKING(for link problem with libwrap.a)
+ AC_CACHE_VAL(nfsd_cv_lib_wrap_bug,
+- [ac_save_LIBS=$LIBS
+- LIBS="$LIBS $LIBWRAP_DIR $LIBWRAP_LIB"
+- AC_TRY_LINK([
++ [AC_TRY_LINK([
+ extern int deny_severity;
+ ],[
+ deny_severity=1;
+ ], nfsd_cv_lib_wrap_bug=no, nfsd_cv_lib_wrap_bug=yes)
+- LIBS=$ac_save_LIBS
+ ]) dnl
+ AC_MSG_RESULT($nfsd_cv_lib_wrap_bug)
+ test $nfsd_cv_lib_wrap_bug = yes && AC_DEFINE(HAVE_LIBWRAP_BUG)
+diff -urN nfs-server-2.2beta47/auth.c nfs-server-2.2beta51/auth.c
+--- nfs-server-2.2beta47/auth.c Mon Sep 13 16:56:03 1999
++++ nfs-server-2.2beta51/auth.c Fri Nov 8 14:45:36 2002
+@@ -84,8 +84,9 @@
+ 0, /* relative links */
+ 0, /* noaccess */
+ 1, /* cross_mounts */
+- (uid_t)-2, /* default uid */
+- (gid_t)-2, /* default gid */
++ 1, /* allow setuid */
++ 65534, /* default uid */
++ 65534, /* default gid */
+ 0, /* no NIS domain */
+ };
+
+@@ -99,8 +100,9 @@
+ 0, /* relative links */
+ 0, /* noaccess */
+ 1, /* cross_mounts */
+- (uid_t)-2, /* default uid */
+- (gid_t)-2, /* default gid */
++ 0, /* allow setuid */
++ 65534, /* default uid */
++ 65534, /* default gid */
+ 0, /* no NIS domain */
+ };
+
+@@ -673,6 +675,7 @@
+ cpp = &unknown_clients;
+ } else {
+ cpp = &known_clients;
++ cp->clnt_addr = *(struct in_addr *) hp->h_addr;
+ auth_hash_host(cp, hp);
+ }
+ cp->next = *cpp;
+diff -urN nfs-server-2.2beta47/auth.h nfs-server-2.2beta51/auth.h
+--- nfs-server-2.2beta47/auth.h Thu Apr 8 14:47:56 1999
++++ nfs-server-2.2beta51/auth.h Fri Nov 8 14:45:36 2002
+@@ -23,14 +23,6 @@
+ extern char * public_root_path;
+ extern struct nfs_fh public_root;
+
+-#if defined(linux) && defined(i386) && !defined(HAVE_SETFSUID)
+-# define MAYBE_HAVE_SETFSUID
+-#endif
+-
+-#ifdef MAYBE_HAVE_SETFSUID
+-extern int have_setfsuid;
+-#endif
+-
+ /*
+ * These externs are set in the dispatcher (dispatch.c) and auth_fh
+ * (nfsd.c) so that we can determine access rights, export options,
+@@ -59,6 +51,7 @@
+ int link_relative;
+ int noaccess;
+ int cross_mounts;
++ int allow_setuid;
+ uid_t nobody_uid;
+ gid_t nobody_gid;
+ char * clnt_nisdomain;
+@@ -112,7 +105,7 @@
+ extern void auth_free_lists(void);
+ extern nfs_client *auth_clnt(struct svc_req *rqstp);
+ extern nfs_mount *auth_path(nfs_client *, struct svc_req *, char *);
+-extern void auth_user(nfs_mount *, struct svc_req *);
++extern int auth_user(nfs_mount *, struct svc_req *);
+
+ extern nfs_client *auth_get_client(char *);
+ extern nfs_mount *auth_match_mount(nfs_client *, char *);
+diff -urN nfs-server-2.2beta47/auth_clnt.c nfs-server-2.2beta51/auth_clnt.c
+--- nfs-server-2.2beta47/auth_clnt.c Wed Nov 10 10:18:06 1999
++++ nfs-server-2.2beta51/auth_clnt.c Fri Nov 8 14:45:36 2002
+@@ -12,20 +12,17 @@
+ */
+
+
++#include <sys/fsuid.h>
+ #include "system.h"
+ #include "nfsd.h"
+-#include "fakefsuid.h"
+-
+-#ifndef svc_getcaller
+-#define svc_getcaller(x) ((struct sockaddr_in *) &(x)->xp_rtaddr.buf)
+-#endif
++#include "rpcmisc.h"
+
+
+-#if defined(HAVE_SETFSUID) || defined(MAYBE_HAVE_SETFSUID)
+-static void setfsids(uid_t, gid_t, gid_t *, int);
++#if defined(HAVE_SETFSUID)
++static int setfsids(uid_t, gid_t, gid_t *, int);
+ #endif
+ #ifndef HAVE_SETFSUID
+-static void seteids(uid_t, gid_t, gid_t *, int);
++static int seteids(uid_t, gid_t, gid_t *, int);
+ #endif
+
+ uid_t auth_uid = 0; /* Current effective user ids */
+@@ -43,6 +40,17 @@
+ short *gid, short *nrgids, int *groups);
+ #endif
+
++/*
++ * The following crap is required for glibc 2.1 which has 32bit uids
++ * in user land mapped to 16bit uids in the Linux kernel
++ */
++#if defined(HAVE_BROKEN_SETFSUID)
++# define native_uid(u) ((unsigned short)(u))
++# define native_gid(g) ((unsigned short)(g))
++#else
++# define native_uid(u) (u)
++# define native_gid(g) (g)
++#endif
+
+ /*
+ * For an RPC request, look up the NFS client info along with the
+@@ -92,8 +100,9 @@
+ }
+
+ if (logging_enabled(D_AUTH)) {
+- Dprintf(D_AUTH, "auth_path(%s): mount point %s, (%s%s%s%s%s)\n",
+- path, mp->path,
++ Dprintf(D_AUTH, "auth_path(%s, %s): "
++ "mount point %s, (%s%s%s%s%s)\n",
++ inet_ntoa(cp->clnt_addr), path, mp->path,
+ mp->o.all_squash? "all_squash " : (
+ mp->o.root_squash? "root_squash " : ""),
+ (mp->o.uidmap == map_daemon)? "uidmap " : "",
+@@ -105,7 +114,8 @@
+ return mp;
+ }
+
+-void auth_user(nfs_mount *mp, struct svc_req *rqstp)
++int
++auth_user(nfs_mount *mp, struct svc_req *rqstp)
+ {
+ uid_t cuid;
+ gid_t cgid;
+@@ -160,23 +170,18 @@
+ else if (cred_len > NGRPS)
+ cred_len = NGRPS;
+
+- cuid = luid(cred_uid, mp, rqstp);
+- cgid = lgid(cred_gid, mp, rqstp);
++ cuid = luid(native_uid(cred_uid), mp, rqstp);
++ cgid = lgid(native_gid(cred_gid), mp, rqstp);
+ clen = cred_len;
+ for (i = 0; i < cred_len; i++)
+- cgids[i] = lgid(cred_gids[i], mp, rqstp);
++ cgids[i] = lgid(native_gid(cred_gids[i]), mp, rqstp);
+ } else {
+ /* On systems that have 32bit uid_t in user space but
+ * 16bit in the kernel, we need to truncate the
+ * nobody ID (default -2).
+ */
+-#if !defined(HAVE_BROKEN_SETFSUID)
+- cuid = mp->o.nobody_uid;
+- cgid = mp->o.nobody_gid;
+-#else
+- cuid = (unsigned short) mp->o.nobody_uid;
+- cgid = (unsigned short) mp->o.nobody_gid;
+-#endif
++ cuid = native_uid(mp->o.nobody_uid);
++ cgid = native_gid(mp->o.nobody_gid);
+ /* Construct a list of one gid. */
+ cgids[0] = cgid;
+ clen = 1;
+@@ -193,14 +198,9 @@
+ * upper 16 bits set (including our default nobody uid -2).
+ */
+ #if defined(HAVE_SETFSUID)
+- setfsids(cuid, cgid, cgids, clen);
++ return setfsids(cuid, cgid, cgids, clen);
+ #else
+-#if defined(MAYBE_HAVE_SETFSUID)
+- if (have_setfsuid)
+- setfsids(cuid, cgid, cgids, clen);
+- else
+-#endif
+- seteids(cuid, cgid, cgids, clen);
++ return seteids(cuid, cgid, cgids, clen);
+ #endif
+ }
+
+@@ -210,6 +210,8 @@
+ void
+ auth_override_uid(uid_t uid)
+ {
++ int res;
++
+ /* extension hooks: */
+ efs_setfsuid(uid);
+
+@@ -217,19 +219,18 @@
+ uid = (unsigned short) uid;
+ #endif
+ #if defined(HAVE_SETFSUID)
+- setfsuid(uid);
++ res = setfsuid(uid);
+ #else
+-#if defined(MAYBE_HAVE_SETFSUID)
+- if (have_setfsuid)
+- setfsuid(uid);
+- else
+-#endif
+- seteuid(uid);
++ res = seteuid(uid);
+ #endif
++ /* should never happen */
++ if (res < 0)
++ Dprintf(L_FATAL, "auth_override_uid(%d) failed: %s",
++ uid, strerror(errno));
+ }
+
+-#if defined(HAVE_SETFSUID) || defined(MAYBE_HAVE_SETFSUID)
+-static void
++#if defined(HAVE_SETFSUID)
++static int
+ setfsids(uid_t cred_uid, gid_t cred_gid, gid_t *cred_gids, int cred_len)
+ {
+ /* extension hooks: */
+@@ -238,43 +239,47 @@
+
+ /* First, set the user ID. */
+ if (auth_uid != cred_uid) {
+- if (setfsuid(cred_uid) < 0)
++ if (setfsuid(cred_uid) < 0) {
+ Dprintf(L_ERROR, "Unable to setfsuid %d: %s\n",
+ cred_uid, strerror(errno));
+- else
+- auth_uid = cred_uid;
++ return 0;
++ }
++ auth_uid = cred_uid;
+ }
+
+ /* Next, the group ID. */
+ if (auth_gid != cred_gid) {
+- if (setfsgid(cred_gid) < 0)
++ if (setfsgid(cred_gid) < 0) {
+ Dprintf(L_ERROR, "Unable to setfsgid %d: %s\n",
+ cred_gid, strerror(errno));
+- else
+- auth_gid = cred_gid;
++ return 0;
++ }
++ auth_gid = cred_gid;
+ }
+
+ #ifdef HAVE_SETGROUPS
+ /* Finally, set the supplementary group IDs if possible. */
+- if (cred_len < 0 || cred_len > NGRPS)
++ if (cred_len < 0 || cred_len > NGRPS) {
+ Dprintf(L_ERROR, "Negative or huge cred_len: %d\n", cred_len);
+- else if (cred_len != auth_gidlen
+- || memcmp(cred_gids, auth_gids, auth_gidlen*sizeof(gid_t))) {
+- if (setgroups(cred_len, cred_gids) < 0)
++ return 0;
++ }
++ if (cred_len != auth_gidlen
++ || memcmp(cred_gids, auth_gids, auth_gidlen*sizeof(gid_t))) {
++ if (setgroups(cred_len, cred_gids) < 0) {
+ Dprintf(L_ERROR, "Unable to setgroups: %s\n",
+ strerror(errno));
+- else {
+- memcpy(auth_gids, cred_gids, cred_len*sizeof(gid_t));
+- auth_gidlen = cred_len;
++ return 0;
+ }
++ memcpy(auth_gids, cred_gids, cred_len*sizeof(gid_t));
++ auth_gidlen = cred_len;
+ }
+ #endif /* HAVE_SETGROUPS */
+-
++ return 1;
+ }
+ #endif
+
+ #if !defined(HAVE_SETFSUID)
+-static void
++static int
+ seteids(uid_t cred_uid, gid_t cred_gid, gid_t *cred_gids, int cred_len)
+ {
+ /* extension hooks: */
+@@ -286,52 +291,62 @@
+ /* First set the group ID. */
+ if (auth_gid != cred_gid) {
+ if (auth_uid != ROOT_UID) {
+- if (seteuid(ROOT_UID) < 0)
++ if (seteuid(ROOT_UID) < 0) {
+ Dprintf(L_ERROR, "Unable to seteuid(%d): %s\n",
+ ROOT_UID, strerror(errno));
+- else
+- auth_uid = ROOT_UID;
++ return 0;
++ }
++ auth_uid = ROOT_UID;
+ }
+- if (setegid(cred_gid) < 0)
++ if (setegid(cred_gid) < 0) {
+ Dprintf(L_ERROR, "Unable to setegid(%d): %s\n",
+ cred_gid, strerror(errno));
+- else
+- auth_gid = cred_gid;
++ return 0;
++ }
++ auth_gid = cred_gid;
+ }
+
+ #ifdef HAVE_SETGROUPS
+ /* Next set the supplementary group IDs if possible. */
+- if (cred_len < 0 || cred_len > NGRPS)
++ if (cred_len < 0 || cred_len > NGRPS) {
+ Dprintf(L_ERROR, "Negative or huge cred_len: %d\n", cred_len);
+- else if (cred_len != auth_gidlen
+- || memcmp(cred_gids, auth_gids, auth_gidlen*sizeof(gid_t))) {
++ return 0;
++ }
++ if (cred_len != auth_gidlen
++ || memcmp(cred_gids, auth_gids, auth_gidlen*sizeof(gid_t))) {
+ if (auth_uid != ROOT_UID) {
+- if (seteuid(ROOT_UID) < 0)
++ if (seteuid(ROOT_UID) < 0) {
+ Dprintf(L_ERROR, "Unable to seteuid(%d): %s\n",
+ ROOT_UID, strerror(errno));
+- else
+- auth_uid = ROOT_UID;
++ return 0;
++ }
++ auth_uid = ROOT_UID;
+ }
+- if (setgroups(cred_len, cred_gids) < 0)
++ if (setgroups(cred_len, cred_gids) < 0) {
+ Dprintf(L_ERROR, "Unable to setgroups: %s\n",
+ strerror(errno));
+- else {
+- memcpy(auth_gids, cred_gids, cred_len*sizeof(gid_t));
+- auth_gidlen = cred_len;
++ return 0;
+ }
++ memcpy(auth_gids, cred_gids, cred_len*sizeof(gid_t));
++ auth_gidlen = cred_len;
+ }
+ #endif /* HAVE_SETGROUPS */
+
+ /* Finally, set the user ID. */
+ if (auth_uid != cred_uid) {
+- if (auth_uid != ROOT_UID && seteuid(ROOT_UID) < 0)
++ if (auth_uid != ROOT_UID && seteuid(ROOT_UID) < 0) {
+ Dprintf(L_ERROR, "Unable to seteuid(%d): %s\n",
+ ROOT_UID, strerror(errno));
+- if (seteuid(cred_uid) < 0)
++ return 0;
++ }
++ if (seteuid(cred_uid) < 0) {
+ Dprintf(L_ERROR, "Unable to seteuid(%d): %s\n",
+ cred_uid, strerror(errno));
+- else
+- auth_uid = cred_uid;
++ return 0;
++ }
++ auth_uid = cred_uid;
+ }
++
++ return 1;
+ }
+ #endif
+diff -urN nfs-server-2.2beta47/auth_init.c nfs-server-2.2beta51/auth_init.c
+--- nfs-server-2.2beta47/auth_init.c Mon Apr 19 14:01:21 1999
++++ nfs-server-2.2beta51/auth_init.c Fri Nov 8 14:45:36 2002
+@@ -13,7 +13,6 @@
+ */
+
+ #include "nfsd.h"
+-#include "fakefsuid.h"
+ #include <pwd.h>
+
+ #define LINE_SIZE 1024
+@@ -263,55 +262,63 @@
+ cp++;
+ while (*cp != terminator) {
+ kwd = cp;
+- while (isalpha(*cp) || *cp == '_' || *cp == '=') {
+- /* break out of loop after = sign */
+- if (*cp++ == '=')
+- break;
+- }
++ /* Gobble up keyword and "=" if there is one */
++ while (isalpha(*cp) || *cp == '_')
++ ++cp;
++ if (*cp == '=')
++ ++cp;
++
+ klen = cp - kwd;
+
+ /* process keyword */
+- if (strncmp(kwd, "secure", 6) == 0)
++#define ifkwd(n, string) \
++ if (klen == (n) && !strncmp(kwd, string, (n)))
++
++ ifkwd(2, "ro")
++ mp->o.read_only = 1;
++ else ifkwd(2, "rw")
++ mp->o.read_only = 0;
++ else ifkwd(6, "secure")
+ mp->o.secure_port = 1;
+- else if (strncmp(kwd, "insecure", 8) == 0)
++ else ifkwd(8, "insecure")
+ mp->o.secure_port = 0;
+- else if (strncmp(kwd, "root_squash", 11) == 0)
++ else ifkwd(11, "root_squash")
+ mp->o.root_squash = 1;
+- else if (strncmp(kwd, "no_root_squash", 14) == 0)
++ else ifkwd(14, "no_root_squash")
+ mp->o.root_squash = 0;
+- else if (strncmp(kwd, "ro", 2) == 0)
+- mp->o.read_only = 1;
+- else if (strncmp(kwd, "rw", 2) == 0)
+- mp->o.read_only = 0;
+- else if (strncmp(kwd, "link_relative", 13) == 0)
++ else ifkwd(13, "link_relative")
+ mp->o.link_relative = 1;
+- else if (strncmp(kwd, "link_absolute", 13) == 0)
++ else ifkwd(13, "link_absolute")
+ mp->o.link_relative = 0;
+- else if (strncmp(kwd, "map_daemon", 10) == 0)
++ else ifkwd(10, "map_daemon")
+ mp->o.uidmap = map_daemon;
+- else if (strncmp(kwd, "map_nis=", 8) == 0)
++ else ifkwd(8, "map_nis=")
+ parse_nis_uidmap(mp, &cp);
+- else if (strncmp(kwd, "map_static=", 11) == 0)
++ else ifkwd(11, "map_static=")
+ parse_static_uidmap(mp, &cp);
+- else if (strncmp(kwd, "map_identity", 12) == 0)
++ else ifkwd(12, "map_identity")
+ mp->o.uidmap = identity;
+- else if (strncmp(kwd, "all_squash", 10) == 0)
++ else ifkwd(10, "all_squash")
+ mp->o.all_squash = 1;
+- else if (strncmp(kwd, "no_all_squash", 13) == 0)
++ else ifkwd(13, "no_all_squash")
+ mp->o.all_squash = 0;
+- else if (strncmp(kwd, "noaccess", 8) == 0)
++ else ifkwd(8, "noaccess")
+ mp->o.noaccess = 1;
+- else if (strncmp(kwd, "squash_uids=", 12) == 0)
++ else ifkwd(12, "squash_uids=")
+ parse_squash(mp, 1, &cp);
+- else if (strncmp(kwd, "squash_gids=", 12) == 0)
++ else ifkwd(12, "squash_gids=")
+ parse_squash(mp, 0, &cp);
+- else if (strncmp(kwd, "anonuid=", 8) == 0)
++ else ifkwd(8, "anonuid=")
+ mp->o.nobody_uid = parse_num(&cp);
+- else if (strncmp(kwd, "anongid=", 8) == 0)
++ else ifkwd(8, "anongid=")
+ mp->o.nobody_gid = parse_num(&cp);
+- else if (strncmp(kwd, "async", 5) == 0)
++ else ifkwd(6, "setuid")
++ mp->o.allow_setuid = 1;
++ else ifkwd(8, "nosetuid")
++ mp->o.allow_setuid = 0;
++ else ifkwd(5, "async")
+ /* knfsd compatibility, ignore */;
+- else if (strncmp(kwd, "sync", 4) == 0)
++ else ifkwd(4, "sync")
+ /* knfsd compatibility, ignore */;
+ else {
+ Dprintf(L_ERROR,
+@@ -566,11 +573,6 @@
+ auth_check_all_wildcards();
+ auth_sort_all_mountlists();
+ auth_log_all();
+-
+-#if defined(MAYBE_HAVE_SETFSUID) && !defined(HAVE_SETFSUID)
+- /* check if the a.out setfsuid syscall works on this machine */
+- have_setfsuid = (setfsuid(0) >= 0);
+-#endif
+
+ auth_initialized = 1;
+ }
+diff -urN nfs-server-2.2beta47/config.h.in nfs-server-2.2beta51/config.h.in
+--- nfs-server-2.2beta47/config.h.in Fri Jun 11 12:01:22 1999
++++ nfs-server-2.2beta51/config.h.in Fri Nov 8 14:45:36 2002
+@@ -3,7 +3,7 @@
+ /* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+-#ifndef _ALL_SOURCE
++#ifdef _ALL_SOURCE
+ #undef _ALL_SOURCE
+ #endif
+
+diff -urN nfs-server-2.2beta47/configure.in nfs-server-2.2beta51/configure.in
+--- nfs-server-2.2beta47/configure.in Fri Jun 11 11:58:10 1999
++++ nfs-server-2.2beta51/configure.in Fri Nov 8 14:45:36 2002
+@@ -2,7 +2,36 @@
+ dnl Updated for autoconf 2.
+ dnl
+ AC_INIT(nfsd.c)
+-AC_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADER(config.h site.h)
++
++dnl **************************************************************
++dnl * handle --enable options
++dnl **************************************************************
++AC_ARG_ENABLE(new-inodes,
++ [ --enable-new-inodes Enable new-style inode inodes])
++AC_ARG_WITH(devtab,
++ [ --with-devtab=file Specify location for devtab [/var/lib/nfs/devtab]],
++ PATH_DEVTAB=$withval,
++ PATH_DEVTAB=/var/lib/nfs/devtab)
++AC_ARG_ENABLE(ugid-dynamic,
++ [ --enable-ugid-dynamic Enable uid mapping using rpc.ugidd (not recommended)])
++AC_ARG_ENABLE(ugid-nis,
++ [ --enable-ugid-nis Enable NIS-based uid mapping])
++AC_ARG_ENABLE(host-access,
++ [ --enable-host-access Enable host access checking])
++AC_ARG_ENABLE(mount-logging,
++ [ --disable-mount-logging Do not log mount operations to syslog],,
++ enable_mount_logging=yes)
++AC_ARG_WITH(exports-uid,
++ [ --with-exports-uid=N Make sure that /etc/exports is owned by uid N],,
++ with_exports_uid=0)
++AC_ARG_WITH(exports-gid,
++ [ --with-exports-gid=N Make sure that /etc/exports is owned by gid N],,
++ with_exports_gid=0)
++
++dnl **************************************************************
++dnl * Check for all kinds of stuff
++dnl **************************************************************
+ AC_PROG_CC
+ # If we're using gcc, we want warning flags
+ test -n "$GCC" &&
+@@ -19,7 +48,7 @@
+ AC_MINIX
+ AC_ISC_POSIX
+ AC_PROG_INSTALL
+-AC_CROSS_CHECK
++dnl AC_CROSS_CHECK
+ AC_STDC_HEADERS
+ AC_GNULIBC
+ AC_CONST
+@@ -52,14 +81,45 @@
+ AC_CHECK_LIB(rpc, main)
+ AC_CHECK_LIB(crypt, main)
+ AC_CHECK_LIB(nys, main)
+-AC_REPLACE_FUNCS(strerror realpath mkdir rename utimes strdup strstr getopt getopt_long)
+ AC_HAVE_FUNCS(getcwd seteuid setreuid getdtablesize setgroups lchown setsid setfsuid setfsgid innetgr quotactl authdes_getucred)
+ AC_AUTHDES_GETUCRED
+ AC_BROKEN_SETFSUID
+ AC_M