diff options
Diffstat (limited to 'openwrt/package/nfs-server')
-rw-r--r-- | openwrt/package/nfs-server/Config.in | 6 | ||||
-rw-r--r-- | openwrt/package/nfs-server/Makefile | 71 | ||||
-rw-r--r-- | openwrt/package/nfs-server/files/etc/exports | 1 | ||||
-rwxr-xr-x | openwrt/package/nfs-server/files/etc/init.d/S60nfsd | 4 | ||||
-rw-r--r-- | openwrt/package/nfs-server/nfs-server.control | 16 | ||||
-rw-r--r-- | openwrt/package/nfs-server/patches/build-config.patch | 67 | ||||
-rw-r--r-- | openwrt/package/nfs-server/patches/cross-compile-fix.patch | 149 | ||||
-rw-r--r-- | openwrt/package/nfs-server/patches/debian-subset.patch | 698 | ||||
-rw-r--r-- | openwrt/package/nfs-server/patches/remove-warning.patch | 30 |
9 files changed, 1042 insertions, 0 deletions
diff --git a/openwrt/package/nfs-server/Config.in b/openwrt/package/nfs-server/Config.in new file mode 100644 index 0000000000..d052541a05 --- /dev/null +++ b/openwrt/package/nfs-server/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_NFSD + tristate "NFS Server" + default m + select BR2_PACKAGE_PORTMAP + help + User Space NFS Server diff --git a/openwrt/package/nfs-server/Makefile b/openwrt/package/nfs-server/Makefile new file mode 100644 index 0000000000..2d58451371 --- /dev/null +++ b/openwrt/package/nfs-server/Makefile @@ -0,0 +1,71 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=nfs-server +PKG_VERSION:=2.2beta47 +PKG_RELEASE:=1 +PKG_MD5SUM:=79a29fe9f79b2f3241d4915767b8c511 + +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/n/nfs-user-server +PKG_SOURCE:=nfs-user-server_$(PKG_VERSION).orig.tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_CAT:=zcat +PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg + +$(DL_DIR)/$(PKG_SOURCE): + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) + +$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE) + $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + $(PATCH) $(PKG_BUILD_DIR) ./patches + touch $(PKG_BUILD_DIR)/.patched + +$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched + (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $(PKG_BUILD_DIR)/.configured + +$(PKG_BUILD_DIR)/rpc.nfsd: $(PKG_BUILD_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR) + +$(PKG_IPK): $(PKG_BUILD_DIR)/rpc.nfsd + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(PKG_IPK_DIR)/usr/sbin + cp $(PKG_BUILD_DIR)/rpc.* $(PKG_IPK_DIR)/usr/sbin/ + $(STRIP) $(PKG_IPK_DIR)/usr/sbin/* + cp -a ./files/* $(PKG_IPK_DIR)/ + mkdir -p $(PACKAGE_DIR) + find $(PKG_IPK_DIR) -name CVS | xargs rm -rf + $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) + $(IPKG) install $(PKG_IPK) + +source: $(DL_DIR)/$(PKG_SOURCE) +prepare: $(PKG_BUILD_DIR)/.patched +compile: $(PKG_IPK) +install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list + +clean: + rm -rf $(PKG_BUILD_DIR) + rm -f $(PKG_IPK) diff --git a/openwrt/package/nfs-server/files/etc/exports b/openwrt/package/nfs-server/files/etc/exports new file mode 100644 index 0000000000..75a387a487 --- /dev/null +++ b/openwrt/package/nfs-server/files/etc/exports @@ -0,0 +1 @@ +/mnt (ro,all_squash,insecure) diff --git a/openwrt/package/nfs-server/files/etc/init.d/S60nfsd b/openwrt/package/nfs-server/files/etc/init.d/S60nfsd new file mode 100755 index 0000000000..1b1e1bd3aa --- /dev/null +++ b/openwrt/package/nfs-server/files/etc/init.d/S60nfsd @@ -0,0 +1,4 @@ +#!/bin/sh +/usr/sbin/portmap +/usr/sbin/rpc.mountd -r +/usr/sbin/rpc.nfsd diff --git a/openwrt/package/nfs-server/nfs-server.control b/openwrt/package/nfs-server/nfs-server.control new file mode 100644 index 0000000000..72a6cf9d41 --- /dev/null +++ b/openwrt/package/nfs-server/nfs-server.control @@ -0,0 +1,16 @@ +Package: nfs-server +Section: net +Priority: optional +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Depends: portmap +Description: User space NFS server + This package contains all necessary programs to make your Linux machine act + as an NFS server, being an NFS daemon (rpc.nfsd), a mount daemon (rpc.mountd). + . + Unlike other NFS daemons, this NFS server runs entirely in user space. This + makes it a tad slower than other NFS implementations, and also introduces + some awkwardnesses in the semantics (for instance, moving a file to a + different directory will render its file handle invalid). + . + There is currently no support for file locking. diff --git a/openwrt/package/nfs-server/patches/build-config.patch b/openwrt/package/nfs-server/patches/build-config.patch new file mode 100644 index 0000000000..5aa1cde636 --- /dev/null +++ b/openwrt/package/nfs-server/patches/build-config.patch @@ -0,0 +1,67 @@ +--- nfs-server-2.2beta47.old/site.mk 1970-01-01 01:00:00.000000000 +0100 ++++ nfs-server-2.2beta47/site.mk 2005-03-24 22:42:20.000000000 +0100 +@@ -0,0 +1,11 @@ ++# ++# Site-specific make options generated by BUILD. Please do not edit. ++# ++ ++# ugidd support ++UGIDD_PROG= ++UGIDD_MAN= ++# Location of tcp_wrapper library ++LIBWRAP_DIR=-L/usr/share/stuff/src/openwrt/experimental/buildroot/build_mipsel/staging_dir/lib ++LIBWRAP_LIB=-lwrap ++DEVTAB_FILE= +--- nfs-server-2.2beta47.old/site.h 1970-01-01 01:00:00.000000000 +0100 ++++ nfs-server-2.2beta47/site.h 2005-03-24 22:44:19.000000000 +0100 +@@ -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 ((uid_t) 0) ++#define EXPORTSOWNERGID ((gid_t) 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 --git a/openwrt/package/nfs-server/patches/cross-compile-fix.patch b/openwrt/package/nfs-server/patches/cross-compile-fix.patch new file mode 100644 index 0000000000..646a34a9ab --- /dev/null +++ b/openwrt/package/nfs-server/patches/cross-compile-fix.patch @@ -0,0 +1,149 @@ +diff -urN nfs-server-2.2beta47.old/configure nfs-server-2.2beta47/configure +--- nfs-server-2.2beta47.old/configure 1999-06-11 12:06:04.000000000 +0200 ++++ nfs-server-2.2beta47/configure 2005-03-24 22:24:39.000000000 +0100 +@@ -1960,7 +1960,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 1967 "configure" +@@ -1996,7 +1996,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2003 "configure" +@@ -2032,7 +2032,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2039 "configure" +@@ -2130,7 +2130,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2137 "configure" +@@ -2166,7 +2166,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2173 "configure" +@@ -2202,7 +2202,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2209 "configure" +@@ -2238,7 +2238,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2245 "configure" +@@ -2862,7 +2862,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 2869 "configure" +@@ -3089,7 +3089,7 @@ + + # DEC Alpha running OSF/1 + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 3096 "configure" +@@ -3149,7 +3149,7 @@ + # SVR3 + if test -z "$space"; then + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 3156 "configure" +@@ -3348,7 +3348,7 @@ + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then +- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ++ { echo "configure: error: can not run test program while cross compiling" 1>&2; } + else + cat > conftest.$ac_ext <<EOF + #line 3355 "configure" +--- nfs-server-2.2beta47.old/logging.c 1998-10-30 17:11:22.000000000 +0100 ++++ nfs-server-2.2beta47/logging.c 2005-03-24 22:47:44.000000000 +0100 +@@ -14,6 +14,7 @@ + */ + + #include "nfsd.h" ++#include <time.h> + + #ifdef HAVE_SYSLOG_H + #include <syslog.h> +--- nfs-server-2.2beta47.old/fh.c 1999-11-10 10:41:14.000000000 +0100 ++++ nfs-server-2.2beta47/fh.c 2005-03-24 22:50:50.000000000 +0100 +@@ -50,6 +50,7 @@ + */ + + #include <assert.h> ++#include <time.h> + #include "nfsd.h" + #include "rpcmisc.h" + #include "signals.h" +@@ -350,7 +351,7 @@ + #ifndef ENABLE_DEVTAB + psi_t dmajor, dminor; + +-#if SIZEOF_DEV_T == 4 ++#if (SIZEOF_DEV_T == 4) + /* This folds the upper 16 bits into bits 8..15, and + * the lower 16 bits into bits 0..7 + */ +--- nfs-server-2.2beta47.old/ugid_map.c 2005-03-24 22:34:56.000000000 +0100 ++++ nfs-server-2.2beta47/ugid_map.c 2005-03-24 22:54:00.000000000 +0100 +@@ -34,14 +34,8 @@ + #define UGID_CHUNK0_BYTES (UGID_CHUNK * sizeof(idmap_t)) + #define UGID_EXPIRE 300 /* 5 minutes */ + +-/* +- * Make sure we get the right size for ugid_t +- */ +-#if SIZEOF_UID_T != SIZEOF_GID_T +-#error Sorry, this code relies on sizeof(uid_t) == sizeof(gid_t) +-#endif + +-#define UGID_BITS (SIZEOF_UID_T * BITSPERBYTE) ++#define UGID_BITS (sizeof(uid_t) * BITSPERBYTE) + #define BITSTOLEVEL(b) ((UGID_BITS - (b)) / UGID_CHUNK_BITS - 1) + #define UGID_LOWER(id, b) ((id) & ~((1 << (b)) - 1)) + #define UGID_UPPER(id, b) (((id + (1 << (b))) & ~((1 << (b)) - 1))-1) diff --git a/openwrt/package/nfs-server/patches/debian-subset.patch b/openwrt/package/nfs-server/patches/debian-subset.patch new file mode 100644 index 0000000000..2ac3f93d46 --- /dev/null +++ b/openwrt/package/nfs-server/patches/debian-subset.patch @@ -0,0 +1,698 @@ +--- nfs-user-server-2.2beta47.orig/BUILD ++++ nfs-user-server-2.2beta47/BUILD +@@ -48,7 +48,7 @@ + shift + done + +-function read_yesno { ++read_yesno() { + ans="" + echo >&2 + default=$2 +@@ -84,7 +84,7 @@ + echo $ans + } + +-function read_ugid { ++read_ugid() { + ans="" + prompt="$2 [default $3 $4] " + default=$3 +@@ -145,7 +145,7 @@ + + if ! $batch; then + echo -n "Please press return to continue" +- read ++ read ans + fi + + version=`cat .version` +--- nfs-user-server-2.2beta47.orig/Makefile.in ++++ nfs-user-server-2.2beta47/Makefile.in +@@ -95,20 +95,20 @@ + LIBSRCS = fileblocks.c fsusage.c realpath.c strerror.c \ + 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 \ ++ xstrdup.c strdup.c strstr.c nfsmounted.c \ + haccess.c failsafe.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 ++ rpcmisc.h rquotad.h rquota.h haccess.h + LIBHDRS = fsusage.h getopt.h mountlist.h failsafe.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 haccess.o failsafe.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 \ +@@ -116,7 +116,7 @@ + MOUNTD_OBJS = mountd.o rpcmisc.o mount_dispatch.o mount_xdr.o rmtab.o \ + $(OBJS) + SHOWMOUNT_OBJS = showmount.o mount_xdr.o +-UGIDD_OBJS = ugidd.o ugid_xdr.o logging.o ++UGIDD_OBJS = ugidd.o ugid_xdr.o logging.o rpcmisc.o + DAEMONS = $(rpcprefix)mountd $(rpcprefix)nfsd $(UGIDD_PROG) + CLIENTS = showmount + +--- nfs-user-server-2.2beta47.orig/auth.c ++++ nfs-user-server-2.2beta47/auth.c +@@ -143,6 +143,21 @@ + return okay; + } + ++static inline int ++auth_atob(const char *name, struct in_addr *ap) ++{ ++ int m; ++ ++ if (!isdigit(*name)) ++ return 0; ++ for (m = 0; isdigit(*name); name++) ++ m = m * 10 + (unsigned char) *name - '0'; ++ if (m > 32) ++ return 0; ++ ap->s_addr = m ? ~((1 << (32 - m)) - 1) : 0; ++ return 1; ++} ++ + /* + * Get a client entry for a specific name or pattern. + * If necessary, this function performs a hostname lookup to +@@ -614,7 +629,9 @@ + if (auth_aton(hname, &haddr, &ename)) { + if (*ename == '\0') + is_hostaddr = 1; +- else if (*ename == '/' && auth_aton(ename+1, &hmask, NULL)) ++ else if (*ename == '/' && ++ (auth_aton(ename+1, &hmask, NULL) || ++ auth_atob(ename+1, &hmask))) + is_netmask = 1; + } + is_special = is_wildcard + is_netgroup + is_netmask; +--- nfs-user-server-2.2beta47.orig/auth_init.c ++++ nfs-user-server-2.2beta47/auth_init.c +@@ -23,6 +23,7 @@ + #define EXPORTSFILE "/etc/exports" + #endif + ++#if 0 + /* Support for file access control on /etc/exports by Alex Yuriev. */ + #include "faccess.h" + #ifndef EXPORTSOWNERUID +@@ -31,6 +32,7 @@ + #ifndef EXPORTSOWNERGID + #define EXPORTSOWNERGID ((gid_t) 0) + #endif ++#endif + + exportnode * export_list = NULL; + int allow_non_root = 0; +@@ -395,6 +397,7 @@ + auth_file = fname; /* Save for re-initialization */ + + /* Check protection of exports file. */ ++#if 0 /* A man's house is his castle. */ + switch(iCheckAccess(auth_file, EXPORTSOWNERUID, EXPORTSOWNERGID)) { + case FACCESSWRITABLE: + Dprintf(L_ERROR, +@@ -409,6 +412,7 @@ + Dprintf(L_ERROR, "exiting because of security violation.\n"); + exit(1); + } ++#endif + + if ((ef = fopen(fname, "r")) == NULL) { + Dprintf(L_ERROR, "Could not open exports file %s: %s\n", +@@ -468,7 +472,7 @@ + + /* Build the RPC mount export list data structure. */ + resex = (exportnode *) xmalloc(sizeof *resex); +- resex->ex_dir = mount_point; ++ resex->ex_dir = xstrdup(path); + resex->ex_groups = NULL; + + #ifndef NEW_STYLE_EXPORTS_FILE +--- nfs-user-server-2.2beta47.orig/configure.in ++++ nfs-user-server-2.2beta47/configure.in +@@ -53,7 +53,7 @@ + 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_HAVE_FUNCS(getcwd seteuid setreuid getdtablesize setgroups lchown setsid setfsuid setfsgid innetgr quotactl authdes_getucred strsignal) + AC_AUTHDES_GETUCRED + AC_BROKEN_SETFSUID + AC_MOUNTLIST +--- nfs-user-server-2.2beta47.orig/exports.man ++++ nfs-user-server-2.2beta47/exports.man +@@ -8,7 +8,7 @@ + The file + .I /etc/exports + serves as the access control list for file systems which may be +-exported to NFS clients. It it used by both the NFS mount daemon, ++exported to NFS clients. It is used by both the NFS mount daemon, + .IR mountd (8) + and the NFS file server daemon + .IR nfsd (8). +@@ -75,11 +75,12 @@ + off, specify + .IR insecure . + .TP ++.IR ro ++Disallow the client to modify files and directories. The client is only ++allowed to issue read-only requests. ++.TP + .IR rw +-Allow the client to modify files and directories. The default is to +-restrict the client to read-only request, which can be made explicit +-by using the +-.IR ro " option. ++Allow the client to modify files and directories. This is the default. + .TP + .I noaccess + This makes everything below the directory inaccessible for the named +@@ -98,6 +99,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 +--- nfs-user-server-2.2beta47.orig/failsafe.c ++++ nfs-user-server-2.2beta47/failsafe.c +@@ -10,8 +10,12 @@ + #include "logging.h" + #include "signals.h" + #include <sys/wait.h> ++#ifdef HAVE_STRSIGNAL ++#include <string.h> ++#else + + static const char * get_signame(int signo); ++#endif + + void + failsafe(int level, int ncopies) +@@ -111,9 +115,17 @@ + pid, running? "Continue" : "Exit"); + } else { + Dprintf(L_WARNING, "failsafe: " ++#ifdef HAVE_STRSIGNAL ++ "child %d terminated by: %s. " ++#else + "child %d terminated by %s. " ++#endif + "Restarting.", ++#ifdef HAVE_STRSIGNAL ++ pid, strsignal(signo)); ++#else + pid, get_signame(signo)); ++#endif + child = -1; /* Restart */ + } + } else if (WIFEXITED(status)) { +@@ -159,6 +171,7 @@ + /* NOP */ + } + ++#ifndef HAVE_STRSIGNAL + static const char * + get_signame(int signo) + { +@@ -199,3 +212,4 @@ + sprintf(namebuf, "signal #%d", signo); + return namebuf; + } ++#endif +--- nfs-user-server-2.2beta47.orig/mount_dispatch.c ++++ nfs-user-server-2.2beta47/mount_dispatch.c +@@ -131,7 +131,7 @@ + dent = &dtbl[proc_index]; + + memset(&argument, 0, dent->arg_size); +- if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) { ++ if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) { + svcerr_decode(transp); + goto done; + } +@@ -148,7 +148,7 @@ + if (!svc_sendreply(transp, dent->xdr_result, (caddr_t) resp)) { + svcerr_systemerr(transp); + } +- if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) { ++ if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) { + Dprintf(L_ERROR, "unable to free RPC arguments, exiting\n"); + exit(1); + } +--- nfs-user-server-2.2beta47.orig/mount_xdr.c ++++ nfs-user-server-2.2beta47/mount_xdr.c +@@ -190,7 +190,7 @@ + xdr_ppathcnf(XDR *xdrs, ppathcnf *objp) + { + +- register long *buf=buf; ++ int32_t *buf=buf; + + int i=i; + +--- nfs-user-server-2.2beta47.orig/mountd.c ++++ nfs-user-server-2.2beta47/mountd.c +@@ -310,6 +310,7 @@ + int c; + + program_name = argv[0]; ++ chdir("/"); + + /* Parse the command line options and arguments. */ + opterr = 0; +--- nfs-user-server-2.2beta47.orig/nfs_dispatch.c ++++ nfs-user-server-2.2beta47/nfs_dispatch.c +@@ -147,7 +147,7 @@ + nfsclient = NULL; + + memset(&argument, 0, dent->arg_size); +- if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) { ++ if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) { + svcerr_decode(transp); + goto done; + } +@@ -173,7 +173,7 @@ + svc_sendreply(transp, dent->xdr_result, (caddr_t) &result); + #endif + +- if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) { ++ if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) { + Dprintf(L_ERROR, "unable to free RPC arguments, exiting\n"); + exit(1); + } +--- nfs-user-server-2.2beta47.orig/nfs_prot_xdr.c ++++ nfs-user-server-2.2beta47/nfs_prot_xdr.c +@@ -98,7 +98,7 @@ + xdr_fattr(XDR *xdrs, fattr *objp) + { + +- register long *buf=buf; ++ int32_t *buf=buf; + + + if (xdrs->x_op == XDR_ENCODE) { +@@ -273,7 +273,7 @@ + xdr_sattr(XDR *xdrs, sattr *objp) + { + +- register long *buf=buf; ++ int32_t *buf=buf; + + + if (xdrs->x_op == XDR_ENCODE) { +@@ -553,7 +553,7 @@ + xdr_writeargs(XDR *xdrs, writeargs *objp) + { + +- register long *buf = buf; ++ int32_t *buf = buf; + + + if (xdrs->x_op == XDR_ENCODE) { +@@ -777,7 +777,7 @@ + xdr_statfsokres(XDR *xdrs, statfsokres *objp) + { + +- register long *buf=buf; ++ int32_t *buf=buf; + + + if (xdrs->x_op == XDR_ENCODE) { +--- nfs-user-server-2.2beta47.orig/nfsd.c ++++ nfs-user-server-2.2beta47/nfsd.c +@@ -36,6 +36,7 @@ + #define CHK_READ 0 + #define CHK_WRITE 1 + #define CHK_NOACCESS 2 ++#define CHK_ROOT 4 + + /* Make larger reads possible. Without crashing the machine :-) */ + #undef NFS_MAXDATA +@@ -173,7 +174,8 @@ + return NULL; + } + +- auth_user(nfsmount, rqstp); ++ if (!(flags & CHK_ROOT) || strcmp(nfsmount->path, fhc->path)) ++ auth_user(nfsmount, rqstp); + + *statp = NFS_OK; + return fhc; +@@ -244,7 +246,7 @@ + nfsstat status; + fhcache *fhc; + +- fhc = auth_fh(rqstp, argp, &status, CHK_READ); ++ fhc = auth_fh(rqstp, argp, &status, CHK_READ | CHK_ROOT); + if (fhc == NULL) + return status; + +@@ -575,7 +577,12 @@ + #endif + + /* MvS: Some clients use chardev 0xFFFF for a FIFO. */ ++#if defined(major) && defined(minor) ++ if (S_ISCHR(argp->attributes.mode) && ++ major(dev) == 0xff && minor(dev) == 0xff) { ++#else + if (S_ISCHR(argp->attributes.mode) && dev == 0xFFFF) { ++#endif + is_borc = 0; + dev = 0; + argp->attributes.mode &= ~S_IFMT; +@@ -882,7 +889,9 @@ + + /* This code is from Mark Shand's version */ + errno = 0; +- if (efs_lstat(h->path, &sbuf) < 0 || !(S_ISDIR(sbuf.st_mode))) ++ if (efs_lstat(h->path, &sbuf) < 0) ++ return (NFSERR_ACCES); ++ if (!S_ISDIR(sbuf.st_mode)) + return (NFSERR_NOTDIR); + if ((dirp = efs_opendir(h->path)) == NULL) + return ((errno ? nfs_errno() : NFSERR_NAMETOOLONG)); +@@ -940,7 +949,7 @@ + char *path; + struct fs_usage fs; + +- fhc = auth_fh(rqstp, argp, &status, CHK_READ | CHK_NOACCESS); ++ fhc = auth_fh(rqstp, argp, &status, CHK_READ | CHK_NOACCESS | CHK_ROOT); + if (fhc == NULL) + return status; + path = fhc->path; +--- nfs-user-server-2.2beta47.orig/rpcmisc.c ++++ nfs-user-server-2.2beta47/rpcmisc.c +@@ -64,25 +64,25 @@ + asize = sizeof(saddr); + sock = 0; + if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0) { +- int ssize = sizeof (int); ++ int ssize = sizeof (i); + + if (saddr.sin_family != AF_INET) + goto not_inetd; +- if (getsockopt(0, SOL_SOCKET, SO_TYPE, &_rpcfdtype, &ssize) < 0) ++ if (getsockopt(0, SOL_SOCKET, SO_TYPE, &i, &ssize) < 0) + goto not_inetd; ++ _rpcfdtype = i; + background_logging(); /* no more logging to stderr */ + closedown = time(NULL) + _RPCSVC_CLOSEDOWN; + _rpcpmstart = 1; + } else { + not_inetd: +- _rpcfdtype = 0; + for (i = 0; (vers = verstbl[i]) != 0; i++) + pmap_unset(prog, vers); + sock = RPC_ANYSOCK; + } + + if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) { +- if (_rpcfdtype == 0 && defport != 0) ++ if (_rpcpmstart == 0 && defport != 0) + sock = makesock(defport, IPPROTO_UDP, bufsiz); + transp = svcudp_create(sock); + if (transp == NULL) +@@ -97,7 +97,7 @@ + } + + if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) { +- if (_rpcfdtype == 0 && defport != 0) ++ if (_rpcpmstart == 0 && defport != 0) + sock = makesock(defport, IPPROTO_TCP, bufsiz); + transp = svctcp_create(sock, 0, 0); + if (transp == NULL) +@@ -220,11 +220,14 @@ + } + #endif /* SO_SNDBUF */ + +- if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) +- Dprintf(L_FATAL, "Could not bind %s socket to %s:%d: %s\n", ++ if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) { ++ Dprintf(L_ERROR, "Could not bind %s socket to %s:%d: %s\n", + prot_name, inet_ntoa(sin.sin_addr), + ntohs(sin.sin_port), + strerror(errno)); ++ close(s); ++ s = RPC_ANYSOCK; ++ } + + return (s); + } +--- nfs-user-server-2.2beta47.orig/showmount.c ++++ nfs-user-server-2.2beta47/showmount.c +@@ -200,7 +200,7 @@ + memset(&exportlist, '\0', sizeof(exportlist)); + clnt_stat = clnt_call(mclient, MOUNTPROC_EXPORT, + (xdrproc_t) xdr_void, NULL, +- (xdrproc_t) xdr_exports, &exportlist, ++ (xdrproc_t) xdr_exports, (caddr_t) &exportlist, + total_timeout); + if (clnt_stat != RPC_SUCCESS) { + clnt_perror(mclient, "rpc mount export"); +@@ -233,7 +233,7 @@ + memset(&dumplist, '\0', sizeof(dumplist)); + clnt_stat = clnt_call(mclient, MOUNTPROC_DUMP, + (xdrproc_t) xdr_void, NULL, +- (xdrproc_t) xdr_mountlist, &dumplist, ++ (xdrproc_t) xdr_mountlist, (caddr_t) &dumplist, + total_timeout); + if (clnt_stat != RPC_SUCCESS) { + clnt_perror(mclient, "rpc mount dump"); +--- nfs-user-server-2.2beta47.orig/ugid_clnt.c ++++ nfs-user-server-2.2beta47/ugid_clnt.c +@@ -16,7 +16,7 @@ + static int clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); +- if (clnt_call(clnt, AUTHENTICATE, (xdrproc_t) xdr_int, argp, (xdrproc_t) xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) { ++ if (clnt_call(clnt, AUTHENTICATE, (xdrproc_t) xdr_int, (caddr_t) argp, (xdrproc_t) xdr_int, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +@@ -28,7 +28,7 @@ + static int clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); +- if (clnt_call(clnt, NAME_UID, (xdrproc_t) xdr_ugname, argp, (xdrproc_t) xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) { ++ if (clnt_call(clnt, NAME_UID, (xdrproc_t) xdr_ugname, (caddr_t) argp, (xdrproc_t) xdr_int, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +@@ -40,7 +40,7 @@ + static int clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); +- if (clnt_call(clnt, GROUP_GID, (xdrproc_t) xdr_ugname, argp, (xdrproc_t) xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) { ++ if (clnt_call(clnt, GROUP_GID, (xdrproc_t) xdr_ugname, (caddr_t) argp, (xdrproc_t) xdr_int, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +@@ -52,7 +52,7 @@ + static ugname clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); +- if (clnt_call(clnt, UID_NAME, (xdrproc_t) xdr_int, argp, (xdrproc_t) xdr_ugname, &clnt_res, TIMEOUT) != RPC_SUCCESS) { ++ if (clnt_call(clnt, UID_NAME, (xdrproc_t) xdr_int, (caddr_t) argp, (xdrproc_t) xdr_ugname, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +@@ -64,7 +64,7 @@ + static ugname clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); +- if (clnt_call(clnt, GID_GROUP, (xdrproc_t) xdr_int, argp, (xdrproc_t) xdr_ugname, &clnt_res, TIMEOUT) != RPC_SUCCESS) { ++ if (clnt_call(clnt, GID_GROUP, (xdrproc_t) xdr_int, (caddr_t) argp, (xdrproc_t) xdr_ugname, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +--- nfs-user-server-2.2beta47.orig/ugid_map.c ++++ nfs-user-server-2.2beta47/ugid_map.c +@@ -602,7 +602,7 @@ + * the server's port after clntudp_create, so we fetch it + * explicitly. + */ +- clnt_control(clnt, CLGET_SERVER_ADDR, &addr); ++ clnt_control(clnt, CLGET_SERVER_ADDR, (caddr_t) &addr); + if (!SECURE_PORT(addr.sin_port)) { + Dprintf(L_ERROR, "%s on %s runs on unprivileged port.\n", + name, inet_ntoa(addr.sin_addr)); +--- nfs-user-server-2.2beta47.orig/ugidd.c ++++ nfs-user-server-2.2beta47/ugidd.c +@@ -20,6 +20,8 @@ + #include "ugid.h" + #include "logging.h" + #include "haccess.h" ++#include "rpcmisc.h" ++#include "signals.h" + #ifdef HAVE_LIBWRAP_BUG + #include <syslog.h> + #endif +@@ -27,6 +29,8 @@ + + static void ugidprog_1(struct svc_req *rqstp, SVCXPRT *transp); + static void usage(void); ++static void terminate(void); ++static RETSIGTYPE sigterm(int sig); + + #ifndef HAVE_RPCGEN_C + #define authenticate_1_svc authenticate_1 +@@ -39,17 +43,23 @@ + + static struct option longopts[] = { + { "debug", 0, 0, 'd' }, ++ { "port", required_argument, 0, 'P' }, + { NULL, 0, 0, 0 } + }; + ++static int ugidd_versions[] = { ++ UGIDVERS, ++ 0 ++}; ++ + int + main(argc, argv) + int argc; + char **argv; + { +- SVCXPRT *transp; + int c, longind; + int foreground = 0; ++ int port = 0; + + #ifndef HOSTS_ACCESS + fprintf(stderr, +@@ -59,40 +69,34 @@ + sleep(1); + #endif + +- while ((c = getopt_long(argc, argv, "d", longopts, &longind)) != EOF) { ++ chdir("/"); ++ ++ while ((c = getopt_long(argc, argv, "dP:", longopts, &longind)) != EOF) { + switch (c) { + case 'd': + foreground = 1; + enable_logging("ugid"); + break; ++ case 'P': ++ port = atoi(optarg); ++ if (port <= 0 || port > 65535) { ++ fprintf(stderr, "ugidd: bad port number: %s\n", ++ optarg); ++ usage(); ++ } ++ break; + default: + usage(); + } + } + +- (void)pmap_unset(UGIDPROG, UGIDVERS); ++ log_open("ugidd", foreground); + +- transp = svcudp_create(RPC_ANYSOCK); +- if (transp == NULL) { +- (void)fprintf(stderr, "cannot create udp service.\n"); +- exit(1); +- } +- if (!svc_register(transp, UGIDPROG, UGIDVERS, ugidprog_1, IPPROTO_UDP)) { +- fprintf(stderr, "unable to register (UGIDPROG, UGIDVERS, UDP)\n"); +- exit(1); +- } +- +- transp = svctcp_create(RPC_ANYSOCK, 0, 0); +- if (transp == NULL) { +- fprintf(stderr, "cannot create tcp service.\n"); +- exit(1); +- } +- if (!svc_register(transp, UGIDPROG, UGIDVERS, ugidprog_1, IPPROTO_TCP)) { +- fprintf(stderr, "unable to register (UGIDPROG, UGIDVERS, TCP)\n"); +- exit(1); +- } ++ /* Create services and register with portmapper */ ++ _rpcfdtype = SOCK_DGRAM; ++ rpc_init("ugidd", UGIDPROG, ugidd_versions, ugidprog_1, port, 0); + +- if (!foreground) { ++ if (!foreground && !_rpcpmstart) { + if ((c = fork()) > 0) + exit(0); + if (c < 0) { +@@ -117,7 +121,8 @@ + #endif + } + +- log_open("ugidd", foreground); ++ install_signal_handler(SIGTERM, sigterm); ++ atexit(terminate); + + svc_run(); + Dprintf(L_ERROR, "svc_run returned\n"); +@@ -127,7 +132,7 @@ + static void + usage() + { +- fprintf(stderr, "rpc.ugidd: [-d]\n"); ++ fprintf(stderr, "rpc.ugidd: [-d] [-P port]\n"); + exit (2); + } + +@@ -188,7 +193,7 @@ + return; + } + bzero((char *)&argument, sizeof(argument)); +- if (!svc_getargs(transp, xdr_argument, &argument)) { ++ if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { + svcerr_decode(transp); + return; + } +@@ -196,7 +201,7 @@ + if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { + svcerr_systemerr(transp); + } +- if (!svc_freeargs(transp, xdr_argument, &argument)) { ++ if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { + (void)fprintf(stderr, "unable to free arguments\n"); + exit(1); + } +@@ -321,6 +326,19 @@ + } + + ++static RETSIGTYPE ++sigterm(int sig) ++{ ++ exit(0); ++} ++ ++static void ++terminate(void) ++{ ++ rpc_exit(UGIDPROG, ugidd_versions); ++} ++ ++ + + #else /* ENABLE_UGID_DAEMON */ + diff --git a/openwrt/package/nfs-server/patches/remove-warning.patch b/openwrt/package/nfs-server/patches/remove-warning.patch new file mode 100644 index 0000000000..5484b792c2 --- /dev/null +++ b/openwrt/package/nfs-server/patches/remove-warning.patch @@ -0,0 +1,30 @@ +--- nfs-server-2.2beta47.old/auth_clnt.c 1999-11-10 10:18:06.000000000 +0100 ++++ nfs-server-2.2beta47/auth_clnt.c 2005-03-24 23:44:16.000000000 +0100 +@@ -238,19 +238,23 @@ + + /* First, set the user ID. */ + if (auth_uid != cred_uid) { +- if (setfsuid(cred_uid) < 0) ++ if (setfsuid(cred_uid) < 0) { ++#if 0 + Dprintf(L_ERROR, "Unable to setfsuid %d: %s\n", + cred_uid, strerror(errno)); +- else ++#endif ++ } else + auth_uid = cred_uid; + } + + /* Next, the group ID. */ + if (auth_gid != cred_gid) { +- if (setfsgid(cred_gid) < 0) ++ if (setfsgid(cred_gid) < 0) { ++#if 0 + Dprintf(L_ERROR, "Unable to setfsgid %d: %s\n", + cred_gid, strerror(errno)); +- else ++#endif ++ } else + auth_gid = cred_gid; + } + |