From 28ad9d98caaf64ea99877869bc8b70ca266e8a4e Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Wed, 17 Nov 2010 21:20:10 +0000
Subject: nfs-utils: up to latest

---
 abs/core/nfs-utils/PKGBUILD                        |  99 +++++--
 abs/core/nfs-utils/exports                         |  19 +-
 abs/core/nfs-utils/idmapd.conf                     |  14 +
 abs/core/nfs-utils/nfs-common                      | 317 +++++++++++++++++++++
 abs/core/nfs-utils/nfs-common.conf                 |  40 +++
 abs/core/nfs-utils/nfs-server                      | 303 ++++++++++++++++++++
 abs/core/nfs-utils/nfs-server.conf                 |  29 ++
 .../nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch    | 138 +++++++++
 abs/core/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch  |  39 +++
 abs/core/nfs-utils/nfs-utils-1.1.4-no-exec.patch   |  15 +
 .../nfs-utils-1.1.6-heimdal_functions.patch        |  69 +++++
 .../nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch   |  57 ++++
 abs/core/nfs-utils/nfs-utils.install               |  48 ++--
 abs/core/nfs-utils/start-statd.patch               |   5 +-
 14 files changed, 1127 insertions(+), 65 deletions(-)
 create mode 100644 abs/core/nfs-utils/idmapd.conf
 create mode 100644 abs/core/nfs-utils/nfs-common
 create mode 100644 abs/core/nfs-utils/nfs-common.conf
 create mode 100644 abs/core/nfs-utils/nfs-server
 create mode 100644 abs/core/nfs-utils/nfs-server.conf
 create mode 100644 abs/core/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch
 create mode 100644 abs/core/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch
 create mode 100644 abs/core/nfs-utils/nfs-utils-1.1.4-no-exec.patch
 create mode 100644 abs/core/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
 create mode 100644 abs/core/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch

diff --git a/abs/core/nfs-utils/PKGBUILD b/abs/core/nfs-utils/PKGBUILD
index 32626c6..cbc3999 100644
--- a/abs/core/nfs-utils/PKGBUILD
+++ b/abs/core/nfs-utils/PKGBUILD
@@ -1,48 +1,87 @@
-# $Id: PKGBUILD 13100 2008-09-25 22:15:28Z ronald $
-# Maintainer: dorphell <dorphell@archlinux.org>
+# $Id: PKGBUILD 97759 2010-11-01 20:06:42Z 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>
 
 pkgname=nfs-utils
-pkgver=1.1.3
-pkgrel=2
+pkgver=1.2.2
+pkgrel=4
 pkgdesc="Support programs for Network File Systems"
 arch=('i686' 'x86_64')
 url='http://nfs.sourceforge.net'
 license=('GPL')
-backup=('etc/exports' 'etc/conf.d/nfs')
-depends=('glibc' 'tcp_wrappers' 'e2fsprogs' 'portmap' 'nfsidmap' 'libevent>=1.3e')
-source=(http://downloads.sourceforge.net/nfs/${pkgname}-${pkgver}.tar.gz
-	nfsd
-	nfslock
+backup=(etc/{exports,idmapd.conf} etc/conf.d/{nfs-common.conf,nfs-server.conf})
+depends=('glibc' 'tcp_wrappers' 'e2fsprogs' 'rpcbind' 'libtirpc>=0.2.1' 'librpcsecgss>=0.19-2' 'nfsidmap' 'libevent>=1.3e' 'libgssglue')
+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
-	nfs.conf.d
-	start-statd.patch)
+	idmapd.conf
+	start-statd.patch
+	nfs-utils-1.1.2-kerberos-ac.patch
+	nfs-utils-1.1.6-no_libgssapi.patch
+	nfs-utils-1.1.6-heimdal_functions.patch
+	nfs-utils-1.1.4-mtab-sym.patch
+	nfs-utils-1.1.4-no-exec.patch)
 install=nfs-utils.install
