added core/nfs-utils 1.2.5-1

This commit is contained in:
Kevin Mihelich 2012-02-15 20:34:17 -05:00
parent 35f6a56d76
commit 0968d38355
16 changed files with 1240 additions and 0 deletions

View file

@ -0,0 +1,20 @@
PAGE_SIZE is not exported by all architectures as it is not fixed: it can depend on the model of the machine. So it's better to query the system configuration for the actual page size on the machine.
---
utils/blkmapd/device-process.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/utils/blkmapd/device-process.c b/utils/blkmapd/device-process.c
index 27ff374..652a7a8 100644
--- a/utils/blkmapd/device-process.c
+++ b/utils/blkmapd/device-process.c
@@ -296,7 +296,7 @@ decode_blk_volume(uint32_t **pp, uint32_t *end, struct bl_volume *vols, int voln
off_t stripe_unit = vol->param.bv_stripe_unit;
/* Check limitations imposed by device-mapper */
if ((stripe_unit & (stripe_unit - 1)) != 0
- || stripe_unit < (off_t) (PAGE_SIZE >> 9))
+ || stripe_unit < (off_t) (sysconf(_SC_PAGE_SIZE) >> 9))
return -EIO;
BLK_READBUF(p, end, 4);
READ32(vol->bv_vol_n);

83
core/nfs-utils/PKGBUILD Normal file
View file

@ -0,0 +1,83 @@
# $Id: PKGBUILD 139844 2011-10-05 07:58:31Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>
# Contributor: dibblethewrecker <dibblethewrecker.at.jiwe.org>
# Contributor: abelstr <abel@pinklf.eu>
# Contributor: Marco Lima <cipparello gmail com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - patch to not use PAGESIZE - not implemented for ARM
plugrel=1
pkgname=nfs-utils
pkgver=1.2.5
pkgrel=1
pkgdesc="Support programs for Network File Systems"
arch=('i686' 'x86_64')
url='http://nfs.sourceforge.net'
license=('GPL')
backup=(etc/{exports,idmapd.conf} etc/conf.d/{nfs-common.conf,nfs-server.conf})
depends=('glibc' 'e2fsprogs' 'rpcbind' 'libtirpc>=0.2.1' 'librpcsecgss>=0.19-2' 'nfsidmap' 'libevent>=2.0.10' 'libgssglue' 'device-mapper')
makedepends=('pkgconfig' 'autoconf' 'automake')
source=(http://downloads.sourceforge.net/project/nfs/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2
nfs-common
nfs-common.conf
nfs-server
nfs-server.conf
exports
idmapd.conf
start-statd.patch
nfs-utils-1.1.4-mtab-sym.patch
nfs-utils-1.1.4-no-exec.patch
18-dont-use-PAGE_SIZE.patch)
install=nfs-utils.install
md5sums=('8395ac770720b83c5c469f88306d7765'
'dd0d65fc6e8f422fa12520813098264b'
'f73f197a16b02c3e248488ec35c4cf43'
'e619f18354ff958ed624d05d08853d8f'
'2bf71def3263325643a09458635520f0'
'ff585faf410a62c4333a027c50b56bae'
'eb4f4027fab6fc1201f1ca04f5954c76'
'e9144277a89a620d9bc80413158a7d27'
'7674106eaaa4c149bccd4f05fe3604e9'
'4f4827dfc93008dfadd0a530ad0872b2'
'1a56922af585f4cc3ec4e7504f00c3a2')
build() {
cd $srcdir/${pkgname}-${pkgver}
patch -Np1 -i ../nfs-utils-1.1.4-mtab-sym.patch
#patch -Np1 -i ../nfs-utils-1.1.4-no-exec.patch
# arch specific patch
patch -Np0 -i $srcdir/start-statd.patch
# ALARM
patch -Np1 -i ../18-dont-use-PAGE_SIZE.patch
./configure --prefix=/usr --enable-nfsv3 --enable-nfsv4 --enable-gss \
--without-tcp-wrappers --with-statedir=/var/lib/nfs \
--enable-ipv6 --sysconfdir=/etc --enable-libmount-mount
make
}
package() {
cd $srcdir/${pkgname}-${pkgver}
make DESTDIR=$pkgdir install
# support python2 (FS#25120)
sed -i '1s/python$/python2/' "$pkgdir"/usr/sbin/{nfsiostat,mountstats}
# NFS & NFSv4 init scripts
install -D -m 755 ../nfs-common "$pkgdir/"etc/rc.d/nfs-common
install -D -m 755 ../nfs-server "$pkgdir/"etc/rc.d/nfs-server
# Configuration
install -D -m 644 ../exports "$pkgdir/"etc/exports
install -D -m 644 ../idmapd.conf "$pkgdir/"etc/idmapd.conf
install -D -m 644 ../nfs-common.conf "$pkgdir/"etc/conf.d/nfs-common.conf
install -D -m 644 ../nfs-server.conf "$pkgdir/"etc/conf.d/nfs-server.conf
# directories
mkdir "$pkgdir/"etc/exports.d
mkdir "$pkgdir/"var/lib/nfs/rpc_pipefs
mkdir "$pkgdir/"var/lib/nfs/v4recovery
}

15
core/nfs-utils/exports Normal file
View file

