Replace unfs-server with unfs3
v2 cover Replace unfs-server with unfs3
There was a bit of a lag after Saul's review comments because in order to upstream any of the patches everything had to be rebased to the upstream version of unfs3. This also required code changes and re-testing.
Changes in v2
* Use recipe upstream SVN
- Dropped prior configure hacks because autoconf bugs were fixed in the upstream version of unfs3
* Reworked all patches against upstream SVN
- Dropped 64 bit patch because the upstream version superseded it
* Contributed all patches to the upstream maintainer of unfs3
- All unfs3 patches marked as upstream pending
* This series was rebased to master latest of oe-core
Cheers,
Jason
---- Original mail ----
[YOCTO #5639]
The goal of this patchset it to upgrade the user mode NFS server from NFSv2 to NFSv3. To do so requires the use of a new server. The key reason this update needs to occurs is that the old server uses the inode from the file system for the NFS hash value. The former is now 64 bits on modern kernels while the later is only 32 bits due to the protocol and implementation with in the the unfs-server. This causes all sorts of problem with directory loops and duplicate file system references that had been reported in the bugzilla.
That should also make it possible to extract a rootfs and run it as a non-root user.
Example:
runqemu-extract-sdk tmp-eglibc/deploy/images/qemux86-64/core-image-minimal-qemux86-64.tar.bz2 rootfs
runqemu qemux86-64 pwd/rootfs nographic slirp
Cheers,
Jason.
The following changes since commit 24d5b449e5f4d91119f0d8e13c457618811aadfc:
libtool-cross/native: Force usage of bash due to sstate inconsistencies (2014-01-23 12:14:34 +0000)
are available in the git repository at:
.
for you to fetch changes up to efcf5c967f6f8de16d73267943b3746caa431972:
runqemu,runqemu-internal: Allow slirp for NFS and KVM use (2014-01-23 07:41:47 -0600)
----------------------------------------------------------------
Jason Wessel (5):
unfs3: Add a NFSv3 user mode server for use with runqemu unfs3,unfs-server: Replace all instances of unfs-server with unfs3
unfs-server: Remove unfs-server recipe and patches
runqemu-export-rootfs: update for unfs3 runqemu,runqemu-internal: Allow slirp for NFS and KVM use
Saul Wold (1):
runqemu: Use the newer unfs3 for serving user space nfs
meta/conf/distro/include/seperatebuilddir.inc | 4 +- meta/files/common-licenses/unfs3 | 24 + meta/recipes-core/meta/meta-ide-support.bb | 2 +- .../nativesdk-packagegroup-sdk-host.bb | 2 +- .../adt-installer/scripts/adt_installer_internal | 2 +- .../001-2.2b47-2.2b51.patch | 2349 -------------------- .../unfs-server-2.1+2.2beta47/002-destdir.patch | 73 - .../unfs-server-2.1+2.2beta47/003-manpages.patch | 33 - .../unfs-server-2.1+2.2beta47/004-strsignal.patch | 53 - .../unfs-server-2.1+2.2beta47/005-sys-time.patch | 34 - .../unfs-server-2.1+2.2beta47/006-reiserfs.patch | 1277 ----------- .../unfs-server-2.1+2.2beta47/007-map.patch | 83 - .../unfs-server-2.1+2.2beta47/008-configure.patch | 18 - .../unfs-server-2.1+2.2beta47/009-multirw.patch | 20 - .../unfs-server-2.1+2.2beta47/010-realpath.patch | 35 - .../011-fno-strict-aliasing.patch | 18 - .../unfs-server-2.1+2.2beta47/012-nostrip.patch | 18 - .../unfs-server-2.1+2.2beta47/013-mntpathlen.patch | 37 - .../014-uninitialized.patch | 17 - .../unfs-server-2.1+2.2beta47/015-setattr.patch | 31 - .../016-makefile.in.patch | 19 - .../017-wrs-dynamic-rpc.patch | 263 --- .../018-remove-tcp-wrappers.patch | 25 - .../019-pid-before-fork.patch | 130 -- .../020-undefined-chmod-fix.patch | 23 - .../unfs-server-2.1+2.2beta47/021-nolibwrap.patch | 25 - .../022-add-close-on-exec-descriptors.patch | 66 - .../023-no-rpc-register.patch | 34 - .../unfs-server/unfs-server_2.1+2.2beta47.bb | 78 - .../unfs3/unfs3/alternate_rpc_ports.patch | 158 ++ .../unfs3/unfs3/fix_compile_warning.patch | 25 + .../fix_pid_race_parent_writes_child_pid.patch | 61 + .../unfs3/unfs3/fix_warnings.patch | 53 + .../unfs3/unfs3/relative_max_socket_path_len.patch | 74 + .../unfs3/unfs3/rename_fh_cache.patch | 64 + .../unfs3/unfs3/tcp_no_delay.patch | 56 + .../unfs3/unfs3/unfs3_parallel_build.patch | 36 + meta/recipes-devtools/unfs3/unfs3_0.9.22.r490.bb | 44 + .../packagegroups/packagegroup-toolset-native.bb | 2 +- meta/site/ix86-common | 2 +- meta/site/x86_64-linux | 2 +- scripts/runqemu | 10 +- scripts/runqemu-export-rootfs | 57 +- scripts/runqemu-internal | 21 +- 44 files changed, 628 insertions(+), 4830 deletions(-) create mode 100644 meta/files/common-licenses/unfs3 delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/001-2.2b47-2.2b51.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/002-destdir.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/003-manpages.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/004-strsignal.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/005-sys-time.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/006-reiserfs.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/007-map.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/008-configure.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/009-multirw.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/010-realpath.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/011-fno-strict-aliasing.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/012-nostrip.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/013-mntpathlen.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/014-uninitialized.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/015-setattr.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/016-makefile.in.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/017-wrs-dynamic-rpc.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/018-remove-tcp-wrappers.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/019-pid-before-fork.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/020-undefined-chmod-fix.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/021-nolibwrap.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/022-add-close-on-exec-descriptors.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/023-no-rpc-register.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server_2.1+2.2beta47.bb create mode 100644 meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/fix_warnings.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3_0.9.22.r490.bb
PATCH v2 1/6 unfs3: Add a NFSv3 user mode server for use with runqemu
The user mode nfs server allows the use of runqemu without any root privileges and may even be accelerated with kvm.
Example:
runqemu-extract-sdk tmp-eglibc/deploy/images/qemux86-64/core-image-minimal-qemux86-64.tar.bz2 rootfs
runqemu qemux86-64 pwd/rootfs nographic slirp kvm
[YOCTO #5639]
--- meta/files/common-licenses/unfs3 | 24 +++ .../unfs3/unfs3/alternate_rpc_ports.patch | 158 ++++++++++++++++++++ .../unfs3/unfs3/fix_compile_warning.patch | 25 ++++ .../fix_pid_race_parent_writes_child_pid.patch | 61 ++++++++ .../unfs3/unfs3/fix_warnings.patch | 53 +++++++ .../unfs3/unfs3/relative_max_socket_path_len.patch | 74 +++++++++ .../unfs3/unfs3/rename_fh_cache.patch | 64 ++++++++ .../unfs3/unfs3/tcp_no_delay.patch | 56 +++++++ .../unfs3/unfs3/unfs3_parallel_build.patch | 36 +++++ meta/recipes-devtools/unfs3/unfs3_0.9.22.r490.bb | 44 ++++++ 10 files changed, 595 insertions(+) create mode 100644 meta/files/common-licenses/unfs3 create mode 100644 meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/fix_warnings.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch create mode 100644 meta/recipes-devtools/unfs3/unfs3_0.9.22.r490.bb
meta/files/common-licenses/unfs3 new file +24 -0
@@ -0,0 +1,24 @@ +UNFS3 user-space NFSv3 server +(C) 2003, Pascal Schmidt <[email protected]> + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +158 -0
158 lines not on this page · raw message
meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch new file +25 -0
@@ -0,0 +1,25 @@ +daemon.c: Check exit code of chdir() + +Stop the compile warning and fix the code to act on a chdir() failure. +If this one does fail something is very, very wrong. + +Signed-off-by: Jason Wessel <[email protected]> + +Upstream-Status: Pending + +--- + daemon.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/daemon.c ++++ b/daemon.c +@@ -964,7 +964,8 @@ int main(int argc, char **argv) + sigaction(SIGALRM, &act, NULL); + + /* don't make directory we started in busy */ +- chdir("/"); ++ if(chdir("/") < 0) ++ daemon_exit(0); + + /* detach from terminal */ + if (opt_detach) {
meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch new file +61 -0
61 lines not on this page · raw message
meta/recipes-devtools/unfs3/unfs3/fix_warnings.patch new file +53 -0
53 lines not on this page · raw message
meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch new file +74 -0
74 lines not on this page · raw message
meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch new file +64 -0
64 lines not on this page · raw message
meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch new file +56 -0
56 lines not on this page · raw message
meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch new file +36 -0
@@ -0,0 +1,36 @@ +Fix parallel build dependency issue + +If building with make -j2 the lib.a will not get built in time. + +Jason Wessel <[email protected]> + +Upstream-Status: Pending + +--- + Config/Makefile.in | 2 ++ + Makefile.in | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/Makefile.in ++++ b/Makefile.in +@@ -29,7 +29,8 @@ DESTDIR = + + VPATH = $(srcdir) + +-all: subdirs unfsd$(EXEEXT) ++all: subdirs ++ $(MAKE) unfsd$(EXEEXT) + + unfsd$(EXEEXT): $(OBJS) $(CONFOBJ) $(EXTRAOBJ) + $(CC) -o $@ $(OBJS) $(CONFOBJ) $(EXTRAOBJ) $(LDFLAGS) +--- a/Config/Makefile.in ++++ b/Config/Makefile.in +@@ -16,6 +16,8 @@ lib.a: $(OBJS) + $(AR) crs lib.a $(OBJS) + + y.tab.h y.tab.c: $(srcdir)/exports.y ++ ++y.tab.c: $(srcdir)/exports.y + $(YACC) -d $(srcdir)/exports.y + + y.tab.o: y.tab.c $(srcdir)/exports.h $(top_srcdir)/nfs.h $(top_srcdir)/mount.h $(top_srcdir)/daemon.h
meta/recipes-devtools/unfs3/unfs3_0.9.22.r490.bb new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v2 1/6] unfs3: Add a NFSv3 user mode server for use with runqemu
Quoted 5 lines · Jason Wessel
+++ b/meta/files/common-licenses/unfs3
meta/files/common-licenses/unfs3 new file +3
-0@@ -0,0 +1,24 @@ +UNFS3 user-space NFSv3 server +(C) 2003, Pascal Schmidt <[email protected]> +
meta/files/common-licenses/unfs3 line 13
Quoted 10 lines
meta/files/common-licenses/unfs3 new file +10
-0+Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission.
Isn't this just the 3-clause BSD licence?
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch line 8
Quoted 11 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +8
-0@@ -0,0 +1,158 @@ +Add ability to specify rcp port numbers + +In order to run more than one unfs server on a host system, you must +be able to specify alternate rpc port numbers. + +Jason Wessel <[email protected]> + +Upstream-Status: Pending
I think you said in the cover letter that the patches had been sent upstream. If that's the case then it should be Upstream-Status:
Submitted.
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch line 11
Quoted 3 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +3
-0+RDEPENDS_${PN} = "pseudo" +RDEPENDS_${PN}_class-native = "pseudo-native" +RDEPENDS_${PN}_class-nativesdk = "pseudo-nativesdk"
That looks a bit odd. Are the latter two lines doing anything very useful?
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch line 13
Quoted 2 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +2
-0+# This recipe is intended for -native and -nativesdk builds only, +# not target installs:
Why? If this is really the case, shouldn't it be named unfs3-native in the first place?
p.
Re: [PATCH v2 1/6] unfs3: Add a NFSv3 user mode server for use with runqemu
Quoted 17 lines · Phil Blundell
Quoted 5 lines · Jason Wessel
+++ b/meta/files/common-licenses/unfs3
meta/files/common-licenses/unfs3 new file +3
-0@@ -0,0 +1,24 @@ +UNFS3 user-space NFSv3 server +(C) 2003, Pascal Schmidt <[email protected]> +meta/files/common-licenses/unfs3 line 13
Quoted 10 lines
meta/files/common-licenses/unfs3 new file +10
-0+Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission.Isn't this just the 3-clause BSD licence?
Because it did not diff between the two (the words are different) I included the license.
It appears Pascal modified it ever so slightly. Perhaps legally they mean the same thing, but given I am not a lawyer I opted to include it.
-- The one from above
3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
--- vs BSD listed in YP
3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
There were other subtle changes too.
Quoted 15 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch line 8
Quoted 12 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +8
-0@@ -0,0 +1,158 @@ +Add ability to specify rcp port numbers + +In order to run more than one unfs server on a host system, you must +be able to specify alternate rpc port numbers. + +Jason Wessel <[email protected]> + +Upstream-Status: PendingI think you said in the cover letter that the patches had been sent upstream. If that's the case then it should be Upstream-Status:
Submitted.
Thanks, I'll make a v3, these are all submitted and pending upstream review.
Quoted 5 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch line 11
Quoted 3 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +3
-0+RDEPENDS_${PN} = "pseudo" +RDEPENDS_${PN}_class-native = "pseudo-native" +RDEPENDS_${PN}_class-nativesdk = "pseudo-nativesdk"That looks a bit odd. Are the latter two lines doing anything very useful?
The usnfs3 is useless without pseudo. The 2nd of the two might not be needed, but it had been there since the YP 1.3 days. For building the nativesdk and having a working unfs3 the 3rd one was required. I'll leave this in there for the v3.
Quoted 5 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch line 13
Quoted 3 lines
meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch new file +2
-0+# This recipe is intended for -native and -nativesdk builds only, +# not target installs:Why? If this is really the case, shouldn't it be named unfs3-native in the first place?
Now that the autoconf pieces are fixed in the v2, I can remove this restriction in v3. It does work on the target system now.
Jason.
Re: [PATCH v2 1/6] unfs3: Add a NFSv3 user mode server for use with runqemu
In reply to Jason WesselHi Jason,
We're seeing a parallel make race on the autobuilder and it seems its from this patch:
Quoted 32 lines · Jason Wessel
meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch new file +26
-0@@ -0,0 +1,36 @@ +Fix parallel build dependency issue + +If building with make -j2 the lib.a will not get built in time. + +Jason Wessel <[email protected]> + +Upstream-Status: Pending + +--- + Config/Makefile.in | 2 ++ + Makefile.in | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/Makefile.in ++++ b/Makefile.in +@@ -29,7 +29,8 @@ DESTDIR = + + VPATH = $(srcdir) + +-all: subdirs unfsd$(EXEEXT) ++all: subdirs ++ $(MAKE) unfsd$(EXEEXT) + + unfsd$(EXEEXT): $(OBJS) $(CONFOBJ) $(EXTRAOBJ) + $(CC) -o $@ $(OBJS) $(CONFOBJ) $(EXTRAOBJ) $(LDFLAGS) +--- a/Config/Makefile.in
meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch line 36
Quoted 10 lines
meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch new file +10
-0++++ b/Config/Makefile.in +@@ -16,6 +16,8 @@ lib.a: $(OBJS) + $(AR) crs lib.a $(OBJS) + + y.tab.h y.tab.c: $(srcdir)/exports.y ++ ++y.tab.c: $(srcdir)/exports.y + $(YACC) -d $(srcdir)/exports.y + + y.tab.o: y.tab.c $(srcdir)/exports.h $(top_srcdir)/nfs.h $(top_srcdir)/mount.h $(top_srcdir)/daemon.h
If you "cd Config; make lex.yy.o" you'll find it errors with y.tab.h not being found. The reason is the line added above, the y.tab.h dependency on running YACC is needed.
We're seeing this about once an autobuilder run, e.g.:
Can we drop this second part of the change?
Cheers,
Richard
Re: [PATCH v2 1/6] unfs3: Add a NFSv3 user mode server for use with runqemu
Quoted 4 lines · Richard Purdie
Hi Jason,
We're seeing a parallel make race on the autobuilder and it seems its from this patch:
You actually still need the patch or you get a different parallel build error with the lib file. I tracked down the regression from the original.
The original patch looks like:
Config/Makefile.in +3 -1
@@ -12,7 +12,9 @@ all: lib.a lib.a: $(OBJS) $(AR) crs lib.a $(OBJS) -y.tab.h y.tab.c: exports.y +y.tab.h: y.tab.c + +y.tab.c: exports.y $(YACC) -d exports.y
So I am thinking something was "lost in porting/translation". I'll send you a patch shortly. Thanks for the pointer to the build error.
Cheers,
Jason.
PATCH v2 2/6 unfs3, unfs-server: Replace all instances of unfs-server with unfs3
In reply to Jason WesselOther recipes dependencies and even some comments need to be updated for the removal of unfs-server and the replacement with unfs3. The unfs3 is a complete drop in replacement providing all the prior functionality of NFSv2 but also adding NFSv3.
[YOCTO #5639]
--- meta/conf/distro/include/seperatebuilddir.inc | 4 ++-- meta/recipes-core/meta/meta-ide-support.bb | 2 +- .../nativesdk-packagegroup-sdk-host.bb | 2 +- .../adt-installer/scripts/adt_installer_internal | 2 +- .../packagegroups/packagegroup-toolset-native.bb | 2 +- meta/site/ix86-common | 2 +- meta/site/x86_64-linux | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-)
meta/conf/distro/include/seperatebuilddir.inc +2 -2
@@ -528,7 +528,7 @@ B_pn-nativesdk-renderproto = "${SEPB}" B_pn-nativesdk-sqlite3 = "${SEPB}" B_pn-nativesdk-systemtap = "${SEPB}" # Not automake, no out of tree build support -#B_pn-nativesdk-unfs-server = "${SEPB}" +#B_pn-nativesdk-unfs3 = "${SEPB}" B_pn-nativesdk-util-macros = "${SEPB}" B_pn-nativesdk-xcb-proto = "${SEPB}" B_pn-nativesdk-xcmiscproto = "${SEPB}"
@@ -676,7 +676,7 @@ B_pn-tremor = "${SEPB}" B_pn-tslib = "${SEPB}" B_pn-udev = "${SEPB}" # Not automake, no out of tree build support -#B_pn-unfs-server-native = "${SEPB}" +#B_pn-unfs3-native = "${SEPB}" B_pn-usbutils = "${SEPB}" B_pn-util-linux = "${SEPB}" B_pn-util-linux-native = "${SEPB}"
meta/recipes-core/meta/meta-ide-support.bb +1 -1
@@ -4,7 +4,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -DEPENDS = "virtual/libc gdb-cross qemu-native qemu-helper-native unfs-server-native" +DEPENDS = "virtual/libc gdb-cross qemu-native qemu-helper-native unfs3-native" PR = "r3" inherit meta toolchain-scripts
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb +1 -1
@@ -15,7 +15,7 @@ RDEPENDS_${PN} = "\ nativesdk-qemu \ nativesdk-qemu-helper \ nativesdk-pseudo \ - nativesdk-unfs-server \ + nativesdk-unfs3 \ nativesdk-opkg \ nativesdk-libtool \ nativesdk-autoconf \
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +1 -1
@@ -146,7 +146,7 @@ fi if [ "$YOCTOADT_NFS_UTIL" == "Y" ] || [ "$YOCTOADT_NFS_UTIL" == "y" ]; then echo_info "\nInstalling unfs ..." - $OPKG_INSTALL_NATIVE_CMD nativesdk-unfs-server &>> $YOCTOADT_INSTALL_LOG_FILE + $OPKG_INSTALL_NATIVE_CMD nativesdk-unfs3 &>> $YOCTOADT_INSTALL_LOG_FILE check_result fi
meta/recipes-gnome/packagegroups/packagegroup-toolset-native.bb +1 -1
@@ -213,7 +213,7 @@ DEPENDS = "\ tiff-native \ tzcode-native \ u-boot-mkimage-native \ - unfs-server-native \ + unfs3-native \ unifdef-native \ unzip-native \ update-rc.d-native \
meta/site/ix86-common +1 -1
@@ -216,7 +216,7 @@ moz_cv_size_of_JS_BYTES_PER_DOUBLE=8 #ofono ac_cv_lib_c_signalfd=${ac_cv_lib_c_signalfd=yes} -#unfs-server +#unfs3 nfsd_cv_broken_setfsuid=${nfsd_cv_broken_setfsuid=0} nfsd_cv_func_statfs=${nfsd_cv_func_statfs=statfs2_bsize} nfsd_cv_bsd_signals=${nfsd_cv_bsd_signals=yes}
meta/site/x86_64-linux +1 -1
@@ -98,7 +98,7 @@ ac_cv_alignof_CORBA_wchar=2 lf_cv_sane_realloc=yes as_cv_unaligned_access=${as_cv_unaligned_access=yes} -#unfs-server +#unfs3 nfsd_cv_broken_setfsuid=${nfsd_cv_broken_setfsuid=0} nfsd_cv_func_statfs=${nfsd_cv_func_statfs=statfs2_bsize} nfsd_cv_bsd_signals=${nfsd_cv_bsd_signals=yes}
Signature · 1 line
1.7.9.5
Re: [PATCH v2 2/6] unfs3, unfs-server: Replace all instances of unfs-server with unfs3
meta/conf/distro/include/seperatebuilddir.inc B_pn-tremor = "${SEPB}" · line 679
Quoted 3 lines · Jason Wessel
# Not automake, no out of tree build support
meta/conf/distro/include/seperatebuilddir.inc +1
-1-#B_pn-unfs-server-native = "${SEPB}" +#B_pn-unfs3-native = "${SEPB}"
Is that still true? The unfs3 recipe makes it look like it does use autotools.
p.
Re: [PATCH v2 2/6] unfs3, unfs-server: Replace all instances of unfs-server with unfs3
Quoted 6 lines · Phil Blundell
meta/conf/distro/include/seperatebuilddir.inc B_pn-tremor = "${SEPB}" · line 679
Quoted 3 lines · Jason Wessel
# Not automake, no out of tree build support
meta/conf/distro/include/seperatebuilddir.inc +1
-1-#B_pn-unfs-server-native = "${SEPB}" +#B_pn-unfs3-native = "${SEPB}"Is that still true? The unfs3 recipe makes it look like it does use autotools.
With v1 no, with v2 yes. I had done a global search and replace. I would say we can dump these commented out lines.
Thanks,
Jason.
PATCH v2 3/6 runqemu: Use the newer unfs3 for serving user space nfs
In reply to Jason WesselFrom: Saul Wold <[email protected]>
This new version correctly handles the 64bit ext3 / ext4 issues we were seeing with the older unfs-server which did not handle 64bit file systems correctly, producing the duplicate cookies.
[YOCTO #5639]
--- scripts/runqemu-export-rootfs | 53 ++++------------------------------------- scripts/runqemu-internal | 2 +- 2 files changed, 6 insertions(+), 49 deletions(-)
scripts/runqemu-export-rootfs +5 -48
@@ -88,8 +88,7 @@ MOUNT_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] ## For debugging you would additionally add ## --debug all -MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r -P $MOUNT_PORT" -NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r" +UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFS_NFSPROG -n $NFS_PORT -y $NFS_MOUNTPROG -m $MOUNT_PORT" # Setup the exports file if [ "$1" = "start" ]; then
@@ -115,53 +114,18 @@ case "$1" in exit 1 fi - echo "Starting User Mode rpc.mountd" - echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS" - $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS - if [ ! $? = 0 ]; then - echo "=====================" - echo "Error starting MOUNTD" - echo "=====================" - if [ ! "x$RPCBIND_RUNNING" = "x" ] ; then - echo " If you see an error above that says:" - echo " RPC: Authentication error; why = Client credential too weak" - echo " You need to add the -i option when running rpcbind" - echo "===============================================" - echo "For recent Fedora/RedHat hosts:" - echo "Add RPCBIND_ARGS=-i to /etc/sysconfig/rpcbind" - echo " or" - echo "Add RPCBIND_OPTIONS=-i to /etc/sysconfig/rpcbind" - echo "Then run as root: /etc/init.d/rpcbind restart" - echo "===============================================" - echo "For recent Debian/Ubuntu hosts:" - echo "Add OPTIONS=\"-i -w\" to /etc/default/rpcbind" - echo "sudo service portmap restart" - fi - - exit 1 - fi - echo "Starting User Mode nfsd" - echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS" - $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS + echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/unfsd $UNFSD_OPTS" + $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/unfsd $UNFSD_OPTS if [ ! $? = 0 ]; then echo "Error starting nfsd" exit 1 fi - # Check to make sure everything started ok. - if [ ! -f $MOUNTPID ]; then - echo "rpc.mountd did not start correctly" - exit 1 - fi + Check to make sure everything started ok. if [ ! -f $NFSPID ]; then echo "rpc.nfsd did not start correctly" exit 1 fi - ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null - if [ ! $? = 0 ]; then - echo "rpc.mountd did not start correctly" - exit 1 - fi ps -fp `cat $NFSPID` > /dev/null 2> /dev/null if [ ! $? = 0 ]; then echo "rpc.nfsd did not start correctly"
@@ -169,16 +133,9 @@ case "$1" in fi echo " " echo "On your target please remember to add the following options for NFS" - echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp" + echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT" ;; stop) - if [ -f "$MOUNTPID" ]; then - echo "Stopping rpc.mountd" - kill `cat $MOUNTPID` - rm -f $MOUNTPID - else - echo "No PID file, not stopping rpc.mountd" - fi if [ -f "$NFSPID" ]; then echo "Stopping rpc.nfsd" kill `cat $NFSPID`
scripts/runqemu-internal +1 -1
@@ -308,7 +308,7 @@ if [ "$FSTYPE" = "nfs" ]; then NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ] NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] - UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,mountport=$MOUNTD_PORT" + UNFS_OPTS="nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT" PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo export PSEUDO_LOCALSTATEDIR
Signature · 1 line
1.7.9.5
PATCH v2 4/6 unfs-server: Remove unfs-server recipe and patches
In reply to Jason WesselThe unfs-server only supports NFS v2 and it is not useful any longer with the advent of 64 bit inodes and the fact that the server has only a 32 bit key for the NFS hash which is hardcoded back to the inode.
This recipe is replaced with a user mode NFS server using v3.
[YOCTO #5639]
--- .../001-2.2b47-2.2b51.patch | 2349 -------------------- .../unfs-server-2.1+2.2beta47/002-destdir.patch | 73 - .../unfs-server-2.1+2.2beta47/003-manpages.patch | 33 - .../unfs-server-2.1+2.2beta47/004-strsignal.patch | 53 - .../unfs-server-2.1+2.2beta47/005-sys-time.patch | 34 - .../unfs-server-2.1+2.2beta47/006-reiserfs.patch | 1277 ----------- .../unfs-server-2.1+2.2beta47/007-map.patch | 83 - .../unfs-server-2.1+2.2beta47/008-configure.patch | 18 - .../unfs-server-2.1+2.2beta47/009-multirw.patch | 20 - .../unfs-server-2.1+2.2beta47/010-realpath.patch | 35 - .../011-fno-strict-aliasing.patch | 18 - .../unfs-server-2.1+2.2beta47/012-nostrip.patch | 18 - .../unfs-server-2.1+2.2beta47/013-mntpathlen.patch | 37 - .../014-uninitialized.patch | 17 - .../unfs-server-2.1+2.2beta47/015-setattr.patch | 31 - .../016-makefile.in.patch | 19 - .../017-wrs-dynamic-rpc.patch | 263 --- .../018-remove-tcp-wrappers.patch | 25 - .../019-pid-before-fork.patch | 130 -- .../020-undefined-chmod-fix.patch | 23 - .../unfs-server-2.1+2.2beta47/021-nolibwrap.patch | 25 - .../022-add-close-on-exec-descriptors.patch | 66 - .../023-no-rpc-register.patch | 34 - .../unfs-server/unfs-server_2.1+2.2beta47.bb | 78 - 24 files changed, 4759 deletions(-) delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/001-2.2b47-2.2b51.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/002-destdir.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/003-manpages.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/004-strsignal.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/005-sys-time.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/006-reiserfs.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/007-map.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/008-configure.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/009-multirw.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/010-realpath.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/011-fno-strict-aliasing.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/012-nostrip.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/013-mntpathlen.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/014-uninitialized.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/015-setattr.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/016-makefile.in.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/017-wrs-dynamic-rpc.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/018-remove-tcp-wrappers.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/019-pid-before-fork.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/020-undefined-chmod-fix.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/021-nolibwrap.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/022-add-close-on-exec-descriptors.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/023-no-rpc-register.patch delete mode 100644 meta/recipes-devtools/unfs-server/unfs-server_2.1+2.2beta47.bb
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/001-2.2b47-2.2b51.patch deleted +0 -2349
@@ -1,2349 +0,0 @@ -Upstream-Status: Inappropriate [other] -Upstream is not making further releases of this software. - -Signed-off-by: Scott Garman <[email protected]> - -# 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 <[email protected]>. -+ -+Thu Dec 9 11:14:21 1999 -+ -+ * Fix handling of NFS-mounted and /proc directories. -+ They weren't properly hidden. -+ Thanks to Dick Streefland <[email protected]> -+ 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 <[email protected]> -+ -+ * 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_MOUNTLIST - AC_FSUSAGE -+AC_CHECK_LIB(wrap, main) - AC_LIBWRAP_BUG - AC_BSD_SIGNALS -+ -+dnl ************************************************************** -+dnl * Munge user specified options -+dnl ************************************************************** -+if test "$enable_new_inodes" = yes; then -+ AC_DEFINE(ENABLE_DEVTAB) -+fi -+if test "$enable_ugid_dynamic" = yes; then -+ AC_DEFINE(ENABLE_UGID_DAEMON) -+ UGIDD_PROG=\${rpcprefix}.ugidd -+ UGIDD_MAN=ugidd -+fi -+if test "$enable_ugid_nis" = yes; then -+ AC_DEFINE(ENABLE_UGID_NIS) -+fi -+if test "$enable_host_access" = yes; then -+ AC_DEFINE(HOSTS_ACCESS) -+fi -+if test "$enable_mount_logging" = yes; then -+ AC_DEFINE(WANT_LOG_MOUNTS) -+fi -+AC_DEFINE_UNQUOTED(EXPORTSOWNERUID, $with_exports_uid) -+AC_DEFINE_UNQUOTED(EXPORTSOWNERGID, $with_exports_gid) -+AC_SUBST(PATH_DEVTAB) -+AC_SUBST(UGIDD_PROG) -+AC_SUBST(UGIDD_MAN) -+ -+dnl ************************************************************** -+dnl * Output CFLAGS and LDFLAGS -+dnl ************************************************************** - AC_SUBST(LDFLAGS) - AC_SUBST(CFLAGS) -+ - AC_OUTPUT(Makefile) -diff -urN nfs-server-2.2beta47/daemon.c nfs-server-2.2beta51/daemon.c ---- nfs-server-2.2beta47/daemon.c Thu Jan 1 01:00:00 1970 -+++ nfs-server-2.2beta51/daemon.c Fri Nov 8 14:45:52 2002 -@@ -0,0 +1,270 @@ -+/* -+ * daemon.c -+ * -+ * Copyright (C) 1998, <[email protected]> -+ * -+ * Implements common daemon stuff and -+ * fail-safe mode for nfsd/mountd. -+ */ -+ -+#include "system.h" -+#include "logging.h" -+#include "signals.h" -+#include <sys/wait.h> -+ -+static const char * pidfilename = 0; -+static const char * get_signame(int signo); -+ -+/* -+ * Do the Crawley Thing -+ */ -+void -+daemonize(void) -+{ -+ int c; -+ -+ /* Ignore SIGHUP so the parent can exit while we're still -+ * in limbo */ -+ ignore_signal(SIGHUP); -+ -+ /* Now fork */ -+ c = fork(); -+ if (c < 0) -+ Dprintf(L_FATAL, "unable to fork: %s", strerror(errno)); -+ -+ /* Parent process: exit */ -+ if (c > 0) -+ exit(0); -+ -+ /* Do the session stuff */ -+ close(0); -+ close(1); -+ close(2); -+#ifdef HAVE_SETSID -+ setsid(); -+#else -+ if ((c = open("/dev/tty", O_RDWR)) >= 0) { -+ ioctl(c, TIOCNOTTY, (char *) NULL); -+ close(c); -+ } -+#endif -+ -+ /* Stop stderr logging */ -+ background_logging(); -+} -+ -+void -+setpidpath(const char *filename) -+{ -+ pidfilename = filename; -+} -+ -+void -+writepid(pid_t pid, int clear) -+{ -+ FILE *fp; -+ -+ fp = fopen(pidfilename, clear? "w" : "a"); -+ if (fp == NULL) -+ Dprintf(L_FATAL, "Unable to open %s: %m", pidfilename); -+ fprintf(fp, "%d\n", pid); -+ fclose(fp); -+ return; -+} -+ -+void -+failsafe(int level, int ncopies) -+{ -+ int *servers, running, child, i; -+ int pid, signo, status; -+ time_t last_restart = 0, now; -+ int restarts = 0, backoff = 60; -+ -+ servers = (int *) xmalloc(ncopies * sizeof(int)); -+ memset(servers, 0, ncopies * sizeof(int)); -+ -+ /* Loop forever, until we get SIGTERM */ -+ running = 0; -+ while (1) { -+ /* Rewrite the pidfile */ -+ writepid(getpid(), 1); -+ for (i = 0; i < ncopies; i++) { -+ if (servers[i] != 0) -+ writepid(servers[i], 0); -+ } -+ -+ while (running < ncopies) { -+ if ((now = time(NULL)) == last_restart) { -+ if (++restarts > 2 * ncopies) { -+ Dprintf(L_ERROR, -+ "Servers restarting too " -+ "quickly, backing off."); -+ if (backoff < 60 * 60) -+ backoff <<= 1; -+ sleep(backoff); -+ } -+ } else { -+ last_restart = now; -+ restarts = 0; -+ backoff = 60; -+ } -+ -+ /* Locate a free pid slot */ -+ for (i = 0, child = -1; i < ncopies; i++) { -+ if (servers[i] == 0) { -+ child = i; -+ break; -+ } -+ } -+ -+ if (child < 0) -+ Dprintf(L_FATAL, "failsafe: no pid slot?!"); -+ -+ Dprintf(D_GENERAL, -+ "starting server thread %d...\n", child + 1); -+ -+ pid = fork(); -+ if (pid < 0) -+ Dprintf(L_FATAL, -+ "Unable to fork for failsafe: %s", -+ strerror(errno)); -+ -+ if (pid == 0) { -+ /* Child process: continue with execution. */ -+ return; -+ } -+ -+ writepid(pid, 0); -+ servers[child] = pid; -+ running++; -+ } -+ -+ /* Ignore some signals */ -+ ignore_signal(SIGTERM); -+ ignore_signal(SIGHUP); -+ ignore_signal(SIGINT); -+ ignore_signal(SIGCHLD); -+ -+ if ((pid = wait(&status)) < 0) { -+ Dprintf((errno == ECHILD)? L_FATAL : L_WARNING, -+ "failsafe: wait(): %s", strerror(errno)); -+ continue; -+ } -+ -+ /* Locate the child */ -+ for (i = 0, child = -1; i < ncopies; i++) { -+ if (servers[i] == pid) { -+ child = i; -+ break; -+ } -+ } -+ -+ if (child < 0) { -+ Dprintf(L_WARNING, -+ "failsafe: unknown child (pid %d) terminated", -+ pid); -+ continue; -+ } -+ -+ /* Book-keeping */ -+ servers[child] = 0; -+ running--; -+ -+ if (WIFSIGNALED(status)) { -+ signo = WTERMSIG(status); -+ if (signo == SIGTERM) { -+ Dprintf(L_NOTICE, "failsafe: " -+ "child %d terminated by SIGTERM. %s.", -+ pid, running? "Continue" : "Exit"); -+ } else { -+ Dprintf(L_WARNING, "failsafe: " -+ "child %d terminated by %s. " -+ "Restarting.", -+ pid, get_signame(signo)); -+ child = -1; /* Restart */ -+ } -+ } else if (WIFEXITED(status)) { -+ Dprintf(L_NOTICE, "failsafe: " -+ "child %d exited, status %d.", -+ pid, WEXITSTATUS(status)); -+ } else { -+ Dprintf(L_ERROR, "failsafe: " -+ "abnormal child termination, " -+ "pid=%d status=%d. Restarting.", -+ pid, status); -+ child = -1; /* Restart */ -+ } -+ -+ /* If child >= 0, we should not restart */ -+ if (child >= 0) { -+ if (!running) { -+ Dprintf(D_GENERAL, -+ "No more children, exiting."); -+ exit(0); -+ } -+ for (i = child; i < ncopies-1; i++) -+ servers[i] = servers[i+1]; -+ ncopies--; /* Make sure we start no new servers */ -+ } -+ } -+} -+ -+/* -+ * Failsafe session, catch core file. -+ * -+ * Not yet implemented. -+ * General outline: we need to fork first, because nfsd changes -+ * uids frequently, and the kernel won't write out a core file after -+ * that. The forked proc starts out with a clean dumpable flag though. -+ * -+ * After the fork, we might want to make sure we end up in some common -+ * directory that the failsafe loop knows about. -+ */ -+void -+failsafe_loop(int level, void (*function)(void)) -+{ -+ /* NOP */ -+} -+ -+static const char * -+get_signame(int signo) -+{ -+ static char namebuf[30]; -+ -+ switch (signo) { -+ case SIGHUP: return "SIGHUP"; -+ case SIGINT: return "SIGINT"; -+ case SIGQUIT: return "SIGQUIT"; -+ case SIGILL: return "SIGILL"; -+ case SIGTRAP: return "SIGTRAP"; -+ case SIGIOT: return "SIGIOT"; -+ case SIGBUS: return "SIGBUS"; -+ case SIGFPE: return "SIGFPE"; -+ case SIGKILL: return "SIGKILL"; -+ case SIGUSR1: return "SIGUSR1"; -+ case SIGSEGV: return "SIGSEGV"; -+ case SIGUSR2: return "SIGUSR2"; -+ case SIGPIPE: return "SIGPIPE"; -+ case SIGALRM: return "SIGALRM"; -+ case SIGTERM: return "SIGTERM"; -+ case SIGCHLD: return "SIGCHLD"; -+ case SIGCONT: return "SIGCONT"; -+ case SIGSTOP: return "SIGSTOP"; -+ case SIGTSTP: return "SIGTSTP"; -+ case SIGTTIN: return "SIGTTIN"; -+ case SIGTTOU: return "SIGTTOU"; -+ case SIGURG: return "SIGURG"; -+ case SIGXCPU: return "SIGXCPU"; -+ case SIGXFSZ: return "SIGXFSZ"; -+ case SIGVTALRM: return "SIGVTALRM"; -+ case SIGPROF: return "SIGPROF"; -+ case SIGWINCH: return "SIGWINCH"; -+ case SIGIO: return "SIGIO"; -+#ifdef SIGPWR -+ case SIGPWR: return "SIGPWR"; -+#endif -+ } -+ -+ sprintf(namebuf, "signal #%d", signo); -+ return namebuf; -+} -diff -urN nfs-server-2.2beta47/daemon.h nfs-server-2.2beta51/daemon.h ---- nfs-server-2.2beta47/daemon.h Thu Jan 1 01:00:00 1970 -+++ nfs-server-2.2beta51/daemon.h Fri Nov 8 14:45:52 2002 -@@ -0,0 +1,18 @@ -+/* -+ * daemon.h -+ * -+ * Daemon support -+ */ -+ -+#ifndef CRAWLEY_H -+#define CRAWLEY_H -+ -+#define _PATH_NFSD_PIDFILE "/var/run/nfsd.pid" -+#define _PATH_MOUNTD_PIDFILE "/var/run/mountd.pid" -+ -+extern void daemonize(void); -+extern void setpidpath(const char *); -+extern void writepid(pid_t, int); -+extern void failsafe(int level, int ncopies); -+ -+#endif /* CRAWLEY_H */ -diff -urN nfs-server-2.2beta47/exports.man nfs-server-2.2beta51/exports.man ---- nfs-server-2.2beta47/exports.man Wed Nov 10 10:18:49 1999 -+++ nfs-server-2.2beta51/exports.man Fri Nov 8 14:45:36 2002 -@@ -45,6 +45,12 @@ - simultaneously. This is done by specifying an IP address and netmask pair - as - .IR address/netmask . -+.IP "world -+You can export a directory to the world (i.e. to all computers that -+are able to reach your NFS server network-wise) by using the empty -+hostname. When exporting to the world, the -+.BR root_squash ", " all_squash ", " ro " and " nosetuid -+options are turned on by default. - .TP - .B =public - This is a special ``hostname'' that identifies the given directory name -@@ -81,6 +87,12 @@ - by using the - .IR ro " option. - .TP -+.I setuid -+This allows clients to assert the setuid and setgid bits on regular -+files. For non-anonymous exports, this option is on by default. -+For anonymous exports, the default is -+.IR nosetuid . -+.TP - .I noaccess - This makes everything below the directory inaccessible for the named - client. This is useful when you want to export a directory hierarchy to -@@ -296,6 +308,22 @@ - .I /usr/X11R6 - entry apply. This is also true when the latter is a wildcard or netgroup - entry. -+.PP -+You should also be careful about where you place spaces in the -+exports file. For instance, the following may appear as if you've -+exported -+.BR /pub " readonly to host " foozle , -+but what this does in fact is export the directory to -+.B foozle -+with the default options, -+.I and -+export it to the world with the readonly option: -+.PP -+.nf -+.ta +3i -+# bad: export to the world -+/pub foozle (ro) -+.fi - .SH FILES - /etc/exports - .SH DIAGNOSTICS -diff -urN nfs-server-2.2beta47/fh.c nfs-server-2.2beta51/fh.c ---- nfs-server-2.2beta47/fh.c Wed Nov 10 10:41:14 1999 -+++ nfs-server-2.2beta51/fh.c Fri Nov 8 14:45:36 2002 -@@ -95,17 +95,14 @@ - static int fh_list_size; - static time_t curtime; - --#ifndef FOPEN_MAX --#define FOPEN_MAX 256 --#endif -- - #ifndef FHTRACE - #undef D_FHTRACE - #define D_FHTRACE D_FHCACHE - #endif - --static fhcache * fd_cache[FOPEN_MAX] = { NULL }; -+static fhcache ** fd_cache = NULL; - static int fd_cache_size = 0; -+static int fd_cache_max = 0; - - #ifndef NFSERR_INVAL /* that Sun forgot */ - #define NFSERR_INVAL 22 -@@ -141,10 +138,13 @@ - - /* Forward declared local functions */ - static psi_t path_psi(char *, nfsstat *, struct stat *, int); -+static psi_t path_psi_m(char *, nfsstat *, struct stat *, -+ struct stat *, int); - static int fh_flush_fds(void); - static char * fh_dump(svc_fh *); - static void fh_insert_fdcache(fhcache *fhc); - static void fh_unlink_fdcache(fhcache *fhc); -+static void fh_complain(const char *msg, fhcache *fhc); - - static void - fh_move_to_front(fhcache *fhc) -@@ -192,6 +192,13 @@ - static void - fh_insert_fdcache(fhcache *fhc) - { -+#ifdef FHTRACE -+ Dprintf(D_FHTRACE, "insert fh %x into fdcache @%d\n", fhc->h.psi, fhc->fd); -+ if (fhc->fd < 0) { -+ fh_complain("fd cache bug: bad fd", fhc); -+ return; -+ } -+#endif - if (fhc == fd_lru_head) - return; - if (fhc->fd_next || fhc->fd_prev) -@@ -203,9 +210,20 @@ - fhc->fd_next = fd_lru_head; - fd_lru_head = fhc; - -+ if (fhc->fd >= fd_cache_max) { -+ int oldmax = fd_cache_max, newmax; -+ -+ newmax = (fhc->fd + 8) & ~7; -+ fd_cache = (fhcache **) xrealloc(fd_cache, newmax * sizeof(fhcache *)); -+ memset(fd_cache + oldmax, 0, (newmax - oldmax) * sizeof(fhcache *)); -+ fd_cache_max = newmax; -+ } -+ - #ifdef FHTRACE - if (fd_cache[fhc->fd] != NULL) { -- Dprintf(L_ERROR, "fd cache inconsistency!\n"); -+ Dprintf(L_ERROR, "fd cache inconsistency (two fh's for same fd)"); -+ fh_complain("new fh", fhc); -+ fh_complain("old fh", fd_cache[fhc->fd]); - return; - } - #endif -@@ -225,7 +243,7 @@ - } else if (fd_lru_tail == fhc) { - fd_lru_tail = prev; - } else { -- Dprintf(L_ERROR, "fd cache inconsistency\n"); -+ fh_complain("fd cache inconsistency (no next and not at tail)", fhc); - return; - } - if (prev) { -@@ -233,13 +251,13 @@ - } else if (fd_lru_head == fhc) { - fd_lru_head = next; - } else { -- Dprintf(L_ERROR, "fd cache inconsistency\n"); -+ fh_complain("fd cache inconsistency (no prev and not at head)", fhc); - return; - } - - #ifdef FHTRACE - if (fd_cache[fhc->fd] != fhc) { -- Dprintf(L_ERROR, "fd cache inconsistency!\n"); -+ fh_complain("fd cache inconsistency (fd cache ptr mismatch)", fhc); - return; - } - #endif -@@ -285,7 +303,7 @@ - hash_slot = &((*hash_slot)->hash_next); - if (*hash_slot == NULL) - Dprintf(L_ERROR, -- "internal inconsistency -- fhc(%x) not in hash table\n", -+ "internal inconsistency -- fhc(%x) not in hash table!\n", - fhc); - else - *hash_slot = fhc->hash_next; -@@ -572,7 +590,7 @@ - efs_seekdir(dir, cookie_stack[i]); - while ((dp = efs_readdir(dir))) { - char *name = dp->d_name; -- int n = strlen(name); -+ int n = strlen(name); /* or: dp->d_reclen */ - - if (pathlen + n + 1 >= NFS_MAXPATHLEN - || (name[0] == '.' -@@ -738,7 +756,16 @@ - static psi_t - path_psi(char *path, nfsstat *status, struct stat *sbp, int svalid) - { -- struct stat sbuf; -+ struct stat smounted; -+ -+ return path_psi_m(path, status, sbp, &smounted, svalid); -+} -+ -+static psi_t -+path_psi_m(char *path, nfsstat *status, -+ struct stat *sbp, struct stat *mbp, int svalid) -+{ -+ struct stat sbuf, ddbuf; - - if (sbp == NULL) - sbp = &sbuf; -@@ -746,10 +773,10 @@ - *status = nfs_errno(); - return (0); - } -+ *mbp = *sbp; - if (S_ISDIR(sbp->st_mode) && strcmp(path, "/") != 0) { - /* Special case for directories--test for mount point. */ -- struct stat ddbuf; -- char *fname; -+ char *fname; - - /* Find start of last component of path. */ - #if 1 -@@ -819,6 +846,19 @@ - return (pseudo_inode(sbp->st_ino, sbp->st_dev)); - } - -+/* -+ * Match attributes to make sure we're still referring to the original file -+ */ -+static inline int -+fh_attrmatch(struct fhcache *fhc, struct stat *attr) -+{ -+ if (fhc->dev == attr->st_dev -+ && fhc->ino == attr->st_ino -+ && fhc->type == (attr->st_mode & S_IFMT)) -+ return 1; -+ return 0; -+} -+ - fhcache * - fh_find(svc_fh *h, int mode) - { -@@ -838,6 +878,9 @@ - ex_state = active; - time(&curtime); - while ((fhc = fh_lookup(h->psi)) != NULL) { -+ struct stat sbuf, *s = NULL; -+ nfsstat dummy; -+ - Dprintf(D_FHCACHE, "fh_find: psi=%lx... found '%s', fd=%d\n", - (unsigned long) h->psi, - fhc->path ? fhc->path : "<unnamed>", -@@ -857,33 +900,27 @@ - * If it doesn't try to rebuild the path. - */ - if (check) { -- struct stat *s = &fhc->attrs; -- psi_t psi; -- nfsstat dummy; -- -+ s = &sbuf; - if (efs_lstat(fhc->path, s) < 0) { - Dprintf(D_FHTRACE, - "fh_find: stale fh: lstat: %m\n"); - } else { -- fhc->flags |= FHC_ATTRVALID; -- /* If pseudo-inos don't match, we fhc->path -- * may be a mount point (hence lstat() returns -+ /* If device/ino don't match, fhc->path may -+ * be a mount point (hence lstat() returns - * a different inode number than the readdir() - * stuff used in path_psi) - */ -- psi = pseudo_inode(s->st_ino, s->st_dev); -- if (h->psi == psi) -+ if (fh_attrmatch(fhc, s)) - goto fh_return; - -- /* Try again by computing the path psi */ -- psi = path_psi(fhc->path, &dummy, s, 1); -- if (h->psi == psi) -+ /* Get the dev/ino of the underlying -+ * mount point. */ -+ path_psi(fhc->path, &dummy, s, 1); -+ if (fh_attrmatch(fhc, s)) - goto fh_return; - -- Dprintf(D_FHTRACE, "fh_find: stale fh: " -- "dev/ino %x/%lx psi %lx", -- s->st_dev, s->st_ino, -- (unsigned long) psi); -+ Dprintf(D_FHTRACE, "fh_find: stale fh: %lx", -+ (unsigned long) h->psi); - } - - fh_discard: -@@ -896,6 +933,12 @@ - } - - fh_return: -+ /* Valid attributes; cache them */ -+ if (s != NULL) { -+ memcpy(&fhc->attrs, s, sizeof(*s)); -+ fhc->flags |= FHC_ATTRVALID; -+ } -+ - /* The cached fh seems valid */ - if (fhc != fh_head.next) - fh_move_to_front(fhc); -@@ -905,7 +948,8 @@ - } - - Dprintf(D_FHCACHE, "fh_find: psi=%lx... not found\n", -- (unsigned long) h->psi); -+ (unsigned long) h->psi); -+ - if (mode == FHFIND_FCACHED) { - ex_state = inactive; - return NULL; -@@ -918,6 +962,7 @@ - fhc = flush->prev; - fh_delete(flush); - } -+ - fhc = (fhcache *) xmalloc(sizeof *fhc); - if (mode == FHFIND_FCREATE) { - /* File will be created */ -@@ -937,11 +982,31 @@ - } - fhc->path = path; - } -+ - fhc->flags = 0; - if (fhc->path && efs_lstat(fhc->path, &fhc->attrs) >= 0) { -- if (re_export && nfsmounted(fhc->path, &fhc->attrs)) -+ if (nfsmounted(fhc->path, &fhc->attrs)) { - fhc->flags |= FHC_NFSMOUNTED; -+#if 0 -+ /* We must allow the client to send us the -+ * file handle for the NFS mount point itself, -+ * but not for entries within an NFS mount. -+ * XXX: needs fixing. -+ */ -+ if (!re_export) { -+ Dprintf(D_FHTRACE, -+ "Attempt to use %s (non-exportable)\n", -+ fhc->path); -+ free(fhc); -+ ex_state = inactive; -+ return NULL; -+ } -+#endif -+ } - fhc->flags |= FHC_ATTRVALID; -+ fhc->dev = fhc->attrs.st_dev; -+ fhc->ino = fhc->attrs.st_ino; -+ fhc->type = fhc->attrs.st_mode & S_IFMT; - } - fhc->fd = -1; - fhc->last_used = curtime; -@@ -993,6 +1058,14 @@ - return buf; - } - -+static void -+fh_complain(const char *msg, fhcache *fhc) -+{ -+ Dprintf(L_ERROR, "%s: ptr=%p fd=%d path=%s\n", msg, -+ fhc, fhc->fd, -+ fhc->path? fhc->path : "<unnamed>"); -+} -+ - /* - * This routine is only used by the mount daemon. - * It creates the initial file handle. -@@ -1000,23 +1073,25 @@ - int - fh_create(nfs_fh *fh, char *path) - { -- svc_fh key; -- fhcache *h; -- psi_t psi; -- nfsstat status; -- char *s; -+ struct stat stb; -+ svc_fh key; -+ fhcache *h; -+ psi_t psi; -+ nfsstat status; -+ char *s; - - memset(&key, 0, sizeof(key)); - status = NFS_OK; -- if ((psi = path_psi("/", &status, NULL, 0)) == 0) -+ if ((psi = path_psi("/", &status, &stb, 0)) == 0) - return ((int) status); -+ - s = path; - while ((s = strchr(s + 1, '/')) != NULL) { - if (++(key.hash_path[0]) >= HP_LEN) - return ((int) NFSERR_NAMETOOLONG); - key.hash_path[key.hash_path[0]] = hash_psi(psi); - *s = '\0'; -- if ((psi = path_psi(path, &status, NULL, 0)) == 0) -+ if ((psi = path_psi(path, &status, &stb, 0)) == 0) - return ((int) status); - *s = '/'; - } -@@ -1024,7 +1099,7 @@ - if (++(key.hash_path[0]) >= HP_LEN) - return ((int) NFSERR_NAMETOOLONG); - key.hash_path[key.hash_path[0]] = hash_psi(psi); -- if ((psi = path_psi(path, &status, NULL, 0)) == 0) -+ if ((psi = path_psi(path, &status, &stb, 0)) == 0) - return ((int) status); - } - key.psi = psi; -@@ -1037,9 +1112,12 @@ - - /* assert(h != NULL); */ - if (h->path == NULL) { -- h->fd = -1; -- h->path = xstrdup(path); -+ h->fd = -1; -+ h->path = xstrdup(path); - h->flags = 0; -+ h->dev = stb.st_dev; -+ h->ino = stb.st_ino; -+ h->type = stb.st_mode & S_IFMT; - } - memcpy(fh, &key, sizeof(key)); - return ((int) status); -@@ -1064,6 +1142,44 @@ - return ((nfs_fh*)&(h->h)); - } - -+ -+static inline int -+access_override(int omode, int perm, struct stat *buf) -+{ -+ /* Be suspicous of flags, particularly O_CREAT/O_TRUNC. A previous -+ * comment said: -+ * -+ * "[Not checking this] would truncate read-only files on creat() -+ * calls. Of course, ftruncate(fd, 0) should still be legal for -+ * the user when the file was chmoded *after* opening it, but we -+ * have no way to tell, and a semi-succeding `cp foo readonly-file' -+ * is much more unintuitive and destructive than a failing -+ * ftruncate()." -+ */ -+ if (omode & ~O_ACCMODE) -+ return 0; -+ -+ /* Users can do anything to their own files. Harmless (since they -+ * could chown anyway), and helps to mask NFSes statelessness. -+ * -+ * (in passing, this also handles mode 0100 execution) -+ */ -+ if (buf->st_uid == auth_uid) -+ return 1; -+ -+ /* Henceforth, we are considering granting read access to facilitate -+ * exec access. This is read only */ -+ if (omode != O_RDONLY) -+ return 0; -+ -+ /* Mode 0110 execution */ -+ if (buf->st_gid == auth_gid) -+ return (buf->st_mode & S_IXGRP) != 0; -+ -+ /* Mode 0111 execution */ -+ return (buf->st_mode & S_IXOTH) != 0; -+} -+ - int - path_open(char *path, int omode, int perm) - { -@@ -1113,30 +1229,15 @@ - * lishes two things: first, it gives the file owner r/w access to - * the file whatever the permissions are, so that files are still - * accessible after an fchown(fd, 0). The second part of the -- * condition allows read access to mode 0111 executables. -- * -- * The old conditon read like this: -- * if (fd < 0 && oerrno == EACCES) { -- * if (oerrno == EACCES && (buf.st_uid == auth_uid -- * || (omode == O_RDONLY && (buf.st_mode & S_IXOTH)))) { -- * override uid; etc... -- * } -- * } -- * This would truncate read-only files on creat() calls. Now -- * ftruncate(fd, 0) should still be legal for the user when the -- * file was chmoded *after* opening it, but we have no way to tell, -- * and a semi-succeding `cp foo readonly-file' is much more -- * unintuitive and destructive than a failing ftruncate(). -+ * condition allows read access to `execute-only' files. - */ -- if (fd < 0 && oerrno == EACCES && !(omode & (O_CREAT|O_TRUNC))) { -- if ((buf.st_uid == auth_uid && (omode & O_ACCMODE) == omode) -- || ((buf.st_mode & S_IXOTH) && omode == O_RDONLY)) { -- auth_override_uid(ROOT_UID); -- fd = efs_open(path, omode, perm); -- oerrno = errno; -- auth_override_uid(auth_uid); -- } -+ if (fd < 0 && oerrno == EACCES && access_override(omode, perm, &buf)) { -+ auth_override_uid(ROOT_UID); -+ fd = efs_open(path, omode, perm); -+ oerrno = errno; -+ auth_override_uid(auth_uid); - } -+ - - if (fd < 0) { - Dprintf(D_FHCACHE, -@@ -1241,7 +1342,7 @@ - char *sindx; - int is_dd; - nfsstat ret; -- struct stat sbuf; -+ struct stat sbuf, smount; - char pathbuf[PATH_MAX + NAME_MAX + 1], *fname; - - /* should not happen */ -@@ -1318,7 +1419,7 @@ - - *new_fh = dopa->dir; - key = (svc_fh *) new_fh; -- if ((key->psi = path_psi(pathbuf, &ret, sbp, 0)) == 0) -+ if ((key->psi = path_psi_m(pathbuf, &ret, sbp, &smount, 0)) == 0) - return (ret); - - if (is_dd) { -@@ -1344,6 +1445,10 @@ - h->h.hash_path[0]); - return NFSERR_STALE; - } -+ if (sbp->st_dev != smount.st_dev) { -+ Dprintf(D_FHTRACE, "fh_compose: %s hit%s mount point\n", -+ pathbuf, nfsmounted(pathbuf, &smount)? " NFS" : ""); -+ } - #endif - - /* New code added by Don Becker */ -@@ -1356,7 +1461,8 @@ - if (!h) return NFSERR_STALE; - #endif - if (h->path) -- Dprintf(L_ERROR, "Internal inconsistency: double entry (path '%s', now '%s').\n", -+ Dprintf(L_ERROR, -+ "internal inconsistency: double entry (path '%s', now '%s').\n", - h->path, pathbuf); - } - Dprintf(D_FHCACHE, "fh_compose: using handle %x ('%s', fd=%d)\n", -@@ -1365,9 +1471,18 @@ - - /* assert(h != NULL); */ - if (h->path == 0) { -- h->path = xstrdup(pathbuf); -+ h->path = xstrdup(pathbuf); - h->flags = 0; -- if (!re_export && nfsmounted(pathbuf, sbp)) -+ h->dev = sbp->st_dev; -+ h->ino = sbp->st_ino; -+ h->type = sbp->st_mode & S_IFMT; -+ -+ /* Note: in the case of a mount point, -+ * sbp contains the stats of the mount point, while -+ * ddbuf has the dev/ino of the underlying directory -+ */ -+ if (sbp->st_dev != smount.st_dev -+ && nfsmounted(pathbuf, &smount)) - h->flags |= FHC_NFSMOUNTED; - #ifdef FHTRACE - Dprintf(D_FHTRACE, "fh_compose: created handle %s\n", h->path); -diff -urN nfs-server-2.2beta47/fh.h nfs-server-2.2beta51/fh.h ---- nfs-server-2.2beta47/fh.h Mon Nov 23 12:15:43 1998 -+++ nfs-server-2.2beta51/fh.h Fri Nov 8 14:45:36 2002 -@@ -97,7 +97,13 @@ - struct fhcache * hash_next; - struct fhcache * fd_next; - struct fhcache * fd_prev; -+ -+ /* These are fixed during the lifetime of this object */ - svc_fh h; -+ dev_t dev; -+ ino_t ino; -+ mode_t type; /* st_mode & S_IFMT */ -+ - int fd; - int omode; - char * path; -diff -urN nfs-server-2.2beta47/getattr.c nfs-server-2.2beta51/getattr.c ---- nfs-server-2.2beta47/getattr.c Fri Oct 30 18:10:11 1998 -+++ nfs-server-2.2beta51/getattr.c Fri Nov 8 14:45:36 2002 -@@ -115,6 +115,16 @@ - attr->fsid = 1; - attr->fileid = fh_psi((nfs_fh *)&(fhc->h)); - #endif -+ -+ /* This may be needed by some Suns... testing */ -+#define MINTIME (24 * 2600) -+ if (s->st_atime < MINTIME) -+ s->st_atime = MINTIME; -+ if (s->st_mtime < MINTIME) -+ s->st_mtime = MINTIME; -+ if (s->st_ctime < MINTIME) -+ s->st_ctime = MINTIME; -+ - attr->atime.seconds = s->st_atime; - attr->atime.useconds = 0; - attr->mtime.seconds = s->st_mtime; -diff -urN nfs-server-2.2beta47/logging.c nfs-server-2.2beta51/logging.c ---- nfs-server-2.2beta47/logging.c Fri Oct 30 17:11:22 1998 -+++ nfs-server-2.2beta51/logging.c Fri Nov 8 14:45:36 2002 -@@ -147,8 +147,9 @@ - (void) time(&now); - tm = localtime(&now); - fprintf(log_fp, "%s %02d/%02d/%02d %02d:%02d %s", -- log_name, tm->tm_mon + 1, tm->tm_mday, tm->tm_year, -- tm->tm_hour, tm->tm_min, buff); -+ log_name, tm->tm_mon + 1, tm->tm_mday, -+ tm->tm_year % 100, -+ tm->tm_hour, tm->tm_min, buff); - if (strchr(buff, '\n') == NULL) - fputc('\n', log_fp); - } -@@ -182,7 +183,8 @@ - tm = localtime(&unix_cred->aup_time); - snprintf(buffer + len, total - len, - "%d/%d/%d %02d:%02d:%02d %s %d.%d", -- tm->tm_year, tm->tm_mon + 1, tm->tm_mday, -+ tm->tm_year %100, -+ tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec, - unix_cred->aup_machname, - unix_cred->aup_uid, -diff -urN nfs-server-2.2beta47/mountd.c nfs-server-2.2beta51/mountd.c ---- nfs-server-2.2beta47/mountd.c Wed Jun 2 14:10:33 1999 -+++ nfs-server-2.2beta51/mountd.c Fri Nov 8 14:45:36 2002 -@@ -32,7 +32,7 @@ - #include "rpcmisc.h" - #include "rmtab.h" - #include "haccess.h" --#include "failsafe.h" -+#include "daemon.h" - #include "signals.h" - #include <rpc/pmap_clnt.h> - -@@ -44,6 +44,8 @@ - /* - * Option table for mountd - */ -+#define OPT_NOTCP 300 -+#define OPT_LOOPBACK 301 - static struct option longopts[] = - { - { "debug", required_argument, 0, 'd' }, -@@ -56,6 +58,8 @@ - { "no-spoof-trace", 0, 0, 't' }, - { "version", 0, 0, 'v' }, - { "fail-safe", optional_argument, 0, 'z' }, -+ { "no-tcp", 0, 0, OPT_NOTCP }, -+ { "loopback-only", 0, 0, OPT_LOOPBACK }, - - { NULL, 0, 0, 0 } - }; -@@ -358,6 +362,12 @@ - break; - case 0: - break; -+ case OPT_NOTCP: -+ udp_only = 1; -+ break; -+ case OPT_LOOPBACK: -+ loopback_only = 1; -+ break; - case '?': - default: - usage(stderr, 1); -@@ -384,38 +394,27 @@ - /* Create services and register with portmapper */ - rpc_init("mountd", MOUNTPROG, mountd_versions, mount_dispatch, port, 0); - -- if (!foreground && !_rpcpmstart) { --#ifndef RPC_SVC_FG -- /* We first fork off a child. */ -- if ((c = fork()) > 0) -- exit(0); -- if (c < 0) { -- Dprintf(L_FATAL, "mountd: cannot fork: %s\n", -- strerror(errno)); -- } -- /* No more logging to stderr */ -- background_logging(); -+ if (_rpcpmstart) { -+ /* Always foreground mode */ -+ foreground = 1; - -- /* Now we remove ourselves from the foreground. */ -- (void) close(0); -- (void) close(1); -- (void) close(2); --#ifdef TIOCNOTTY -- if ((c = open("/dev/tty", O_RDWR)) >= 0) { -- (void) ioctl(c, TIOCNOTTY, (char *) NULL); -- (void) close(c); -- } --#else -- setsid(); --#endif --#endif /* not RPC_SVC_FG */ -+ /* ... but no logging */ -+ background_logging(); - } - -+ /* Become a daemon */ -+ if (!foreground) -+ daemonize(); -+ - /* Initialize the FH module. */ - fh_init(); - - /* Initialize the AUTH module. */ - auth_init(auth_file); -+ -+ /* Write pidfile */ -+ setpidpath(_PATH_MOUNTD_PIDFILE); -+ writepid(getpid(), 1); - - /* Failsafe mode */ - if (failsafe_level) -diff -urN nfs-server-2.2beta47/mountd.man nfs-server-2.2beta51/mountd.man ---- nfs-server-2.2beta47/mountd.man Wed Jun 2 14:12:21 1999 -+++ nfs-server-2.2beta51/mountd.man Fri Nov 8 14:45:36 2002 -@@ -14,6 +14,8 @@ - .B "[\ \-\-allow\-non\-root\ ]" - .B "[\ \-\-re\-export\ ]" - .B "[\ \-\-no\-spoof\-trace\ ]" -+.B "[\ \-\-no\-tcp ]" -+.B "[\ \-\-loopback\-only ]" - .B "[\ \-\-version\ ]" - .ad b - .SH DESCRIPTION -@@ -123,6 +125,18 @@ - .TP - .BR \-v " or " \-\-version - Report the current version number of the program. -+.TP -+.BR \-\-no\-tcp -+Force -+.I mountd -+to register only the UDP transport, but no TCP. -+This is an experimental option. -+.TP -+.BR \-\-loopback\-only -+Force -+.I mountd -+to bind to the loopback interface. -+This is an experimental option. - .SS Access Control - For enhanced security, access to - .I mountd -diff -urN nfs-server-2.2beta47/nfsd.c nfs-server-2.2beta51/nfsd.c ---- nfs-server-2.2beta47/nfsd.c Wed Nov 10 10:33:28 1999 -+++ nfs-server-2.2beta51/nfsd.c Fri Nov 8 14:45:36 2002 -@@ -21,7 +21,7 @@ - #include "getopt.h" - #include "fsusage.h" - #include "rpcmisc.h" --#include "failsafe.h" -+#include "daemon.h" - #include "signals.h" - #ifdef __linux__ /* XXX - MvS: for UNIX sockets. */ - # include <sys/un.h> -@@ -30,7 +30,6 @@ - # include <syslog.h> - #endif - --#define MULTIPLE_SERVERS - - /* Flags for auth_fh */ - #define CHK_READ 0 -@@ -51,6 +50,8 @@ - /* - * Option table - */ -+#define OPT_NOTCP 300 -+#define OPT_LOOPBACK 301 - static struct option longopts[] = { - { "auth-deamon", required_argument, 0, 'a' }, - { "debug", required_argument, 0, 'd' }, -@@ -68,6 +69,9 @@ - { "version", 0, 0, 'v' }, - { "no-cross-mounts", 0, 0, 'x' }, - { "fail-safe", optional_argument, 0, 'z' }, -+ { "no-tcp", 0, 0, OPT_NOTCP }, -+ { "udp-only", 0, 0, OPT_NOTCP }, -+ { "loopback-only", 0, 0, OPT_LOOPBACK }, - - { NULL, 0, 0, 0 } - }; -@@ -173,7 +177,10 @@ - return NULL; - } - -- auth_user(nfsmount, rqstp); -+ if (!auth_user(nfsmount, rqstp)) { -+ *statp = NFSERR_ACCES; -+ return NULL; -+ } - - *statp = NFS_OK; - return fhc; -@@ -211,7 +218,11 @@ - - if ((nfsmount = auth_path(nfsclient, rqstp, path)) == NULL) - return NFSERR_ACCES; -- auth_user(nfsmount, rqstp); -+ -+ /* XXX: really need to call it again here? -+ * Already invoked in auth_fh */ -+ if (!auth_user(nfsmount, rqstp)) -+ return NFSERR_ACCES; - - return (NFS_OK); - } -@@ -575,7 +586,8 @@ - #endif - - /* MvS: Some clients use chardev 0xFFFF for a FIFO. */ -- if (S_ISCHR(argp->attributes.mode) && dev == 0xFFFF) { -+ if (S_ISCHR(argp->attributes.mode) -+ && (dev == 0xFFFF || dev == (dev_t) -1)) { - is_borc = 0; - dev = 0; - argp->attributes.mode &= ~S_IFMT; -@@ -623,7 +635,7 @@ - flags = (argp->attributes.size == 0 ? - CREATE_OMODE | O_TRUNC : CREATE_OMODE); - if (!exists) -- flags |= O_CREAT; -+ flags |= O_CREAT|O_EXCL; - tmpfd = path_open(pathbuf, flags, - argp->attributes.mode & ~S_IFMT); - if (tmpfd < 0) -@@ -965,9 +977,7 @@ - int nfsport = 0; - int failsafe_level = 0; - int c; --#ifdef MULTIPLE_SERVERS - int i, ncopies = 1; --#endif - - program_name = argv[0]; - chdir("/"); -@@ -1031,12 +1041,17 @@ - break; - case 0: - break; -+ case OPT_NOTCP: -+ udp_only = 1; -+ break; -+ case OPT_LOOPBACK: -+ loopback_only = 1; -+ break; - case '?': - default: - usage(stderr, 1); - } - --#ifdef MULTIPLE_SERVERS - if (optind == argc-1 && isdigit(argv[optind][0])) { - ncopies = atoi(argv[optind++]); - if (ncopies <= 0) { -@@ -1051,7 +1066,6 @@ - ncopies = 1; - } - } --#endif - - /* No more arguments allowed. */ - if (optind != argc) -@@ -1075,72 +1089,54 @@ - rpc_init("nfsd", NFS_PROGRAM, nfsd_versions, nfs_dispatch, - nfsport, NFS_MAXDATA); - -- /* No more than 1 copy when run from inetd */ -- if (_rpcpmstart && ncopies > 1) { -- Dprintf(L_WARNING, -- "nfsd: warning: can run only " -- "one server in inetd mode\n"); -- ncopies = 1; -+ if (_rpcpmstart) { -+ /* Always do foreground mode */ -+ foreground = 1; -+ -+ /* ... but don't log to stderr */ -+ background_logging(); -+ -+ /* No more than 1 copy when run from inetd */ -+ if (ncopies > 1) { -+ Dprintf(L_WARNING, -+ "nfsd: warning: can run only " -+ "one server in inetd mode\n"); -+ ncopies = 1; -+ } - } - --#ifndef MULTIPLE_SERVERS_READWRITE - if (ncopies > 1) - read_only = 1; --#endif - -- /* We first fork off a child. */ -- if (!foreground) { -- if ((c = fork()) > 0) -- exit(0); -- if (c < 0) { -- Dprintf(L_FATAL, "nfsd: cannot fork: %s\n", -- strerror(errno)); -- } -- } -+ /* -+ * We first fork off a child and detach from tty -+ */ -+ if (!foreground) -+ daemonize(); - - /* Initialize the AUTH module. */ - auth_init(auth_file); - -+ setpidpath(_PATH_NFSD_PIDFILE); - if (failsafe_level == 0) { - /* Start multiple copies of the server */ -+ writepid(getpid(), 1); - for (i = 1; i < ncopies; i++) { -+ pid_t pid; -+ - Dprintf(D_GENERAL, "Forking server thread...\n"); -- if ((c = fork()) < 0) { -+ if ((pid = fork()) < 0) { - Dprintf(L_ERROR, "Unable to fork: %s", - strerror(errno)); -- } else if (c == 0) { -- /* Child process */ -- break; -+ } else if (pid != 0) { -+ writepid(pid, 0); -+ } else { -+ break; /* Child process */ - } - } - } else { - /* Init for failsafe mode */ - failsafe(failsafe_level, ncopies); -- } -- -- /* Now that we've done all the required forks, we make do all the -- * session magic. -- */ -- if (!foreground) { -- /* No more logging to stderr */ -- background_logging(); -- -- /* Now we remove ourselves from the foreground. */ -- close(0); -- close(1); -- close(2); --#ifdef HAVE_SETSID -- setsid(); --#else -- { -- int fd; -- -- if ((fd = open("/dev/tty", O_RDWR)) >= 0) { -- ioctl(fd, TIOCNOTTY, (char *) NULL); -- close(fd); -- } -- } --#endif - } - - /* -diff -urN nfs-server-2.2beta47/nfsd.man nfs-server-2.2beta51/nfsd.man ---- nfs-server-2.2beta47/nfsd.man Wed Jun 2 14:13:37 1999 -+++ nfs-server-2.2beta51/nfsd.man Fri Nov 8 14:45:36 2002 -@@ -8,7 +8,7 @@ - .B "[\ \-d\ facility\ ]" - .B "[\ \-P\ port\ ]" - .B "[\ \-R\ dirname\ ]" --.B "[\ \-Fhlnprstv\ ]" -+.B "[\ \-Fhlnprstuv\ ]" - .B "[\ \-\-debug\ facility\ ]" - .B "[\ \-\-exports\-file=file\ ]" - .B "[\ \-\-foreground\ ]" -@@ -18,6 +18,8 @@ - .B "[\ \-\-public\-root\ dirname\ ]" - .\".B "[\ \-\-synchronous\-writes\ ]" - .B "[\ \-\-no\-spoof\-trace\ ]" -+.B "[\ \-\-no\-tcp ]" -+.B "[\ \-\-loopback-only ]" - .B "[\ \-\-port\ port\ ]" - .B "[\ \-\-log-transfers\ ]" - .B "[\ \-\-version\ ]" -@@ -56,7 +58,7 @@ - .PP - When run from - .IR inetd , --.i nfsd -+.I nfsd - will terminate after a certain period of inactivity. - .SH OPTIONS - .TP -@@ -167,6 +169,14 @@ - .BR \-v " or " \-\-version - Report the current version number of the program. - .TP -+.BR \-\-no\-tcp -+Force nfsd to only register a UDP transport, but not TCP. -+This is an experimental option. -+.TP -+.BR \-\-loopback\-only -+Force nfsd to bind to the loopback interface. -+This is an experimental option. -+.TP - .BR numcopies - This is an experimental feature that lets you run several instances of - .I nfsd -@@ -174,15 +184,8 @@ - .B numcopies - greater than one, - .I nfsd --will fork as many times as specified by this value. --However, the servers do not share a common file handle --cache, which makes certain file operations impossible. --.IP --For this reason, --.I nfsd --will disallow all write operations when invoked with this option. Although --this is very limiting, this feature may still prove useful for exporting --public FTP areas or Usenet News spools. -+will fork as many times as specified by this value so it is able to -+handle that many NFS requests in parallel. - .SS WebNFS Support - WebNFS is an extension to the normal NFS protocol developed by Sun - that is particularly well-suited for file retrieval over the -@@ -268,6 +271,19 @@ - .I nfsd - writes out a transfer record whenever it encounters a READ or WRITE - request at offset zero. -+.SS Generating a debug trace -+When suspecting a bug in nfsd, it is helpful to look at a debug trace -+of what's going on. You can create such a trace by first killing nfsd, -+and then restarting it as -+.PP -+.nf -+.ta +3i -+/usr/sbin/rpc.nfsd -F -d all -+.fi -+.PP -+Instead of -+.BR all , -+you can use less verbose debug facilities as described above. - .SH "SEE ALSO" - exports(5), mountd(8), ugidd(8C) - .SH AUTHORS -diff -urN nfs-server-2.2beta47/rmtab.c nfs-server-2.2beta51/rmtab.c ---- nfs-server-2.2beta47/rmtab.c Fri Feb 6 09:43:25 1998 -+++ nfs-server-2.2beta51/rmtab.c Fri Nov 8 14:45:36 2002 -@@ -8,6 +8,7 @@ - - #include "nfsd.h" - #include "rmtab.h" -+#include "rpcmisc.h" - - static char * rmtab_gethost(struct svc_req *); - static int rmtab_insert(char *, char *); -diff -urN nfs-server-2.2beta47/rpcmisc.c nfs-server-2.2beta51/rpcmisc.c ---- nfs-server-2.2beta47/rpcmisc.c Tue Sep 7 10:42:58 1999 -+++ nfs-server-2.2beta51/rpcmisc.c Fri Nov 8 14:45:36 2002 -@@ -39,6 +39,8 @@ - int _rpcfdtype = 0; - int _rpcsvcdirty = 0; - const char * auth_daemon = 0; -+int udp_only = 0; -+int loopback_only = 0; - - #ifdef AUTH_DAEMON - static bool_t (*tcp_rendevouser)(SVCXPRT *, struct rpc_msg *); -@@ -96,7 +98,7 @@ - } - } - -- if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) { -+ if ((_rpcfdtype == 0 && !udp_only) || (_rpcfdtype == SOCK_STREAM)) { - if (_rpcfdtype == 0 && defport != 0) - sock = makesock(defport, IPPROTO_TCP, bufsiz); - transp = svctcp_create(sock, 0, 0); -@@ -199,6 +201,9 @@ - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; - sin.sin_port = htons(port); -+ -+ if (loopback_only) -+ sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - #ifdef DEBUG - { -diff -urN nfs-server-2.2beta47/rpcmisc.h nfs-server-2.2beta51/rpcmisc.h ---- nfs-server-2.2beta47/rpcmisc.h Tue Sep 7 10:37:38 1999 -+++ nfs-server-2.2beta51/rpcmisc.h Fri Nov 8 14:45:36 2002 -@@ -9,6 +9,8 @@ - extern int _rpcpmstart; - extern int _rpcfdtype; - extern int _rpcsvcdirty; -+extern int udp_only; -+extern int loopback_only; - extern const char * auth_daemon; - - extern void rpc_init(const char *name, int prog, int *verstbl, -@@ -16,5 +18,13 @@ - int defport, int bufsize); - extern void rpc_exit(int prog, int *verstbl); - extern void rpc_closedown(void); -+ -+/* -+ * Some older systems don't have svc_getcaller. -+ * Some, like glibc 2.2, have it but it returns some type that's -+ * not a sockaddr_in anymore. -+ */ -+#undef svc_getcaller -+#define svc_getcaller(xprt) ((struct sockaddr_in *) (&(xprt)->xp_raddr)) - - #endif /* RPCMISC_H */ -diff -urN nfs-server-2.2beta47/setattr.c nfs-server-2.2beta51/setattr.c ---- nfs-server-2.2beta47/setattr.c Fri Oct 30 18:29:42 1998 -+++ nfs-server-2.2beta51/setattr.c Fri Nov 8 14:45:36 2002 -@@ -103,6 +103,10 @@ - if (flags & SATTR_CHMOD) { - unsigned int mode = attr->mode; - -+ /* If setuid is not allowed, silently squash them */ -+ if (!nfsmount->o.allow_setuid && S_ISREG(s->st_mode)) -+ mode &= ~(S_ISUID|S_ISGID) | s->st_mode; -+ - if (mode != -1 && mode != 0xFFFF /* ultrix bug */ - && (mode & 07777) != (s->st_mode & 07777)) { - if (efs_chmod(path, mode) < 0) -diff -urN nfs-server-2.2beta47/showmount.c nfs-server-2.2beta51/showmount.c ---- nfs-server-2.2beta47/showmount.c Wed Jun 12 22:31:04 1996 -+++ nfs-server-2.2beta51/showmount.c Fri Nov 8 14:45:36 2002 -@@ -162,17 +162,13 @@ - break; - } - -- if (hostname[0] >= '0' && hostname[0] <= '9') { -- server_addr.sin_family = AF_INET; -- server_addr.sin_addr.s_addr = inet_addr(hostname); -- } -- else { -+ server_addr.sin_family = AF_INET; -+ if (!inet_aton(hostname, &server_addr.sin_addr)) { - if ((hp = gethostbyname(hostname)) == NULL) { - fprintf(stderr, "%s: can't get address for %s\n", - program_name, hostname); - exit(1); - } -- server_addr.sin_family = AF_INET; - memcpy(&server_addr.sin_addr, hp->h_addr, hp->h_length); - } - -diff -urN nfs-server-2.2beta47/site.h.in nfs-server-2.2beta51/site.h.in ---- nfs-server-2.2beta47/site.h.in Thu Jan 1 01:00:00 1970 -+++ nfs-server-2.2beta51/site.h.in Fri Nov 8 14:45:57 2002 -@@ -0,0 +1,50 @@ -+/* -+ * Site-specific configuration options generated by BUILD. -+ * Please do not edit. -+ */ -+ -+/* -+ * If ENABLE_DEVTAB is defined, nfsd will use the new inode -+ * number generation scheme for avoiding inode number clashes -+ * on big hard disks. -+ */ -+#undef ENABLE_DEVTAB -+ -+/* -+ * If MULTIPLE_SERVER_READWRITE is defined, you will be able -+ * to run several nfsd process in parallel servicing all NFS -+ * requests. -+ */ -+#define MULTIPLE_SERVERS_READWRITE -+ -+/* -+ * If ENABLE_UGID_DAEMON is defined, the real rpc.ugidd is built, -+ * nfsd is built to support ugidd queries. -+ * Otherwise, a dummy program is created -+ */ -+#undef ENABLE_UGID_DAEMON -+ -+/* -+ * If ENABLE_UGID_NIS is defined, nfsd will support user mapping -+ * vie the client's NIS server. -+ */ -+#undef ENABLE_UGID_NIS -+ -+/* -+ * if HOSTS_ACCESS is defined, ugidd uses host access control -+ * provided by libwrap.a from tcp_wrappers -+ */ -+#define HOSTS_ACCESS -+ -+/* -+ * Define correct ownership of export control file -+ */ -+#define EXPORTSOWNERUID 0 -+#define EXPORTSOWNERGID 0 -+ -+/* -+ * If WANT_LOG_MOUNTS is defined, every mount request will be logged -+ * to syslogd with the name of source site and a path that was -+ * it requested -+ */ -+#define WANT_LOG_MOUNTS -diff -urN nfs-server-2.2beta47/ugidd.c nfs-server-2.2beta51/ugidd.c ---- nfs-server-2.2beta47/ugidd.c Wed Dec 10 12:34:16 1997 -+++ nfs-server-2.2beta51/ugidd.c Fri Nov 8 14:45:36 2002 -@@ -43,9 +43,7 @@ - }; - - int --main(argc, argv) --int argc; --char **argv; -+main(int argc, char **argv) - { - SVCXPRT *transp; - int c, longind; -@@ -92,32 +90,11 @@ - exit(1); - } - -- if (!foreground) { -- if ((c = fork()) > 0) -- exit(0); -- if (c < 0) { -- fprintf(stderr, "ugidd: cannot fork: %s\n", -- strerror(errno)); -- exit(-1); -- } -- close(0); -- close(1); -- close(2); --#ifdef HAVE_SETSID -- setsid(); --#else -- { -- int fd; -- -- if ((fd = open("/dev/tty", O_RDWR)) >= 0) { -- ioctl(fd, TIOCNOTTY, (char *) NULL); -- close(fd); -- } -- } --#endif -- } -- - log_open("ugidd", foreground); -+ -+ /* Become a daemon */ -+ if (!foreground) -+ daemonize(); - - svc_run(); - Dprintf(L_ERROR, "svc_run returned\n"); -diff -urN nfs-server-2.2beta47/version.c nfs-server-2.2beta51/version.c ---- nfs-server-2.2beta47/version.c Wed Nov 10 10:33:33 1999 -+++ nfs-server-2.2beta51/version.c Fri Nov 8 14:45:36 2002 -@@ -1 +1 @@ --char version[] = "Universal NFS Server 2.2beta47"; -+char version[] = "Universal NFS Server 2.2beta51";
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/002-destdir.patch deleted +0 -73
73 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/003-manpages.patch deleted +0 -33
@@ -1,33 +0,0 @@ -Upstream-Status: Inappropriate [other] -Upstream is not making further releases of this software. - -Signed-off-by: Scott Garman <[email protected]> - -# Patch origin: nfs-server source RPM from openSUSE 10.3 - ---- nfs-server/exports.man 2002/11/07 17:15:59 1.1 -+++ nfs-server/exports.man 2002/11/07 17:17:19 -@@ -110,6 +110,14 @@ - .TP - .IR link_absolute - Leave all symbolic link as they are. This is the default operation. -+.SS Anonymous Entries -+.PP -+Entries where hosts are not specified are known as anonymous entries. They -+have different default settings compared to normal entries. The differences -+include -+.IR all_squash , -+.IR no_secure ", and" -+.IR ro . - .SS User ID Mapping - .PP - .I nfsd -@@ -231,7 +239,7 @@ - # Mapping for client foobar: - # remote local - uid 0-99 - # squash these --uid 100-500 1000 # map 100-500 to 1000-1500 -+uid 100-500 1000 # map 100-500 to 1000-1400 - gid 0-49 - # squash these - gid 50-100 700 # map 50-100 to 700-750 - .fi
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/004-strsignal.patch deleted +0 -53
53 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/005-sys-time.patch deleted +0 -34
@@ -1,34 +0,0 @@ -Upstream-Status: Inappropriate [other] -Upstream is not making further releases of this software. - -Signed-off-by: Scott Garman <[email protected]> - -# Patch origin: nfs-server source RPM from openSUSE 10.3 - ---- nfs-server/system.h 2002/11/07 17:10:47 1.1 -+++ nfs-server/system.h 2002/11/07 17:11:53 -@@ -66,20 +66,16 @@ - # include <grp.h> /* for setgroups */ - #endif - --#ifdef TIME_WITH_SYS_TIME -+#ifdef HAVE_SYS_TIME_H - # include <sys/time.h> - # include <time.h> --#else /* not TIME_WITH_SYS_TIME */ --# ifdef HAVE_SYS_TIME_H --# include <sys/time.h> --# else /* not HAVE_SYS_TIME_H */ --# include <time.h> -+#else /* not HAVE_SYS_TIME_H */ -+# include <time.h> - struct timeval { - long tv_sec; - long tv_usec; - }; --# endif /* not HAVE_SYS_TIME_H */ --#endif /* not TIME_WITH_SYS_TIME */ -+#endif /* not HAVE_SYS_TIME_H */ - #ifdef HAVE_SYS_FILE_H - # include <sys/file.h> - #endif
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/006-reiserfs.patch deleted +0 -1277
458 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/007-map.patch deleted +0 -83
83 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/008-configure.patch deleted +0 -18
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/009-multirw.patch deleted +0 -20
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/010-realpath.patch deleted +0 -35
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/011-fno-strict-aliasing.patch deleted +0 -18
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/012-nostrip.patch deleted +0 -18
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/013-mntpathlen.patch deleted +0 -37
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/014-uninitialized.patch deleted +0 -17
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/015-setattr.patch deleted +0 -31
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/016-makefile.in.patch deleted +0 -19
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/017-wrs-dynamic-rpc.patch deleted +0 -263
263 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/018-remove-tcp-wrappers.patch deleted +0 -25
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/019-pid-before-fork.patch deleted +0 -130
130 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/020-undefined-chmod-fix.patch deleted +0 -23
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/021-nolibwrap.patch deleted +0 -25
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/022-add-close-on-exec-descriptors.patch deleted +0 -66
66 lines not on this page · raw message
meta/recipes-devtools/unfs-server/unfs-server-2.1+2.2beta47/023-no-rpc-register.patch deleted +0 -34
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/unfs-server/unfs-server_2.1+2.2beta47.bb deleted +0 -78
78 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.9.5
Part of the diff is not shown here. View the raw message.
PATCH v2 5/6 runqemu-export-rootfs: update for unfs3
In reply to Jason WesselThe unfs3 no longer has an rpc.mountd component. There is just a single server for mountd and nfsd requests. This means changing the name of the server in the scripts that check for it.
[YOCTO #5639]
--- scripts/runqemu-export-rootfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/runqemu-export-rootfs +2 -2
@@ -46,8 +46,8 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then fi . $SYSROOT_SETUP_SCRIPT -if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd" ]; then - echo "Error: Unable to find rpc.mountd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/" +if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/unfsd" ]; then + echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/" if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then echo "Have you run 'bitbake meta-ide-support'?"
Signature · 1 line
1.7.9.5
PATCH v2 6/6 runqemu, runqemu-internal: Allow slirp for NFS and KVM use
In reply to Jason WesselThe default slirp address for the NFS server is 10.0.2.2. If not using a tap interface this address must be used or the target system cannot connect properly. Also the ip=... kernel arguments need to be set to dhcp when using slirp or the root NFS will not get setup properly.
The call to cleanup() results in a routine which is not defined when setting up the NFS because it is called before acquire() for the locking of the tap interfaces, the solution being to simply not call cleanup() that early.
When using slirp, kvm should not execute the vhost net checks because the vhost net will not be configure or used.
--- scripts/runqemu | 10 ++++++---- scripts/runqemu-internal | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-)
scripts/runqemu +6 -4
@@ -279,10 +279,12 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then exit 1; fi if [ ! -w /dev/vhost-net -o ! -r /dev/vhost-net ]; then - echo "You have no rights on /dev/vhost-net." - echo "Please change the ownership of this file as described at:" - echo "$YOCTO_PARAVIRT_KVM_WIKI"; - exit 1; + if [ "$SLIRP_ENABLED" != "yes" ] ; then + echo "You have no rights on /dev/vhost-net." + echo "Please change the ownership of this file as described at:" + echo "$YOCTO_PARAVIRT_KVM_WIKI"; + exit 1; + fi fi fi
scripts/runqemu-internal +11 -8
@@ -114,7 +114,7 @@ NFSRUNNING="false" ORIG_STTY=$(stty -g) if [ "$SLIRP_ENABLED" = "yes" ]; then - KERNEL_NETWORK_CMD="" + KERNEL_NETWORK_CMD="ip=dhcp" QEMU_TAP_CMD="" QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" if [ "$KVM_ACTIVE" = "yes" ]; then
@@ -301,9 +301,18 @@ if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then return 1 fi -if [ "$FSTYPE" = "nfs" ]; then +if [ "$NFS_SERVER" = "" ]; then NFS_SERVER="192.168.7.1" + if [ "$SLIRP_ENABLED" = "yes" ]; then + NFS_SERVER="10.0.2.2" + fi +fi + +if [ "$FSTYPE" = "nfs" ]; then NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'` + if [ "$NFS_INSTANCE" = "" ] ; then + NFS_INSTANCE=0 + fi MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ] NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ] NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
@@ -317,17 +326,11 @@ if [ "$FSTYPE" = "nfs" ]; then echo "runqemu-export-rootfs restart $ROOTFS" runqemu-export-rootfs restart $ROOTFS if [ $? != 0 ]; then - cleanup return 1 fi NFSRUNNING="true" fi -if [ "$NFS_SERVER" = "" ]; then - NFS_SERVER="192.168.7.1" - NFS_DIR=$ROOTFS -fi - if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then QEMU=qemu-system-arm MACHINE_SUBTYPE=versatilepb
Signature · 1 line
1.7.9.5