-md5sums=('167d231850b00c7c63300747aeb94c38'
-         '5a9436e492e68efaf801b9c496684541'
-         '5d0d31f27f2319747d4499df11485ae7'
-         '1358d29a549dfc37b522c35e823c6813'
-         'b4aae6963ec25d226eb2d97214f5bb18'
-         '9c8aeff40ca25312328afe3b7fad293f')
 
 build() {
   cd $srcdir/${pkgname}-${pkgver}
-  
+  # Patches from gentoo for heimdal compatibility Bug 231396
+  # http://bugs.gentoo.org/show_bug.cgi?id=231396
+  patch -Np1 -i ../nfs-utils-1.1.2-kerberos-ac.patch 
+  patch -Np1 -i ../nfs-utils-1.1.6-no_libgssapi.patch 
+  patch -Np0 -i ../nfs-utils-1.1.6-heimdal_functions.patch
+  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 ../start-statd.patch || return 1
-  
-  ./configure --prefix=/usr --enable-nfsv3 --disable-gss \
-    --with-statedir=/var/lib/nfs --sysconfdir=/etc
-  
+  patch -Np0 -i $srcdir/start-statd.patch
+
+  rm -f config.guess config.sub ltmain.sh
+  autoreconf -i
+
+  export GSSGLUE_CFLAGS='-I/usr/include/gssapi'
+  export GSSGLUE_LIBS='-lgssapi -ldl'
+
+  ./configure --prefix=/usr --enable-nfsv3 --enable-nfsv4 --enable-gss \
+              --with-tcp-wrappers --with-statedir=/var/lib/nfs --enable-ipv6 --sysconfdir=/etc
+
+  unset LDFLAGS
   make || return 1
+}
+
+package() {
+  cd $srcdir/${pkgname}-${pkgver}
   make DESTDIR=$pkgdir install || return 1
 
-  install -D -m 755 ../nfsd ${startdir}/pkg/etc/rc.d/nfsd
-  install -D -m 755 ../nfslock ${startdir}/pkg/etc/rc.d/nfslock
-  install -D -m 644 ../exports ${startdir}/pkg/etc/exports
-  install -D -m 644 ../nfs.conf.d ${startdir}/pkg/etc/conf.d/nfs
-  
-  install -d $pkgdir/var/lib/nfs/v4recovery
+  # 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/"var/lib/nfs/rpc_pipefs
+  mkdir "$pkgdir/"var/lib/nfs/v4recovery
 }
-
+md5sums=('dad92f64db3266c7757f71bb53ee8f35'
+         '1beda3420086f1801a7228c06d80fb4e'
+         'f73f197a16b02c3e248488ec35c4cf43'
+         '5ae080f6117cef3140f02bc162bdc755'
+         'b9b334414baec31b97f0431d9ecdcfb9'
+         'ff585faf410a62c4333a027c50b56bae'
+         'eb4f4027fab6fc1201f1ca04f5954c76'
+         'e24f81a8c8657672e262c61235d34b4a'
+         'f3be115d392d9f9bb0f056e8d4341a14'
+         '20c6fae1c771b9d8e91c4973f16372e3'
+         'e6fd3a8acfe97970a53db1b902c34f45'
+         '7674106eaaa4c149bccd4f05fe3604e9'
+         '4f4827dfc93008dfadd0a530ad0872b2')
diff --git a/abs/core/nfs-utils/exports b/abs/core/nfs-utils/exports
index c9f93c6..8f4aac5 100644
--- a/abs/core/nfs-utils/exports
+++ b/abs/core/nfs-utils/exports
@@ -1,8 +1,15 @@
 # /etc/exports
 #