@ -0,0 +1,15 @@
# /etc/exports
#
# List of directories exported to NFS clients. See exports(5).
# Use exportfs -arv to reread.
#
# Example for NFSv2 and NFSv3:
# /srv/home hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4 hostname1(rw,sync,fsid=0)
# /srv/nfs4/home hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/home gss/krb5i(rw,sync,nohide)
#

View file

@ -0,0 +1,14 @@
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nobody
[Translation]
Method = nsswitch

View file

@ -0,0 +1,53 @@
mount.nfs segfaults if kernel version number does not contain
at least 3 components delimited with a dot.
Avoid this by matching up to three unsigned integers inialised
to zero, separated by dots.
A version that does not start with an integer is probably a future
version where the versioning evolved to another scheme.
Return UINT_MAX which is guaranteed to be higher than existing
versions. This would also make it possible to easily identify
versions that do not start with an integer.
Signed-off-by: Luk Claes <luk@...>
---
utils/mount/version.h | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/utils/mount/version.h b/utils/mount/version.h
index af61a6f..531cf68 100644
--- a/utils/mount/version.h
+++ b/utils/mount/version.h
@@ -23,8 +23,8 @@
#ifndef _NFS_UTILS_MOUNT_VERSION_H
#define _NFS_UTILS_MOUNT_VERSION_H
-#include <stdlib.h>
-#include <string.h>
+#include <stdio.h>
+#include <limits.h>
#include <sys/utsname.h>
@@ -37,14 +37,16 @@ static inline unsigned int MAKE_VERSION(unsigned int p, unsigned int q,
static inline unsigned int linux_version_code(void)
{
struct utsname my_utsname;
- unsigned int p, q, r;
+ unsigned int p, q = 0, r = 0;
+ /* UINT_MAX as backward compatibility code should not be run */
if (uname(&my_utsname))
- return 0;
+ return UINT_MAX;
- p = (unsigned int)atoi(strtok(my_utsname.release, "."));
- q = (unsigned int)atoi(strtok(NULL, "."));
- r = (unsigned int)atoi(strtok(NULL, "."));
+ /* UINT_MAX as future versions might not start with an integer */
+ if (sscanf(my_utsname.release, "%u.%u.%u", &p, &q, &r) < 1)
+ return UINT_MAX;
+
return MAKE_VERSION(p, q, r);
}

315
core/nfs-utils/nfs-common Normal file
View file

@ -0,0 +1,315 @@
#!/bin/bash
daemon_name=nfs-common
NEED_STATD=
STATD_OPTS=
NEED_IDMAPD=
IDMAPD_OPTS=
NEED_GSSD=
GSSD_OPTS=
PIPEFS_MOUNTPOINT=
PIPEFS_MOUNTOPTS=
# rpc.statd daemon & binary location
STATD_DAEMON_NAME=rpc.statd
STATD="/usr/sbin/rpc.statd"
# rpc.idmapd daemon & binary location
IDMAPD_DAEMON_NAME=rpc.idmapd
IDMAPD="/usr/sbin/rpc.idmapd"
# rpc.gssd daemon & binary location
GSSD_DAEMON_NAME=rpc.gssd
GSSD="/usr/sbin/rpc.gssd"
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/$daemon_name.conf
# Default mountpoint and options for rpc_pipefs filesystem
[ -z "$PIPEFS_MOUNTPOINT" ] && PIPEFS_MOUNTPOINT="/var/lib/nfs/rpc_pipefs"
[ -z "$PIPEFS_MOUNTOPTS" ] && PIPEFS_MOUNTOPTS="defaults"
# Parse the fstab file, and determine whether we need idmapd and gssd. (The
# /etc/conf.d/nfs-common settings, if any, will override our autodetection.)
AUTO_NEED_IDMAPD=no
AUTO_NEED_GSSD=no
if [ -f /etc/fstab ]; then
exec 9<&0 </etc/fstab
while read DEV MTPT FSTYPE OPTS REST; do
if [ "$FSTYPE" = "nfs4" ]; then
AUTO_NEED_IDMAPD=yes
fi
case "$OPTS" in
sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5i,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*)
AUTO_NEED_GSSD=yes
;;
esac
done
exec 0<&9 9<&-
fi
# We also need idmapd if we run an NFSv4 server. It's fairly difficult
# to autodetect whether there are NFSv4 exports or not, and idmapd is not a
# particularily heavy daemon, so we auto-enable it if we find an /etc/exports
# file. This does not mean that there are NFSv4 or other mounts active (or
# even that nfs-kernel-server is installed), but it matches what the "start"
# condition in nfs-kernel-server's init script does, which has a value in
# itself.
if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports; then
AUTO_NEED_IDMAPD=yes
fi
case "$NEED_STATD" in
yes|no)
;;
*)
NEED_STATD=yes
;;
esac
case "$NEED_IDMAPD" in
yes|no)
;;
*)
NEED_IDMAPD=$AUTO_NEED_IDMAPD
;;
esac
case "$NEED_GSSD" in
yes|no)
;;
*)
NEED_GSSD=$AUTO_NEED_GSSD
;;
esac
do_modprobe() {
if [ -x /sbin/modprobe -a -f /proc/modules ]; then
modprobe -q "$1" || true
fi
}
do_mount() {
if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
return 1
fi
if grep -vw "$1" /proc/mounts &> /dev/null ; then
if ! mountpoint -q "$2" ; then
mount -t "$1" "$1" "$2" -o "$3"
return
fi
fi
return 0
}
do_umount() {
if mountpoint -q "$1" ; then
umount "$1"
fi
return 0
}
get_pid() {
pidof -o %PPID "$1"
}
case "$1" in
start)
ck_daemon rpcbind && { echo -n "Start rpcbind first." >&2; stat_die; }
rc=0
if [ "$NEED_STATD" = yes ]; then
stat_busy "Starting $STATD_DAEMON_NAME daemon"
PID=$(get_pid $STATD)
if [ -z "$PID" ]; then
[ -f /var/run/$STATD_DAEMON_NAME.pid ] && rm -f /var/run/$STATD_DAEMON_NAME.pid
# RUN
$STATD $STATD_OPTS
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
echo $(get_pid $STATD) > /var/run/$STATD_DAEMON_NAME.pid
stat_done
fi
else
stat_fail
exit 1
fi
# Run sm-notify
/usr/sbin/sm-notify $SMNOTIFY_OPTS
fi
if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]; then
stat_busy "Mounting pipefs filesystem"
do_modprobe sunrpc
do_modprobe nfs
do_modprobe nfsd
do_mount rpc_pipefs "$PIPEFS_MOUNTPOINT" "$PIPEFS_MOUNTOPTS"
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
stat_done
fi
if [ "$NEED_IDMAPD" = yes ]; then
stat_busy "Starting $IDMAPD_DAEMON_NAME daemon"
PID=$(get_pid $IDMAPD)
if [ -z "$PID" ]; then
[ -f /var/run/$IDMAPD_DAEMON_NAME.pid ] && rm -f /var/run/$IDMAPD_DAEMON_NAME.pid
# RUN
$IDMAPD $IDMAPD_OPTS
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
echo $(get_pid $IDMAPD) > /var/run/$IDMAPD_DAEMON_NAME.pid
stat_done
fi
else
stat_fail
exit 1
fi
fi
if [ "$NEED_GSSD" = yes ]; then
do_modprobe rpcsec_gss_krb5
stat_busy "Starting $GSSD_DAEMON_NAME daemon"
PID=$(get_pid $GSSD)
if [ -z "$PID" ]; then
[ -f /var/run/$GSSD_DAEMON_NAME.pid ] && rm -f /var/run/$GSSD_DAEMON_NAME.pid
# RUN
$GSSD $GSSD_OPTS
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
echo $(get_pid $GSSD) > /var/run/$GSSD_DAEMON_NAME.pid
stat_done
fi
else
stat_fail
exit 1
fi
fi
fi
add_daemon $daemon_name
;;
stop)
rc=0
if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]; then
if [ "$NEED_GSSD" = yes ]; then
stat_busy "Stopping $GSSD_DAEMON_NAME daemon"
PID=$(get_pid $GSSD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
rm -f /var/run/$GSSD_DAEMON_NAME.pid &> /dev/null
stat_done
fi
fi
if [ "$NEED_IDMAPD" = yes ]; then
stat_busy "Stopping $IDMAPD_DAEMON_NAME daemon"
PID=$(get_pid $IDMAPD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
rm -f /var/run/$IDMAPD_DAEMON_NAME.pid &> /dev/null
stat_done
fi
fi
do_umount "$PIPEFS_MOUNTPOINT" 2>/dev/null || true
fi
if [ "$NEED_STATD" = yes ]; then
stat_busy "Stopping $STATD_DAEMON_NAME daemon"
PID=$(get_pid $STATD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
rm -f /var/run/$STATD_DAEMON_NAME.pid &> /dev/null
stat_done
fi
fi
rm_daemon $daemon_name
;;
status)
stat_busy "Checking $daemon_name status";
ck_status $daemon_name
if [ "$NEED_STATD" = yes ]; then
stat_busy "Daemon $STATD_DAEMON_NAME running"
PID=$(get_pid $STATD)
if [ -z "$PID" ]; then
stat_fail
else
stat_done
fi
fi
if [ "$NEED_GSSD" = yes ]; then
stat_busy "Daemon $GSSD_DAEMON_NAME running"
PID=$(get_pid $GSSD)
if [ -z "$PID" ]; then
stat_fail
else
stat_done
fi
fi
if [ "$NEED_IDMAPD" = yes ]; then
stat_busy "Daemon $IDMAPD_DAEMON_NAME running"
PID=$(get_pid $IDMAPD)
if [ -z "$PID" ]; then
stat_fail
else
stat_done
fi
fi
echo
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|status|restart}"
esac
exit 0

View file

@ -0,0 +1,40 @@
# Parameters to be passed to nfs-common (nfs clients & server) init script.
#
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=""
# Options to pass to rpc.statd.
# See rpc.statd(8) for more details.
# N.B. statd normally runs on both client and server, and run-time
# options should be specified accordingly.
# STATD_OPTS="-p 32765 -o 32766"
STATD_OPTS=""
# Options to pass to sm-notify
# e.g. SMNOTIFY_OPTS="-p 32764"
SMNOTIFY_OPTS=""
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=""
# Options to pass to rpc.idmapd.
# See rpc.idmapd(8) for more details.
IDMAPD_OPTS=""
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=""
# Options to pass to rpc.gssd.
# See rpc.gssd(8) for more details.
GSSD_OPTS=""
# Where to mount rpc_pipefs filesystem; the default is "/var/lib/nfs/rpc_pipefs".
PIPEFS_MOUNTPOINT=""
# Options used to mount rpc_pipefs filesystem; the default is "defaults".
PIPEFS_MOUNTOPTS=""

299
core/nfs-utils/nfs-server Normal file
View file

@ -0,0 +1,299 @@
#!/bin/bash
daemon_name=nfs-server
NFSD_COUNT=
NFSD_OPTS=
NEED_SVCGSSD=
SVCGSSD_OPTS=
MOUNTD_OPTS=
PROCNFSD_MOUNTPOINT=
PROCNFSD_MOUNTOPTS=
# rpc.nfsd daemon & binary location
NFSD_PROCESS_NAME=nfsd
NFSD_DAEMON_NAME=rpc.nfsd
NFSD="/usr/sbin/rpc.nfsd"
# rpc.svcgssd daemon & binary location
SVCGSSD_DAEMON_NAME=rpc.svcgssd
SVCGSSD="/usr/sbin/rpc.svcgssd"
# rpc.idmapd daemon & binary location
IDMAPD_DAEMON_NAME=rpc.idmapd
IDMAPD="/usr/sbin/rpc.idmapd"
# rpc.mountd daemon & binary location
MOUNTD_DAEMON_NAME=rpc.mountd
MOUNTD="/usr/sbin/rpc.mountd"
# exortfs binary location
EXPORTFS="/usr/sbin/exportfs"
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/$daemon_name.conf
# Default number of nfsd servers
[ -z "$NFSD_COUNT" ] && NFSD_COUNT=8
# Default mountpoint and options for nfsd filesystem
[ -z "$PROCNFSD_MOUNTPOINT" ] && PROCNFSD_MOUNTPOINT="/proc/fs/nfsd"
[ -z "$PROCNFSD_MOUNTOPTS" ] && PROCNFSD_MOUNTOPTS="rw,nodev,noexec,nosuid"
case "$NEED_SVCGSSD" in
yes|no)
;;
*)
NEED_SVCGSSD=no
;;
esac
do_modprobe() {
if [ -x /sbin/modprobe -a -f /proc/modules ]; then
modprobe -q "$1" || true
fi
}
do_mount() {
if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
return 1
fi
if grep -vw "$1" /proc/mounts &> /dev/null ; then
if ! mountpoint -q "$2" ; then
mount -t "$1" "$1" "$2" -o "$3"
return
fi
fi
return 0
}
do_umount() {
if mountpoint -q "$1" ; then
umount "$1"
fi
return 0
}
get_pid() {
pidof -o %PPID "$1"
}
case "$1" in
start)
ck_daemon nfs-common && { echo -n "Start nfs-common first." >&2; stat_die; }
rc=0
stat_busy "Mounting nfsd filesystem"
do_modprobe nfsd
do_mount nfsd "$PROCNFSD_MOUNTPOINT" "$PROCNFSD_MOUNTOPTS"
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
stat_done
fi
stat_busy "Exporting all directories"
$EXPORTFS -r
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
stat_done
fi
stat_busy "Starting $NFSD_DAEMON_NAME daemon"
PID=$(get_pid $NFSD_PROCESS_NAME)
if [ -z "$PID" ]; then
[ -f /var/run/$NFSD_DAEMON_NAME.pid ] && rm -f /var/run/$NFSD_DAEMON_NAME.pid
# RUN
$NFSD $NFSD_OPTS $NFSD_COUNT
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
echo $(get_pid $NFSD_PROCESS_NAME) > /var/run/$NFSD_DAEMON_NAME.pid
stat_done
fi
else
stat_fail
exit 1
fi
if [ "$NEED_SVCGSSD" = yes ]; then
do_modprobe rpcsec_gss_krb5
stat_busy "Starting $SVCGSSD_DAEMON_NAME daemon"
PID=$(get_pid $SVCGSSD)
if [ -z "$PID" ]; then
[ -f /var/run/$SVCGSSD_DAEMON_NAME.pid ] && rm -f /var/run/$SVCGSSD_DAEMON_NAME.pid
# RUN
$SVCGSSD $SVCGSSD_OPTS
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
echo $(get_pid $SVCGSSD) > /var/run/$SVCGSSD_DAEMON_NAME.pid
stat_done
fi
else
stat_fail
exit 1
fi
fi
PID=$(get_pid $IDMAPD)
[ ! -z "$PID" ] && kill -SIGHUP $IDMAPD_DAEMON_NAME &> /dev/null
stat_busy "Starting $MOUNTD_DAEMON_NAME daemon"
PID=$(get_pid $MOUNTD)
if [ -z "$PID" ]; then
[ -f /var/run/$MOUNTD_DAEMON_NAME.pid ] && rm -f /var/run/$MOUNTD_DAEMON_NAME.pid
# RUN
$MOUNTD $MOUNTD_OPTS
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
echo $(get_pid $MOUNTD) > /var/run/$MOUNTD_DAEMON_NAME.pid
stat_done
fi
else
stat_fail
exit 1
fi
add_daemon $daemon_name
;;
stop)
rc=0
stat_busy "Stopping $MOUNTD_DAEMON_NAME daemon"
PID=$(get_pid $MOUNTD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
rm -f /var/run/$MOUNTD_DAEMON_NAME.pid &> /dev/null
stat_done
fi
if [ "$NEED_SVCGSSD" = yes ]; then
stat_busy "Stopping $SVCGSSD_DAEMON_NAME daemon"
PID=$(get_pid $SVCGSSD)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
rm -f /var/run/$SVCGSSD_DAEMON_NAME.pid &> /dev/null
stat_done
fi
fi
stat_busy "Stopping $NFSD_DAEMON_NAME daemon"
PID=$(get_pid $NFSD_PROCESS_NAME)
# KILL (SIGINT)
[ ! -z "$PID" ] && kill -2 $PID &> /dev/null
#
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
sleep 1
PID=$(get_pid $NFSD_PROCESS_NAME)
# KILL (KILL) - just to be sure
[ ! -z "$PID" ] && kill -9 $PID &> /dev/null
#
rm -f /var/run/$NFSD_DAEMON_NAME.pid &> /dev/null
stat_done
fi
stat_busy "Unexporting all directories"
$EXPORTFS -au
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
stat_done
fi
# flush everything out of the kernels export table
if mountpoint -q "$PROCNFSD_MOUNTPOINT" ; then
$EXPORTFS -f
fi
do_umount "$PROCNFSD_MOUNTPOINT" 2>/dev/null || true
rm_daemon $daemon_name
;;
status)
stat_busy "Checking $daemon_name status";
ck_status $daemon_name
stat_busy "Daemon $NFSD_DAEMON_NAME running"
PID=$(get_pid $NFSD_PROCESS_NAME)
if [ -z "$PID" ]; then
stat_fail
else
stat_done
fi
stat_busy "Daemon $MOUNTD_DAEMON_NAME running"
PID=$(get_pid $MOUNTD)
if [ -z "$PID" ]; then
stat_fail
else
stat_done
fi
if [ "$NEED_SVCGSSD" = yes ]; then
stat_busy "Daemon $SVCGSSD_DAEMON_NAME running"
PID=$(get_pid $SVCGSSD)
if [ -z "$PID" ]; then
stat_fail
else
stat_done
fi
fi
echo
;;
reload)
rc=0
stat_busy "Re-exporting all directories"
$EXPORTFS -r
rc=$(($rc+$?))
if [ $rc -gt 0 ]; then
stat_fail
exit $rc
else
stat_done
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|status|reload|restart}"
esac
exit 0

View file

@ -0,0 +1,29 @@
# Parameters to be passed to nfs-server init script.
#
# Options to pass to rpc.nfsd.
# See rpc.nfsd(8) for more details.
NFSD_OPTS=""
# Number of servers to start up; the default is 8 servers.
NFSD_COUNT=""
# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd".
PROCNFSD_MOUNTPOINT=""
# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid".
PROCNFSD_MOUNTOPTS=""
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option.
# See rpc.mountd(8) for more details.
MOUNTD_OPTS="--no-nfs-version 2"
# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=""
# Options to pass to rpc.svcgssd.
# See rpc.svcgssd(8) for more details.
SVCGSSD_OPTS=""

View file

@ -0,0 +1,138 @@
diff -NaurwB nfs-utils-1.1.2.orig/aclocal/kerberos5.m4 nfs-utils-1.1.2/aclocal/kerberos5.m4
--- nfs-utils-1.1.2.orig/aclocal/kerberos5.m4 2008-03-14 16:46:29.000000000 +0100
+++ nfs-utils-1.1.2/aclocal/kerberos5.m4 2008-06-12 17:13:51.000000000 +0200
@@ -1,112 +1,48 @@
-dnl Checks for Kerberos
-dnl NOTE: while we intend to do generic gss-api, currently we
-dnl have a requirement to get an initial Kerberos machine
-dnl credential. Thus, the requirement for Kerberos.
-dnl The Kerberos gssapi library will be dynamically loaded?
AC_DEFUN([AC_KERBEROS_V5],[
+ K5CONFIG="krb5-config"
AC_MSG_CHECKING(for Kerberos v5)
- AC_ARG_WITH(krb5,
- [AC_HELP_STRING([--with-krb5=DIR], [use Kerberos v5 installation in DIR])],
+ AC_ARG_WITH(krb5-config,
+ [AC_HELP_STRING([--with-krb5-config=PATH], [Full Path to krb5-config.])],
[ case "$withval" in
yes|no)
- krb5_with=""
+ K5CONFIG="krb5-config"
;;
*)
- krb5_with="$withval"
+ K5CONFIG="$withval"
;;
esac ]
)
- for dir in $krb5_with /usr /usr/kerberos /usr/local /usr/local/krb5 \
- /usr/krb5 /usr/heimdal /usr/local/heimdal /usr/athena ; do
- dnl This ugly hack brought on by the split installation of
- dnl MIT Kerberos on Fedora Core 1
- K5CONFIG=""
- if test -f $dir/bin/krb5-config; then
- K5CONFIG=$dir/bin/krb5-config
- elif test -f "/usr/kerberos/bin/krb5-config"; then
- K5CONFIG="/usr/kerberos/bin/krb5-config"
- elif test -f "/usr/lib/mit/bin/krb5-config"; then
- K5CONFIG="/usr/lib/mit/bin/krb5-config"
- fi
if test "$K5CONFIG" != ""; then
KRBCFLAGS=`$K5CONFIG --cflags`
KRBLIBS=`$K5CONFIG --libs gssapi`
- K5VERS=`$K5CONFIG --version | head -n 1 | awk '{split($(4),v,"."); if (v@<:@"3"@:>@ == "") v@<:@"3"@:>@ = "0"; print v@<:@"1"@:>@v@<:@"2"@:>@v@<:@"3"@:>@ }'`
- AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
- if test -f $dir/include/gssapi/gssapi_krb5.h -a \
- \( -f $dir/lib/libgssapi_krb5.a -o \
- -f $dir/lib64/libgssapi_krb5.a -o \
- -f $dir/lib64/libgssapi_krb5.so -o \
- -f $dir/lib/libgssapi_krb5.so \) ; then
+ if $K5CONFIG --version | grep -q -e heimdal; then
+ K5VERS=`$K5CONFIG --version | head -n 1 | cut -f2 -d ' ' | tr -d '.'`
+ AC_DEFINE(HAVE_HEIMDAL, 1, [Define this if you have Heimdal Kerberos libraries])
+ gssapi_lib=gssapi
+ KRBIMPL="heimdal"
+ elif $K5CONFIG --version | grep -q -e mit; then
+ K5VERS=`$K5CONFIG --version | head -n 1 | cut -f4 -d ' ' | tr -d '.'`
AC_DEFINE(HAVE_KRB5, 1, [Define this if you have MIT Kerberos libraries])
- KRBDIR="$dir"
- dnl If we are using MIT K5 1.3.1 and before, we *MUST* use the
- dnl private function (gss_krb5_ccache_name) to get correct
- dnl behavior of changing the ccache used by gssapi.
- dnl Starting in 1.3.2, we *DO NOT* want to use
- dnl gss_krb5_ccache_name, instead we want to set KRB5CCNAME
- dnl to get gssapi to use a different ccache
if test $K5VERS -le 131; then
AC_DEFINE(USE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the private function, gss_krb5_cache_name, must be used to tell the Kerberos library which credentials cache to use. Otherwise, this is done by setting the KRB5CCNAME environment variable])
fi
gssapi_lib=gssapi_krb5
- break
- dnl The following ugly hack brought on by the split installation
- dnl of Heimdal Kerberos on SuSe
- elif test \( -f $dir/include/heim_err.h -o\
- -f $dir/include/heimdal/heim_err.h \) -a \
- -f $dir/lib/libroken.a; then
- AC_DEFINE(HAVE_HEIMDAL, 1, [Define this if you have Heimdal Kerberos libraries])
- KRBDIR="$dir"
- gssapi_lib=gssapi
- break
- fi
- fi
- done
- dnl We didn't find a usable Kerberos environment
- if test "x$KRBDIR" = "x"; then
- if test "x$krb5_with" = "x"; then
- AC_MSG_ERROR(Kerberos v5 with GSS support not found: consider --disable-gss or --with-krb5=)
+ KRBIMPL="mit-krb5"
else
- AC_MSG_ERROR(Kerberos v5 with GSS support not found at $krb5_with)
- fi
+ AC_MSG_ERROR(Unknown Kerberos 5 Implementation. Is neither heimdal or mit-krb5.)
+ KRBIMPL="unknown"
fi
- AC_MSG_RESULT($KRBDIR)
-
- dnl Check if -rpath=$(KRBDIR)/lib is needed
- echo "The current KRBDIR is $KRBDIR"
- if test "$KRBDIR/lib" = "/lib" -o "$KRBDIR/lib" = "/usr/lib" \
- -o "$KRBDIR/lib" = "//lib" -o "$KRBDIR/lib" = "/usr//lib" ; then
- KRBLDFLAGS="";
- elif /sbin/ldconfig -p | grep > /dev/null "=> $KRBDIR/lib/"; then
- KRBLDFLAGS="";
- else
- KRBLDFLAGS="-Wl,-rpath=$KRBDIR/lib"
+ AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
fi
+ AC_MSG_RESULT($KRBIMPL)
- dnl Now check for functions within gssapi library
- AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,
- AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIBS)
- AC_CHECK_LIB($gssapi_lib, gss_krb5_set_allowable_enctypes,
- AC_DEFINE(HAVE_SET_ALLOWABLE_ENCTYPES, 1, [Define this if the Kerberos GSS library supports gss_krb5_set_allowable_enctypes]), ,$KRBLIBS)
- AC_CHECK_LIB($gssapi_lib, gss_krb5_ccache_name,
- AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the Kerberos GSS library supports gss_krb5_ccache_name]), ,$KRBLIBS)
-
- dnl Check for newer error message facility
- AC_CHECK_LIB($gssapi_lib, krb5_get_error_message,
- AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE, 1, [Define this if the function krb5_get_error_message is available]), ,$KRBLIBS)
+ AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context, AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIBS)
+ AC_CHECK_LIB($gssapi_lib, gss_krb5_set_allowable_enctypes, AC_DEFINE(HAVE_SET_ALLOWABLE_ENCTYPES, 1, [Define this if the Kerberos GSS library supports gss_krb5_set_allowable_enctypes]), ,$KRBLIBS)
+ AC_CHECK_LIB($gssapi_lib, gss_krb5_ccache_name, AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the Kerberos GSS library supports gss_krb5_ccache_name]), ,$KRBLIBS)
+ AC_CHECK_LIB($gssapi_lib, krb5_get_error_message, AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE, 1, [Define this if the function krb5_get_error_message is available]), ,$KRBLIBS)
+ AC_CHECK_LIB($gssapi_lib, krb5_get_init_creds_opt_set_addressless, AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS, 1, [Define this if the function krb5_get_init_creds_opt_set_addressless is available]), ,$KRBLIBS)
- dnl Check for function to specify addressless tickets
- AC_CHECK_LIB($gssapi_lib, krb5_get_init_creds_opt_set_addressless,
- AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS, 1, [Define this if the function krb5_get_init_creds_opt_set_addressless is available]), ,$KRBLIBS)
-
- dnl If they specified a directory and it didn't work, give them a warning
- if test "x$krb5_with" != "x" -a "$krb5_with" != "$KRBDIR"; then
- AC_MSG_WARN(Using $KRBDIR instead of requested value of $krb5_with for Kerberos!)
- fi
-
- AC_SUBST([KRBDIR])
AC_SUBST([KRBLIBS])
AC_SUBST([KRBCFLAGS])
AC_SUBST([KRBLDFLAGS])