-# See exports(5) for a description.
-
-# use exportfs -arv to reread
-#/export    192.168.1.10(rw,no_root_squash)
-
-
+# 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)
+#
diff --git a/abs/core/nfs-utils/idmapd.conf b/abs/core/nfs-utils/idmapd.conf
new file mode 100644
index 0000000..b1b23af
--- /dev/null
+++ b/abs/core/nfs-utils/idmapd.conf
@@ -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
diff --git a/abs/core/nfs-utils/nfs-common b/abs/core/nfs-utils/nfs-common
new file mode 100644
index 0000000..9902ec4
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-common
@@ -0,0 +1,317 @@
+#!/bin/bash
+
+daemon_name=nfs-common
+
+# daemon dependencies
+DAEMON_DEPENDS=('rpcbind')
+
+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_depends ${DAEMON_DEPENDS[@]}
+
+    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
+      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
+	    
\ No newline at end of file
diff --git a/abs/core/nfs-utils/nfs-common.conf b/abs/core/nfs-utils/nfs-common.conf
new file mode 100644
index 0000000..12466b3
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-common.conf
@@ -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=""
diff --git a/abs/core/nfs-utils/nfs-server b/abs/core/nfs-utils/nfs-server
new file mode 100644
index 0000000..9574cbc
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-server
@@ -0,0 +1,303 @@
+#!/bin/bash
+
+daemon_name=nfs-server
+
+# daemon dependencies
+DAEMON_DEPENDS=('nfs-common')
+
+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_depends ${DAEMON_DEPENDS[@]}
+
+    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
diff --git a/abs/core/nfs-utils/nfs-server.conf b/abs/core/nfs-utils/nfs-server.conf
new file mode 100644
index 0000000..cf75fb6
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-server.conf
@@ -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 1 --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=""
diff --git a/abs/core/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch b/abs/core/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch
new file mode 100644
index 0000000..4a5a138
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-utils-1.1.2-kerberos-ac.patch
@@ -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])
diff --git a/abs/core/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch b/abs/core/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch
new file mode 100644
index 0000000..c9e60af
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch
@@ -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+");
diff --git a/abs/core/nfs-utils/nfs-utils-1.1.4-no-exec.patch b/abs/core/nfs-utils/nfs-utils-1.1.4-no-exec.patch
new file mode 100644
index 0000000..ea50a21
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-utils-1.1.4-no-exec.patch
@@ -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;
+ }
diff --git a/abs/core/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch b/abs/core/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
new file mode 100644
index 0000000..7f6c7a7
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
@@ -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)
diff --git a/abs/core/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch b/abs/core/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch
new file mode 100644
index 0000000..917136a
--- /dev/null
+++ b/abs/core/nfs-utils/nfs-utils-1.1.6-no_libgssapi.patch
@@ -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;
diff --git a/abs/core/nfs-utils/nfs-utils.install b/abs/core/nfs-utils/nfs-utils.install
index 380fc99..7dcdf95 100644
--- a/abs/core/nfs-utils/nfs-utils.install
+++ b/abs/core/nfs-utils/nfs-utils.install
@@ -1,38 +1,32 @@
-
-
+## arg 1:  the new package version
 post_install() {
-  cat << 'EOM'
-  
-  ==>
+cat << 'EOM'
   ==> PLEASE NOTE:
-  ==> Extended configuration options for NFS are available in
-  ==> /etc/conf.d/nfs.
+  ==> 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.
-  ==>
-
+  ==> 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() {
-  cat << 'EOM'
-  
+  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
   ==>
-  ==> PLEASE NOTE:
-  ==> Extended configuration options for NFS are now available in
-  ==> /etc/conf.d/nfs.
-  ==> If /etc/conf.d/nfsd remains on your system from an earlier
-  ==> installation, transfer its settings to /etc/conf.d/nfs and
-  ==> delete it.
-  ==>
-  ==> Please refer to http://wiki.archlinux.org/index.php/Nfs
-  ==> for further information.
-  ==>
-
+  ==> 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
 }
-      
-op=$1
-shift
-$op $*
diff --git a/abs/core/nfs-utils/start-statd.patch b/abs/core/nfs-utils/start-statd.patch
index aaed93e..38c60a7 100644
--- a/abs/core/nfs-utils/start-statd.patch
+++ b/abs/core/nfs-utils/start-statd.patch
@@ -1,7 +1,8 @@
 --- 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/sh
+-#!/bin/sh -p
++#!/bin/sh
 +
 +# Original script provided by the NFS project
 +# Modified for Arch Linux by Tom Killian
@@ -15,7 +16,7 @@
 -exec rpc.statd --no-notify
 +
 +# source application-specific settings
-+[ -f /etc/conf.d/nfs ] && . /etc/conf.d/nfs
++[ -f /etc/conf.d/nfs-common.conf ] && . /etc/conf.d/nfs-common.conf
 +
 +exec /usr/sbin/rpc.statd $STATD_OPTS
  
-- 
cgit v0.12