View file

@ -0,0 +1,39 @@
ripped from Debian
--- nfs-utils-1.1.4/utils/mount/fstab.c
+++ nfs-utils-1.1.4/utils/mount/fstab.c
@@ -57,7 +57,7 @@ mtab_does_not_exist(void) {
return var_mtab_does_not_exist;
}
-static int
+int
mtab_is_a_symlink(void) {
get_mtab_info();
return var_mtab_is_a_symlink;
--- nfs-utils-1.1.4/utils/mount/fstab.h
+++ nfs-utils-1.1.4/utils/mount/fstab.h
@@ -7,6 +7,7 @@
#define _PATH_FSTAB "/etc/fstab"
#endif
+int mtab_is_a_symlink(void);
int mtab_is_writable(void);
int mtab_does_not_exist(void);
void reset_mtab_info(void);
--- nfs-utils-1.1.4/utils/mount/mount.c
+++ nfs-utils-1.1.4/utils/mount/mount.c
@@ -230,6 +230,13 @@ create_mtab (void) {
int flags;
mntFILE *mfp;
+ /* Avoid writing if the mtab is a symlink to /proc/mounts, since
+ that would create a file /proc/mounts in case the proc filesystem
+ is not mounted, and the fchmod below would also fail. */
+ if (mtab_is_a_symlink()) {
+ return EX_SUCCESS;
+ }
+
lock_mtab();
mfp = nfs_setmntent (MOUNTED, "a+");

View file

@ -0,0 +1,15 @@
ripped from Debian
--- nfs-utils-1.1.2/utils/mount/mount.c
+++ nfs-utils-1.1.2/utils/mount/mount.c
@@ -381,10 +381,6 @@
mount_error(NULL, mount_point, ENOTDIR);
return 1;
}
- if (access(mount_point, X_OK) < 0) {
- mount_error(NULL, mount_point, errno);
- return 1;
- }
return 0;
}

View file

@ -0,0 +1,69 @@
diff -Naur nfs-utils-1.1.6.orig/utils/gssd/krb5_util.c nfs-utils-1.1.6/utils/gssd/krb5_util.c
--- utils/gssd/krb5_util.c 2009-04-20 19:32:50.000000000 +0200
+++ utils/gssd/krb5_util.c 2009-04-20 20:57:31.000000000 +0200
@@ -940,9 +940,37 @@
{
krb5_error_code ret;
krb5_creds creds;
- krb5_cc_cursor cur;
int found = 0;
+#ifdef HAVE_HEIMDAL
+ krb5_creds pattern;
+ krb5_realm *client_realm;
+
+ krb5_cc_clear_mcred(&pattern);
+
+ client_realm = krb5_princ_realm (context, principal);
+
+ ret = krb5_make_principal (context, &pattern.server,
+ *client_realm, KRB5_TGS_NAME, *client_realm,
+ NULL);
+ if (ret)
+ krb5_err (context, 1, ret, "krb5_make_principal");
+ pattern.client = principal;
+
+ ret = krb5_cc_retrieve_cred (context, ccache, 0, &pattern, &creds);
+ krb5_free_principal (context, pattern.server);
+ if (ret) {
+ if (ret == KRB5_CC_END)
+ return 1;
+ krb5_err (context, 1, ret, "krb5_cc_retrieve_cred");
+ }
+
+ found = creds.times.endtime > time(NULL);
+
+ krb5_free_cred_contents (context, &creds);
+#else
+ krb5_cc_cursor cur;
+
ret = krb5_cc_start_seq_get(context, ccache, &cur);
if (ret)
return 0;
@@ -962,6 +990,7 @@
krb5_free_cred_contents(context, &creds);
}
krb5_cc_end_seq_get(context, ccache, &cur);
+#endif
return found;
}
@@ -1008,6 +1037,9 @@
}
krb5_free_principal(context, principal);
err_princ:
+#ifdef HAVE_HEIMDAL
+#define KRB5_TC_OPENCLOSE 0x00000001
+#endif
krb5_cc_set_flags(context, ccache, KRB5_TC_OPENCLOSE);
krb5_cc_close(context, ccache);
err_cache:
@@ -1262,7 +1294,7 @@
if (context != NULL) {
origmsg = krb5_get_error_message(context, code);
msg = strdup(origmsg);
- krb5_free_error_message(context, origmsg);
+ krb5_free_error_string(context, origmsg);
}
#endif
if (msg != NULL)

View file

@ -0,0 +1,57 @@
Index: nfs-utils-1.1.6/utils/gssd/context_lucid.c
===================================================================
--- nfs-utils-1.1.6.orig/utils/gssd/context_lucid.c
+++ nfs-utils-1.1.6/utils/gssd/context_lucid.c
@@ -51,8 +51,10 @@
#include "context.h"
#ifndef OM_uint64
+#ifndef GSSAPI_GSSAPI_H_
typedef uint64_t OM_uint64;
#endif
+#endif
static int
write_lucid_keyblock(char **p, char *end, gss_krb5_lucid_key_t *key)
@@ -177,10 +179,10 @@
int retcode = 0;
printerr(2, "DEBUG: serialize_krb5_ctx: lucid version!\n");
- maj_stat = gss_export_lucid_sec_context(&min_stat, &ctx,
+ maj_stat = gss_krb5_export_lucid_sec_context(&min_stat, &ctx,
1, &return_ctx);
if (maj_stat != GSS_S_COMPLETE) {
- pgsserr("gss_export_lucid_sec_context",
+ pgsserr("gss_krb5_export_lucid_sec_context",
maj_stat, min_stat, &krb5oid);
goto out_err;
}
@@ -204,9 +206,9 @@
else
retcode = prepare_krb5_rfc_cfx_buffer(lctx, buf, endtime);
- maj_stat = gss_free_lucid_sec_context(&min_stat, ctx, return_ctx);
+ maj_stat = gss_krb5_free_lucid_sec_context(&min_stat, ctx);
if (maj_stat != GSS_S_COMPLETE) {
- pgsserr("gss_export_lucid_sec_context",
+ pgsserr("gss_krb5_export_lucid_sec_context",
maj_stat, min_stat, &krb5oid);
printerr(0, "WARN: failed to free lucid sec context\n");
}
Index: nfs-utils-1.1.6/utils/gssd/krb5_util.c
===================================================================
--- nfs-utils-1.1.6.orig/utils/gssd/krb5_util.c
+++ nfs-utils-1.1.6/utils/gssd/krb5_util.c
@@ -332,10 +332,10 @@
return -1;
}
- maj_stat = gss_set_allowable_enctypes(&min_stat, credh, &krb5oid,
+ maj_stat = gss_krb5_set_allowable_enctypes(&min_stat, credh,
num_enctypes, &enctypes);
if (maj_stat != GSS_S_COMPLETE) {
- pgsserr("gss_set_allowable_enctypes",
+ pgsserr("gss_krb5_set_allowable_enctypes",
maj_stat, min_stat, &krb5oid);
gss_release_cred(&min_stat, &credh);
return -1;

View file

@ -0,0 +1,32 @@
## arg 1: the new package version
post_install() {
cat << 'EOM'
==> PLEASE NOTE:
==> Extended configuration options for NFS (clients & server) are available in
==> /etc/conf.d/nfs-common.conf and in /etc/conf.d/nfs-server.conf
==>
==> Please refer to http://wiki.archlinux.org/index.php/Nfs
==> for further information on NFS; for NFSv4, refer to
==> http://wiki.archlinux.org/index.php/NFSv4
EOM
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
if [ "$(vercmp $2 1.2.0-2)" -lt 0 ]; then
cat << 'EOM'
==> IMPORTANT NFS UTILS CHANGES:
==> This is a rather important upgrade, you are going to have to change config files.
==> /etc/rc.conf daemons changes:
==> Change portmap to rpcbind
==> Change nfslock to nfs-common
==> Change nfsd to nfs-server
==>
==> Extended configuration options for NFS (clients & server) are available in:
==> /etc/conf.d/nfs-common
==> /etc/conf.d/nfs-server
==> Please change them to your needs.
EOM
fi
}

View file

@ -0,0 +1,22 @@
--- utils/statd/start-statd 2007-05-11 04:40:57.000000000 +0100
+++ utils/statd/start-statd.new 2007-09-21 17:11:34.000000000 +0100
@@ -1,9 +1,16 @@
-#!/bin/bash -p
+#!/bin/sh
+
+# Original script provided by the NFS project
+# Modified for Arch Linux by Tom Killian
+
# nfsmount calls this script when mounting a filesystem with locking
# enabled, but when statd does not seem to be running (based on
# /var/run/rpc.statd.pid).
# It should run statd with whatever flags are apropriate for this
# site.
-PATH=/sbin:/usr/sbin
-exec rpc.statd --no-notify
+
+# source application-specific settings
+[ -f /etc/conf.d/nfs-common.conf ] && . /etc/conf.d/nfs-common.conf
+
+exec /usr/sbin/rpc.statd $STATD_OPTS