From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PwwZp-0007GO-Rp for garchives@archives.gentoo.org; Tue, 08 Mar 2011 13:03:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EF6321C019; Tue, 8 Mar 2011 13:03:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6C0AA1C023 for ; Tue, 8 Mar 2011 13:03:36 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B6FBD1B40B3 for ; Tue, 8 Mar 2011 13:03:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1FE3A8006E for ; Tue, 8 Mar 2011 13:03:35 +0000 (UTC) From: "Gilles Dartiguelongue" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Gilles Dartiguelongue" Message-ID: Subject: [gentoo-commits] dev/eva:master commit in: net-fs/nfs-utils/files/, net-fs/nfs-utils/ X-VCS-Repository: dev/eva X-VCS-Files: net-fs/nfs-utils/Manifest net-fs/nfs-utils/files/exports net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch net-fs/nfs-utils/files/nfs-utils-1.1.4-no-exec.patch net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch net-fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch net-fs/nfs-utils/files/nfs.confd net-fs/nfs-utils/files/nfs.initd net-fs/nfs-utils/files/nfsmount.initd net-fs/nfs-utils/files/rpc.gssd.initd net-fs/nfs-utils/files/rpc.idmapd.initd net-fs/nfs-utils/files/rpc.pipefs.initd net-fs/nfs-utils/files/rpc.statd.initd net-fs/nfs-utils/files/rpc.svcgssd.initd net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild X-VCS-Directories: net-fs/nfs-utils/files/ net-fs/nfs-utils/ X-VCS-Committer: eva X-VCS-Committer-Name: Gilles Dartiguelongue X-VCS-Revision: c2f4f62e9b0f305a5d717c6f889591bcaf59b786 Date: Tue, 8 Mar 2011 13:03:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: e5a02d0cd20e2c10ef92a1d6f8dcf579 commit: c2f4f62e9b0f305a5d717c6f889591bcaf59b786 Author: Gilles Dartiguelongue gentoo org> AuthorDate: Tue Mar 8 13:02:26 2011 +0000 Commit: Gilles Dartiguelongue gentoo org> CommitDate: Tue Mar 8 13:02:26 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Ddev/eva.git;a=3Dco= mmit;h=3Dc2f4f62e net-fs/nfs-utils: add nfs.idmap patch Add required patch to make NFS_USE_NEW_IDMAPPER=3Dy option work with >=3D2.6.37 kernels. --- net-fs/nfs-utils/Manifest | 16 + net-fs/nfs-utils/files/exports | 1 + .../nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch | 39 +++ .../nfs-utils/files/nfs-utils-1.1.4-no-exec.patch | 15 + .../files/nfs-utils-1.1.4-rpcgen-ioctl.patch | 13 + .../files/nfs-utils-1.2.3-nfs-idmap.patch | 271 ++++++++++++++= + .../nfs-utils-1.2.3-ti-rpc-static-ports.patch | 352 ++++++++++++++= ++++++ net-fs/nfs-utils/files/nfs.confd | 34 ++ net-fs/nfs-utils/files/nfs.initd | 162 +++++++++ net-fs/nfs-utils/files/nfsmount.initd | 48 +++ net-fs/nfs-utils/files/rpc.gssd.initd | 24 ++ net-fs/nfs-utils/files/rpc.idmapd.initd | 26 ++ net-fs/nfs-utils/files/rpc.pipefs.initd | 24 ++ net-fs/nfs-utils/files/rpc.statd.initd | 33 ++ net-fs/nfs-utils/files/rpc.svcgssd.initd | 24 ++ net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild | 111 ++++++ 16 files changed, 1193 insertions(+), 0 deletions(-) diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest new file mode 100644 index 0000000..6accc7c --- /dev/null +++ b/net-fs/nfs-utils/Manifest @@ -0,0 +1,16 @@ +AUX exports 66 RMD160 0a61ad40dc321be39fb54d5b9fe717caa714e878 SHA1 52ed= 6b74643e084cfc17ff4638c2e06c86602034 SHA256 5d6356df546682e2f1a87131d1bb6= 7de9b1f9a34d3a5742343dc64e890cf71d5 +AUX nfs-utils-1.1.4-mtab-sym.patch 1020 RMD160 72c6ebb9d02ec544b5b2d7ad3= ad0c8035d248eb1 SHA1 50db1976ac25607faf8f003573f9d8529e5b4de6 SHA256 0232= 799d085151649a1eb1f31644105de7e5cfba888794354005499a0db277c3 +AUX nfs-utils-1.1.4-no-exec.patch 297 RMD160 59e6f4bf2c782c0c107cd135589= c4abcba1a5978 SHA1 aa7239b22cf73abb1790bb9a88407cea8fd56779 SHA256 f66af9= d046a3524ae8920f8e4b5d0fa206de31d4e7747bfc716a10ac86537b0f +AUX nfs-utils-1.1.4-rpcgen-ioctl.patch 414 RMD160 f07264e24f374d6a65dbc8= c2b1dfed3755099ddc SHA1 c7df5e9b309b389a1b0d85e539771af43d3e8d98 SHA256 7= 8ae8ba33a600e6eb1153521eeb0ec5c3c5c503bd20074b1687703b3f83be678 +AUX nfs-utils-1.2.3-nfs-idmap.patch 7324 RMD160 c8966ac631bea87a22f193d8= 30a5d4c11c31381b SHA1 1b873fe6f2e3e9ae5ca5ae016db057920da67c53 SHA256 04a= 1173e62223d950c98e0e6234503407f380fbfeaac40ddde620f3f6ee17e7c +AUX nfs-utils-1.2.3-ti-rpc-static-ports.patch 10290 RMD160 079daaf913c61= b1ff6dac7bef0d3522c377c37ef SHA1 386f76c3e957ef61706db4708423a96b39557374= SHA256 8f188be765d5aa41eaa9d15df7cf0dc6b7ba29413866e8ada6c54973b0a942e9 +AUX nfs.confd 777 RMD160 8c830ee0c1a57e4b2fe35419976b9063080492de SHA1 2= 2e6bf3d6e350b71bed4b827796a36fb964d1455 SHA256 ca1f72dca9934f7bbdd281dde8= b1e91c0efad5abf3935dba54cd6ec07e7af315 +AUX nfs.initd 4354 RMD160 0901f7c5aaded698c11816bbaa37b3b152db4c0c SHA1 = 62ffdc3b6998506b4746ce1a5b26b4aec7108701 SHA256 ea09e0f993d2973e9f308fd72= 0c988c42de7844c6a046410e8e54beb8693e050 +AUX nfsmount.initd 1130 RMD160 7ac01f228fcd9539e11cf200a0ba2ed82987a91b = SHA1 1f4bfd0155489b6ce2e044f34d057c222202b1bb SHA256 4d6965abb56b72bdcd18= cbf900b6e1614d12da6b92b1a5b18727c36eaa131d37 +AUX rpc.gssd.initd 567 RMD160 26d42451b9fc0e90297b5e0381d2632a57dc4c51 S= HA1 041e59d915a0ab183a3e0b50abbf58394d2e89b9 SHA256 00d9c29280a83e8458c33= 139d04a9b38c6fdba9d7cb9b420ca83bf6b10e6435d +AUX rpc.idmapd.initd 595 RMD160 45f3e7c83555113052a302b66ba160171f90400a= SHA1 4c387d27dd11dcfe896dd937c69cd391c1936123 SHA256 3ce65326859c43983da= d25ad2d4731488c488037796e39b6b5eda336e8bf81ef +AUX rpc.pipefs.initd 788 RMD160 9ed8a4511e7ce05c67bc3a4c3c9d81ef0cfb6e45= SHA1 c184ab0c0df8b480e6f2e23dbe8360b99d1411a9 SHA256 d651ad9099ea4432824= 76fcedf52c00f0a274eb6a9e4b58a5838780369206973 +AUX rpc.statd.initd 818 RMD160 d87fc8aed1638955444b587fc5404db671d5a8fb = SHA1 bd73058b722d2f51a67bbbdec8ed029094fb9683 SHA256 0c7bd35a14da6c0c2577= f09ae82a41ddb693a88157eeaf80684616f79be6c304 +AUX rpc.svcgssd.initd 584 RMD160 9488050225453f6b083be78ed3de1b042d02cfb= 8 SHA1 3dc09a20ca1cefd902b8709b094a4e0c0e9a407c SHA256 f1c460d8b0e91e54a5= 51397d755135d05a3728d81de596535bf8bda074455677 +DIST nfs-utils-1.2.3.tar.bz2 672759 RMD160 dad6fe83fa60c4854849e36d21282= 08c4e3234ab SHA1 da70a29191b07056d71b6e427a87d5cfd8628523 SHA256 5575ece9= 41097cbfa67fbe0d220dfa11b73f5e6d991e7939c9339bd72259ff19 +EBUILD nfs-utils-1.2.3-r2.ebuild 3348 RMD160 3fbd317b149f623599e4ba0c266= de92262960d3e SHA1 6a2f53ef3af64ccb13bcbdc21c7b2dfb01cc2aee SHA256 24bd87= b13099b810ac8fdf45658dbd28c992b5d7fe517c09a875bc4d0b193a77 diff --git a/net-fs/nfs-utils/files/exports b/net-fs/nfs-utils/files/expo= rts new file mode 100644 index 0000000..5102ef2 --- /dev/null +++ b/net-fs/nfs-utils/files/exports @@ -0,0 +1 @@ +# /etc/exports: NFS file systems being exported. See exports(5). diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch b/net-= fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch new file mode 100644 index 0000000..c9e60af --- /dev/null +++ b/net-fs/nfs-utils/files/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; + } +=20 +-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 +=20 ++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; +=20 ++ /* 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(); +=20 + mfp =3D nfs_setmntent (MOUNTED, "a+"); diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-no-exec.patch b/net-f= s/nfs-utils/files/nfs-utils-1.1.4-no-exec.patch new file mode 100644 index 0000000..ea50a21 --- /dev/null +++ b/net-fs/nfs-utils/files/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; +- } +=20 + return 0; + } diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch b/= net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch new file mode 100644 index 0000000..1765418 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch @@ -0,0 +1,13 @@ +http://bugs.gentoo.org/174393 + +--- tools/rpcgen/rpc_main.c ++++ tools/rpcgen/rpc_main.c +@@ -548,7 +548,7 @@ + f_print(fout, "#include /* TIOCNOTTY */\n"); + #else + if( !tirpcflag ) +- f_print(fout, "#include /* TIOCNOTTY */\n"); ++ f_print(fout, "#include /* TIOCNOTTY */\n"); + #endif + if( Cflag && (inetdflag || pmflag ) ) { + f_print(fout, "#ifdef __cplusplus\n"); diff --git a/net-fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch b/net= -fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch new file mode 100644 index 0000000..cd6e121 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch @@ -0,0 +1,271 @@ +From: Bryan Schumaker +Date: Tue, 26 Oct 2010 17:17:40 +0000 (-0400) +Subject: nfs-utils: add nfs.idmap +X-Git-Url: http://git.linux-nfs.org/?p=3Dtrondmy%2Fnfs-utils.git;a=3Dcom= mitdiff_plain;h=3Dfafeed5d010070717e5af94b8729558df0b281af;hp=3Dc62d75640= 2509ca5d07c1fd4d2e5a9d78dc4171b + +nfs-utils: add nfs.idmap + +This patch adds the nfs.idmap program to nfs-utils. This program is cal= led by +the nfs idmapper through request-keys to map between uid / user name and +gid / group name. + +Signed-off-by: Bryan Schumaker +Signed-off-by: Trond Myklebust +--- + +diff --git a/aclocal/keyutils.m4 b/aclocal/keyutils.m4 +new file mode 100644 +index 0000000..8aea646 +--- /dev/null ++++ b/aclocal/keyutils.m4 +@@ -0,0 +1,11 @@ ++dnl Checks for keyutils library and headers ++dnl ++AC_DEFUN([AC_KEYUTILS], [ ++ ++ dnl Check for libkeyutils; do not add to LIBS if found ++ AC_CHECK_LIB([keyutils], [keyctl_instantiate], [LIBKEYUTILS=3D-lkeyut= ils], ,) ++ AC_SUBST(LIBKEYUTILS) ++ ++ AC_CHECK_HEADERS([keyutils.h], , ++ [AC_MSG_ERROR([keyutils.h header not found.])]) ++])dnl +diff --git a/configure.ac b/configure.ac +index 3058be6..0907f72 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -247,6 +247,9 @@ if test "$enable_nfsv4" =3D yes; then + dnl check for nfsidmap libraries and headers + AC_LIBNFSIDMAP +=20 ++ dnl check for the keyutils libraries and headers ++ AC_KEYUTILS ++ + dnl librpcsecgss already has a dependency on libgssapi, + dnl but we need to make sure we get the right version + if test "$enable_gss" =3D yes; then +@@ -435,6 +438,7 @@ AC_CONFIG_FILES([ + utils/mountd/Makefile + utils/nfsd/Makefile + utils/nfsstat/Makefile ++ utils/nfs.idmap/Makefile + utils/showmount/Makefile + utils/statd/Makefile + tests/Makefile +diff --git a/utils/Makefile.am b/utils/Makefile.am +index 8665183..332ecff 100644 +--- a/utils/Makefile.am ++++ b/utils/Makefile.am +@@ -4,6 +4,7 @@ OPTDIRS =3D +=20 + if CONFIG_NFSV4 + OPTDIRS +=3D idmapd ++OPTDIRS +=3D nfs.idmap + endif +=20 + if CONFIG_GSS +diff --git a/utils/nfs.idmap/Makefile.am b/utils/nfs.idmap/Makefile.am +new file mode 100644 +index 0000000..29e17af +--- /dev/null ++++ b/utils/nfs.idmap/Makefile.am +@@ -0,0 +1,9 @@ ++## Process this file with automake to produce Makefile.in ++ ++man8_MANS =3D nfs.idmap.man ++ ++sbin_PROGRAMS =3D nfs.idmap ++nfs_idmap_SOURCES =3D nfs.idmap.c ++nfs_idmap_LDADD =3D -lnfsidmap -lkeyutils ++ ++MAINTAINERCLEANFILES =3D Makefile.in +diff --git a/utils/nfs.idmap/nfs.idmap.c b/utils/nfs.idmap/nfs.idmap.c +new file mode 100644 +index 0000000..abbcb65 +--- /dev/null ++++ b/utils/nfs.idmap/nfs.idmap.c +@@ -0,0 +1,118 @@ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++/* gcc nfs.idmap.c -o nfs.idmap -l nfsidmap -l keyutils */ ++ ++#define MAX_ID_LEN 11 ++#define IDMAP_NAMESZ 128 ++#define USER 1 ++#define GROUP 0 ++ ++ ++/* ++ * Find either a user or group id based on the name@domain string ++ */ ++int id_lookup(char *name_at_domain, key_serial_t key, int type) ++{ ++ char id[MAX_ID_LEN]; ++ uid_t uid =3D 0; ++ gid_t gid =3D 0; ++ int rc; ++ ++ if (type =3D=3D USER) { ++ rc =3D nfs4_owner_to_uid(name_at_domain, &uid); ++ sprintf(id, "%u", uid); ++ } else { ++ rc =3D nfs4_group_owner_to_gid(name_at_domain, &gid); ++ sprintf(id, "%u", gid); ++ } ++ ++ if (rc =3D=3D 0) ++ rc =3D keyctl_instantiate(key, id, strlen(id) + 1, 0); ++ ++ return rc; ++} ++ ++/* ++ * Find the name@domain string from either a user or group id ++ */ ++int name_lookup(char *id, key_serial_t key, int type) ++{ ++ char name[IDMAP_NAMESZ]; ++ char domain[NFS4_MAX_DOMAIN_LEN]; ++ uid_t uid; ++ gid_t gid; ++ int rc; ++ ++ rc =3D nfs4_get_default_domain(NULL, domain, NFS4_MAX_DOMAIN_LEN); ++ if (rc !=3D 0) { ++ rc =3D -1; ++ goto out; ++ } ++ ++ if (type =3D=3D USER) { ++ uid =3D atoi(id); ++ rc =3D nfs4_uid_to_name(uid, domain, name, IDMAP_NAMESZ); ++ } else { ++ gid =3D atoi(id); ++ rc =3D nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ); ++ } ++ ++ if (rc =3D=3D 0) ++ rc =3D keyctl_instantiate(key, &name, strlen(name), 0); ++ ++out: ++ return rc; ++} ++ ++int main(int argc, char **argv) ++{ ++ char *arg; ++ char *value; ++ char *type; ++ int rc =3D 1; ++ int timeout =3D 600; ++ key_serial_t key; ++ ++ if (argc < 3) ++ return 1; ++ ++ arg =3D malloc(sizeof(char) * strlen(argv[2]) + 1); ++ strcpy(arg, argv[2]); ++ type =3D strtok(arg, ":"); ++ value =3D strtok(NULL, ":"); ++ ++ if (argc =3D=3D 4) { ++ timeout =3D atoi(argv[3]); ++ if (timeout < 0) ++ timeout =3D 0; ++ } ++ ++ key =3D strtol(argv[1], NULL, 10); ++ ++ if (strcmp(type, "uid") =3D=3D 0) ++ rc =3D id_lookup(value, key, USER); ++ else if (strcmp(type, "gid") =3D=3D 0) ++ rc =3D id_lookup(value, key, GROUP); ++ else if (strcmp(type, "user") =3D=3D 0) ++ rc =3D name_lookup(value, key, USER); ++ else if (strcmp(type, "group") =3D=3D 0) ++ rc =3D name_lookup(value, key, GROUP); ++ ++ /* Set timeout to 5 (600 seconds) minutes */ ++ if (rc =3D=3D 0) ++ keyctl_set_timeout(key, timeout); ++ ++ free(arg); ++ return rc; ++} +diff --git a/utils/nfs.idmap/nfs.idmap.man b/utils/nfs.idmap/nfs.idmap.m= an +new file mode 100644 +index 0000000..3b51b8e +--- /dev/null ++++ b/utils/nfs.idmap/nfs.idmap.man +@@ -0,0 +1,60 @@ ++.\" ++.\"@(#)nfs.idmap(8) - The NFS idmapper upcall program ++.\" ++.\" Copyright (C) 2010 Bryan Schumaker ++.TH nfs.idmap 5 "1 October 2010" ++.SH NAME ++nfs.idmap \- The NFS idmapper upcall program ++.SH DESCRIPTION ++The file ++.I /usr/sbin/idmap ++is used by the NFS idmapper to translate user and group ids into names,= and to ++translate user and group names into ids. Idmapper uses request-key to p= erform ++the upcall and cache the result. ++.I /usr/sbin/idmap ++should only be called by request-key, and will perform the translation = and ++initialize a key with the resulting information. ++.PP ++NFS_USE_NEW_IDMAPPER must be selected when configuring the kernel to us= e this ++feature. ++.SH CONFIGURING ++The file ++.I /etc/request-key.conf ++will need to be modified so ++.I /sbin/request-key ++can properly direct the upcall. The following line should be added befo= re a call ++to keyctl negate: ++.PP ++create id_resolver * * /usr/sbin/nfs.idmap %k %d 600 ++.PP ++This will direct all nfs_idmap requests to the program ++.I /usr/sbin/nfs.idmap ++The last parameter, 600, defines how many seconds into the future the k= ey will ++expire. This is an optional parameter for ++.I /usr/sbin/nfs.idmap ++and will default to 600 seconds when not specified. ++.PP ++The idmapper system uses four key descriptions: ++.PP ++ uid: Find the UID for the given user ++.br ++ gid: Find the GID for the given group ++.br ++ user: Find the user name for the given UID ++.br ++ group: Find the group name for the given GID ++.PP ++You can choose to handle any of these individually, rather than using t= he ++generic upcall program. If you would like to use your own program for = a uid ++lookup then you would edit your request-key.conf so it looks similar to= this: ++.PP ++create id_resolver uid:* * /some/other/program %k %d 600 ++.br ++create id_resolver * * /usr/sbin/nfs.idmap %k %d 600 ++.PP ++Notice that the new line was added above the line for the generic progr= am. ++request-key will find the first matching line and run the corresponding= program. ++In this case, /some/other/program will handle all uid lookups, and ++/usr/sbin/nfs.idmap will handle gid, user, and group lookups. ++.SH AUTHOR ++Bryan Schumaker, diff --git a/net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.p= atch b/net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch new file mode 100644 index 0000000..b66e981 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch @@ -0,0 +1,352 @@ +http://bugs.gentoo.org/340797 + +From 656028f9925f5817c5a37565d27159973db84ec3 Mon Sep 17 00:00:00 2001 +From: Chuck Lever +Date: Wed, 13 Oct 2010 11:22:07 -0400 +Subject: [PATCH] libnfs.a: Allow multiple RPC listeners to share listene= r port number + +Normally, when "-p" is not specified on the mountd command line, the +TI-RPC library chooses random port numbers for each listener. If a +port number _is_ specified on the command line, all the listeners +will get the same port number, so SO_REUSEADDR needs to be set on +each socket. + +Thus we can't let TI-RPC create the listener sockets for us in this +case; we must create them ourselves and then set SO_REUSEADDR (and +other socket options) by hand. + +Different versions of the same RPC program have to share the same +listener and SVCXPRT, so we have to cache xprts we create, and re-use +them when additional requests for registration come from the +application. + +Though it doesn't look like it, this fix was "copied" from the legacy +rpc_init() function. It's more complicated for TI-RPC, of course, +since a TI-RPC application can set up listeners with a nearly +arbitrary number of address families and socket types, not just the +two listeners that legacy RPC applications can set up (one for AF_INET +UDP and one for AF_INET TCP). + +See: + https://bugzilla.linux-nfs.org/show_bug.cgi?id=3D190 + +Signed-off-by: Chuck Lever +Signed-off-by: Steve Dickson +--- + support/nfs/svc_create.c | 252 +++++++++++++++++++++++++++++++++++++++= +++++- + 1 files changed, 246 insertions(+), 6 deletions(-) + +diff --git a/support/nfs/svc_create.c b/support/nfs/svc_create.c +index 59ba505..b3f75ed 100644 +--- a/support/nfs/svc_create.c ++++ b/support/nfs/svc_create.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include +=20 + #include +@@ -41,11 +42,68 @@ + #include "tcpwrapper.h" + #endif +=20 ++#include "sockaddr.h" + #include "rpcmisc.h" + #include "xlog.h" +=20 + #ifdef HAVE_LIBTIRPC +=20 ++#define SVC_CREATE_XPRT_CACHE_SIZE (8) ++static SVCXPRT *svc_create_xprt_cache[SVC_CREATE_XPRT_CACHE_SIZE] =3D {= NULL, }; ++ ++/* ++ * Cache an SVC xprt, in case there are more programs or versions to ++ * register against it. ++ */ ++static void ++svc_create_cache_xprt(SVCXPRT *xprt) ++{ ++ unsigned int i; ++ ++ /* Check if we've already got this one... */ ++ for (i =3D 0; i < SVC_CREATE_XPRT_CACHE_SIZE; i++) ++ if (svc_create_xprt_cache[i] =3D=3D xprt) ++ return; ++ ++ /* No, we don't. Cache it. */ ++ for (i =3D 0; i < SVC_CREATE_XPRT_CACHE_SIZE; i++) ++ if (svc_create_xprt_cache[i] =3D=3D NULL) { ++ svc_create_xprt_cache[i] =3D xprt; ++ return; ++ } ++ ++ xlog(L_ERROR, "%s: Failed to cache an xprt", __func__); ++} ++ ++/* ++ * Find a previously cached SVC xprt structure with the given bind addr= ess ++ * and transport semantics. ++ * ++ * Returns pointer to a cached SVC xprt. ++ * ++ * If no matching SVC XPRT can be found, NULL is returned. ++ */ ++static SVCXPRT * ++svc_create_find_xprt(const struct sockaddr *bindaddr, const struct netc= onfig *nconf) ++{ ++ unsigned int i; ++ ++ for (i =3D 0; i < SVC_CREATE_XPRT_CACHE_SIZE; i++) { ++ SVCXPRT *xprt =3D svc_create_xprt_cache[i]; ++ struct sockaddr *sap; ++ ++ if (xprt =3D=3D NULL) ++ continue; ++ if (strcmp(nconf->nc_netid, xprt->xp_netid) !=3D 0) ++ continue; ++ sap =3D (struct sockaddr *)xprt->xp_ltaddr.buf; ++ if (!nfs_compare_sockaddr(bindaddr, sap)) ++ continue; ++ return xprt; ++ } ++ return NULL; ++} ++ + /* + * Set up an appropriate bind address, given @port and @nconf. + * +@@ -98,17 +156,113 @@ svc_create_bindaddr(struct netconfig *nconf, const= uint16_t port) + return ai; + } +=20 ++/* ++ * Create a listener socket on a specific bindaddr, and set ++ * special socket options to allow it to share the same port ++ * as other listeners. ++ * ++ * Returns an open, bound, and possibly listening network ++ * socket on success. ++ * ++ * Otherwise returns -1 if some error occurs. ++ */ ++static int ++svc_create_sock(const struct sockaddr *sap, socklen_t salen, ++ struct netconfig *nconf) ++{ ++ int fd, type, protocol; ++ int one =3D 1; ++ ++ switch(nconf->nc_semantics) { ++ case NC_TPI_CLTS: ++ type =3D SOCK_DGRAM; ++ break; ++ case NC_TPI_COTS_ORD: ++ type =3D SOCK_STREAM; ++ break; ++ default: ++ xlog(D_GENERAL, "%s: Unrecognized bind address semantics: %u", ++ __func__, nconf->nc_semantics); ++ return -1; ++ } ++ ++ if (strcmp(nconf->nc_proto, NC_UDP) =3D=3D 0) ++ protocol =3D (int)IPPROTO_UDP; ++ else if (strcmp(nconf->nc_proto, NC_TCP) =3D=3D 0) ++ protocol =3D (int)IPPROTO_TCP; ++ else { ++ xlog(D_GENERAL, "%s: Unrecognized bind address protocol: %s", ++ __func__, nconf->nc_proto); ++ return -1; ++ } ++ ++ fd =3D socket((int)sap->sa_family, type, protocol); ++ if (fd =3D=3D -1) { ++ xlog(L_ERROR, "Could not make a socket: (%d) %m", ++ errno); ++ return -1; ++ } ++ ++#ifdef IPV6_SUPPORTED ++ if (sap->sa_family =3D=3D AF_INET6) { ++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, ++ &one, sizeof(one)) =3D=3D -1) { ++ xlog(L_ERROR, "Failed to set IPV6_V6ONLY: (%d) %m", ++ errno); ++ (void)close(fd); ++ return -1; ++ } ++ } ++#endif /* IPV6_SUPPORTED */ ++ ++ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, ++ &one, sizeof(one)) =3D=3D -1) { ++ xlog(L_ERROR, "Failed to set SO_REUSEADDR: (%d) %m", ++ errno); ++ (void)close(fd); ++ return -1; ++ } ++ ++ if (bind(fd, sap, salen) =3D=3D -1) { ++ xlog(L_ERROR, "Could not bind socket: (%d) %m", ++ errno); ++ (void)close(fd); ++ return -1; ++ } ++ ++ if (nconf->nc_semantics =3D=3D NC_TPI_COTS_ORD) ++ if (listen(fd, SOMAXCONN) =3D=3D -1) { ++ xlog(L_ERROR, "Could not listen on socket: (%d) %m", ++ errno); ++ (void)close(fd); ++ return -1; ++ } ++ ++ return fd; ++} ++ ++/* ++ * The simple case is allowing the TI-RPC library to create a ++ * transport itself, given just the bind address and transport ++ * semantics. ++ * ++ * Our local xprt cache is ignored in this path, since the ++ * caller is not interested in sharing listeners or ports, and ++ * the library automatically avoids ports already in use. ++ * ++ * Returns the count of started listeners (one or zero). ++ */ + static unsigned int +-svc_create_nconf(const char *name, const rpcprog_t program, ++svc_create_nconf_rand_port(const char *name, const rpcprog_t program, + const rpcvers_t version, + void (*dispatch)(struct svc_req *, SVCXPRT *), +- const uint16_t port, struct netconfig *nconf) ++ struct netconfig *nconf) + { + struct t_bind bindaddr; + struct addrinfo *ai; + SVCXPRT *xprt; +=20 +- ai =3D svc_create_bindaddr(nconf, port); ++ ai =3D svc_create_bindaddr(nconf, 0); + if (ai =3D=3D NULL) + return 0; +=20 +@@ -119,7 +273,7 @@ svc_create_nconf(const char *name, const rpcprog_t p= rogram, + freeaddrinfo(ai); + if (xprt =3D=3D NULL) { + xlog(D_GENERAL, "Failed to create listener xprt " +- "(%s, %u, %s)", name, version, nconf->nc_netid); ++ "(%s, %u, %s)", name, version, nconf->nc_netid); + return 0; + } +=20 +@@ -133,6 +287,93 @@ svc_create_nconf(const char *name, const rpcprog_t = program, + return 1; + } +=20 ++/* ++ * If a port is specified on the command line, that port value will be ++ * the same for all listeners created here. Create each listener ++ * socket in advance and set SO_REUSEADDR, rather than allowing the ++ * RPC library to create the listeners for us on a randomly chosen ++ * port via svc_tli_create(RPC_ANYFD). ++ * ++ * Some callers want to listen for more than one RPC version using the ++ * same port number. For example, mountd could want to listen for MNT ++ * version 1, 2, and 3 requests. This means mountd must use the same ++ * set of listener sockets for multiple RPC versions, since, on one ++ * system, you can't have two listener sockets with the exact same ++ * bind address (and port) and transport protocol. ++ * ++ * To accomplish this, this function caches xprts as they are created. ++ * This cache is checked to see if a previously created xprt can be ++ * used, before creating a new xprt for this [program, version]. If ++ * there is a cached xprt with the same bindaddr and transport ++ * semantics, we simply register the new version with that xprt, ++ * rather than creating a fresh xprt for it. ++ * ++ * The xprt cache implemented here is local to a process. Two ++ * separate RPC daemons can not share a set of listeners. ++ * ++ * Returns the count of started listeners (one or zero). ++ */ ++static unsigned int ++svc_create_nconf_fixed_port(const char *name, const rpcprog_t program, ++ const rpcvers_t version, ++ void (*dispatch)(struct svc_req *, SVCXPRT *), ++ const uint16_t port, struct netconfig *nconf) ++{ ++ struct addrinfo *ai; ++ SVCXPRT *xprt; ++ ++ ai =3D svc_create_bindaddr(nconf, port); ++ if (ai =3D=3D NULL) ++ return 0; ++ ++ xprt =3D svc_create_find_xprt(ai->ai_addr, nconf); ++ if (xprt =3D=3D NULL) { ++ int fd; ++ ++ fd =3D svc_create_sock(ai->ai_addr, ai->ai_addrlen, nconf); ++ if (fd =3D=3D -1) ++ goto out_free; ++ ++ xprt =3D svc_tli_create(fd, nconf, NULL, 0, 0); ++ if (xprt =3D=3D NULL) { ++ xlog(D_GENERAL, "Failed to create listener xprt " ++ "(%s, %u, %s)", name, version, nconf->nc_netid); ++ (void)close(fd); ++ goto out_free; ++ } ++ } ++ ++ if (!svc_reg(xprt, program, version, dispatch, nconf)) { ++ /* svc_reg(3) destroys @xprt in this case */ ++ xlog(D_GENERAL, "Failed to register (%s, %u, %s)", ++ name, version, nconf->nc_netid); ++ goto out_free; ++ } ++ ++ svc_create_cache_xprt(xprt); ++ ++ freeaddrinfo(ai); ++ return 1; ++ ++out_free: ++ freeaddrinfo(ai); ++ return 0; ++} ++ ++static unsigned int ++svc_create_nconf(const char *name, const rpcprog_t program, ++ const rpcvers_t version, ++ void (*dispatch)(struct svc_req *, SVCXPRT *), ++ const uint16_t port, struct netconfig *nconf) ++{ ++ if (port !=3D 0) ++ return svc_create_nconf_fixed_port(name, program, ++ version, dispatch, port, nconf); ++ ++ return svc_create_nconf_rand_port(name, program, ++ version, dispatch, nconf); ++} ++ + /** + * nfs_svc_create - start up RPC svc listeners + * @name: C string containing name of new service +@@ -145,8 +386,7 @@ svc_create_nconf(const char *name, const rpcprog_t p= rogram, + * the RPC dispatcher. Returns the number of started network transport= s. + */ + unsigned int +-nfs_svc_create(__attribute__((unused)) char *name, +- const rpcprog_t program, const rpcvers_t version, ++nfs_svc_create(char *name, const rpcprog_t program, const rpcvers_t ver= sion, + void (*dispatch)(struct svc_req *, SVCXPRT *), + const uint16_t port) + { +--=20 +1.7.3.1 + diff --git a/net-fs/nfs-utils/files/nfs.confd b/net-fs/nfs-utils/files/nf= s.confd new file mode 100644 index 0000000..ad9e34f --- /dev/null +++ b/net-fs/nfs-utils/files/nfs.confd @@ -0,0 +1,34 @@ +# /etc/conf.d/nfs + +# If you wish to set the port numbers for lockd, +# please see /etc/sysctl.conf + +# Optional services to include in default `/etc/init.d/nfs start` +# For NFSv4 users, you'll want to add "rpc.idmapd" here. +NFS_NEEDED_SERVICES=3D"" + +# Number of servers to be started up by default +OPTS_RPC_NFSD=3D"8" + +# Options to pass to rpc.mountd +# ex. OPTS_RPC_MOUNTD=3D"-p 32767" +OPTS_RPC_MOUNTD=3D"" + +# Options to pass to rpc.statd +# ex. OPTS_RPC_STATD=3D"-p 32765 -o 32766" +OPTS_RPC_STATD=3D"" + +# Options to pass to rpc.idmapd +OPTS_RPC_IDMAPD=3D"" + +# Options to pass to rpc.gssd +OPTS_RPC_GSSD=3D"" + +# Options to pass to rpc.svcgssd +OPTS_RPC_SVCGSSD=3D"" + +# Options to pass to rpc.rquotad (requires sys-fs/quota) +OPTS_RPC_RQUOTAD=3D"" + +# Timeout (in seconds) for exportfs +EXPORTFS_TIMEOUT=3D30 diff --git a/net-fs/nfs-utils/files/nfs.initd b/net-fs/nfs-utils/files/nf= s.initd new file mode 100755 index 0000000..a3db075 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs.initd @@ -0,0 +1,162 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfs.initd,v 1.= 23 2010/11/21 19:56:56 vapier Exp $ + +opts=3D"reload" + +# This variable is used for controlling whether or not to run exportfs -= ua; +# see stop() for more information +restarting=3Dno + +# The binary locations +exportfs=3D/usr/sbin/exportfs + mountd=3D/usr/sbin/rpc.mountd + nfsd=3D/usr/sbin/rpc.nfsd +smnotify=3D/usr/sbin/sm-notify + +depend() { + local myneed=3D"" + if [ -e /etc/exports ] ; then + # XXX: no way to detect NFSv4 is desired and so need rpc.idmapd + myneed=3D"${myneed} $( + awk '!/^[[:space:]]*#/ { + # clear the path to avoid spurious matches + $1 =3D ""; + if ($0 ~ /[(][^)]*sec=3D(krb|spkm)[^)]*[)]/) { + print "rpc.svcgssd" + exit 0 + } + }' /etc/exports + )" + fi + config /etc/exports + need portmap rpc.statd ${myneed} ${NFS_NEEDED_SERVICES} + use ypbind net dns rpc.rquotad rpc.idmapd rpc.svcgssd + after quota +} + +mkdir_nfsdirs() { + local d + for d in rpc_pipefs v4recovery v4root ; do + d=3D"/var/lib/nfs/${d}" + [ ! -d "${d}" ] && mkdir -p "${d}" + done +} + +waitfor_exportfs() { + local pid=3D$1 + ( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 $pid 2>/dev/null ) & + wait $1 +} + +mount_nfsd() { + if [ -e /proc/modules ] ; then + # Make sure nfs support is loaded in the kernel #64709 + if ! grep -qs nfsd /proc/filesystems ; then + modprobe -q nfsd + fi + # Restart idmapd if needed #220747 + if grep -qs nfsd /proc/modules ; then + killall -q -HUP rpc.idmapd + fi + fi + + # This is the new "kernel 2.6 way" to handle the exports file + if grep -qs nfsd /proc/filesystems ; then + if ! grep -qs "nfsd /proc/fs/nfsd" /proc/mounts ; then + ebegin "Mounting nfsd filesystem in /proc" + mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd + eend $? + fi + fi +} + +start_it() { + ebegin "Starting NFS $1" + shift + "$@" + eend $? + ret=3D$((ret + $?)) +} +start() { + mount_nfsd + mkdir_nfsdirs + + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + if grep -qs '^[[:space:]]*/' /etc/exports ; then + ebegin "Exporting NFS directories" + ${exportfs} -r & + waitfor_exportfs $! + eend $? + fi + + local ret=3D0 + start_it mountd ${mountd} ${OPTS_RPC_MOUNTD} + start_it daemon ${nfsd} ${OPTS_RPC_NFSD} + [ -x "${smnotify}" ] && start_it smnotify ${smnotify} ${OPTS_SMNOTIFY} + return ${ret} +} + +stop() { + local ret=3D0 + + # Don't check NFSSERVER variable since it might have changed, + # instead use --oknodo to smooth things over + ebegin "Stopping NFS mountd" + start-stop-daemon --stop --oknodo --exec ${mountd} + eend $? + ret=3D$((ret + $?)) + + # nfsd sets its process name to [nfsd] so don't look for $nfsd + ebegin "Stopping NFS daemon" + start-stop-daemon --stop --oknodo --name nfsd --user root --signal 2 + eend $? + ret=3D$((ret + $?)) + # in case things don't work out ... #228127 + rpc.nfsd 0 + + # When restarting the NFS server, running "exportfs -ua" probably + # isn't what the user wants. Running it causes all entries listed + # in xtab to be removed from the kernel export tables, and the + # xtab file is cleared. This effectively shuts down all NFS + # activity, leaving all clients holding stale NFS filehandles, + # *even* when the NFS server has restarted. + # + # That's what you would want if you were shutting down the NFS + # server for good, or for a long period of time, but not when the + # NFS server will be running again in short order. In this case, + # then "exportfs -r" will reread the xtab, and all the current + # clients will be able to resume NFS activity, *without* needing + # to umount/(re)mount the filesystem. + if [ "${restarting}" =3D no -o "${RC_CMD}" =3D "restart" ] ; then + ebegin "Unexporting NFS directories" + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # shutdown process can continue. + ${exportfs} -ua & + waitfor_exportfs $! + eend $? + fi + + return ${ret} +} + +reload() { + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + ebegin "Reloading /etc/exports" + ${exportfs} -r 1>&2 & + waitfor_exportfs $! + eend $? +} + +restart() { + # See long comment in stop() regarding "restarting" and exportfs -ua + restarting=3Dyes + svc_stop + svc_start +} diff --git a/net-fs/nfs-utils/files/nfsmount.initd b/net-fs/nfs-utils/fil= es/nfsmount.initd new file mode 100755 index 0000000..62bf028 --- /dev/null +++ b/net-fs/nfs-utils/files/nfsmount.initd @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfsmount.initd= ,v 1.14 2010/06/28 21:03:11 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + local myneed=3D"" + if [ -e /etc/fstab ] ; then + myneed=3D"${myneed} $( + awk '!/^[[:space:]]*#/ && ($3 =3D=3D "nfs" || $3 =3D=3D "nfs4") { + if ($3 =3D=3D "nfs4") + idmapd =3D "rpc.idmapd" + if ($4 ~ /sec=3D(krb|spkm)/) + gssd =3D "rpc.gssd" + } + END { print idmapd " " gssd } + ' /etc/fstab + )" + fi + config /etc/fstab + need net portmap rpc.statd ${myneed} + use ypbind dns rpc.idmapd rpc.gssd +} + +start() { + if [ -x /usr/sbin/sm-notify ] ; then + ebegin "Starting NFS sm-notify" + /usr/sbin/sm-notify ${OPTS_SMNOTIFY} + eend $? + fi + + # Make sure nfs support is loaded in the kernel #64709 + if [ -e /proc/modules ] && ! grep -qs 'nfs$' /proc/filesystems ; then + modprobe -q nfs + fi + + ebegin "Mounting NFS filesystems" + mount -a -t nfs,nfs4 + eend $? +} + +stop() { + ebegin "Unmounting NFS filesystems" + umount -a -t nfs,nfs4 + eend $? +} diff --git a/net-fs/nfs-utils/files/rpc.gssd.initd b/net-fs/nfs-utils/fil= es/rpc.gssd.initd new file mode 100755 index 0000000..f1b8f87 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.gssd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.gssd.initd= ,v 1.11 2008/10/26 09:02:47 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + use ypbind net + need portmap rpc.pipefs + after quota +} + +start() { + ebegin "Starting gssd" + start-stop-daemon --start --exec /usr/sbin/rpc.gssd -- ${OPTS_RPC_GSSD} + eend $? +} + +stop() { + ebegin "Stopping gssd" + start-stop-daemon --stop --exec /usr/sbin/rpc.gssd + eend $? +} diff --git a/net-fs/nfs-utils/files/rpc.idmapd.initd b/net-fs/nfs-utils/f= iles/rpc.idmapd.initd new file mode 100755 index 0000000..52838b5 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.idmapd.initd @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.idmapd.ini= td,v 1.8 2009/03/14 18:43:18 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +rpc_bin=3D/usr/sbin/rpc.idmapd + +depend() { + use ypbind net + need portmap rpc.pipefs + after quota +} + +start() { + ebegin "Starting idmapd" + ${rpc_bin} ${OPTS_RPC_IDMAPD} + eend $? "make sure DNOTIFY support is enabled ..." +} + +stop() { + ebegin "Stopping idmapd" + start-stop-daemon --stop --exec ${rpc_bin} + eend $? +} diff --git a/net-fs/nfs-utils/files/rpc.pipefs.initd b/net-fs/nfs-utils/f= iles/rpc.pipefs.initd new file mode 100644 index 0000000..701ac77 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.pipefs.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.pipefs.ini= td,v 1.1 2008/10/26 09:02:47 vapier Exp $ + +mount_pipefs() { + # if rpc_pipefs is not available, try to load sunrpc for it #219566 + grep -qs rpc_pipefs /proc/filesystems || modprobe -q sunrpc + # if still not available, let's bail + grep -qs rpc_pipefs /proc/filesystems || return 1 + + # now just do it for kicks + mkdir -p /var/lib/nfs/rpc_pipefs + mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs +} + +start() { + # if things are already mounted, let's just return + grep -qs "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts && return 0 + + ebegin "Mounting RPC pipefs" + mount_pipefs + eend $? +} diff --git a/net-fs/nfs-utils/files/rpc.statd.initd b/net-fs/nfs-utils/fi= les/rpc.statd.initd new file mode 100755 index 0000000..14f8b34 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.statd.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.statd.init= d,v 1.7 2009/01/31 22:16:11 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +rpc_bin=3D/sbin/rpc.statd +rpc_pid=3D/var/run/rpc.statd.pid + +depend() { + use ypbind net + need portmap + after quota +} + +start() { + # Don't start rpc.statd if already started by someone else ... + # Don't try and kill it if it's already dead ... + if killall -q -0 ${rpc_bin} ; then + return 0 + fi + + ebegin "Starting NFS statd" + start-stop-daemon --start --exec ${rpc_bin} -- --no-notify ${OPTS_RPC_S= TATD} + eend $? +} + +stop() { + ebegin "Stopping NFS statd" + start-stop-daemon --stop --exec ${rpc_bin} --pidfile /var/run/rpc.statd= .pid + eend $? +} diff --git a/net-fs/nfs-utils/files/rpc.svcgssd.initd b/net-fs/nfs-utils/= files/rpc.svcgssd.initd new file mode 100755 index 0000000..74383e2 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.svcgssd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.svcgssd.in= itd,v 1.5 2008/10/26 09:02:47 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + use ypbind net + need portmap rpc.pipefs + after quota +} + +start() { + ebegin "Starting svcgssd" + start-stop-daemon --start --exec /usr/sbin/rpc.svcgssd -- ${OPTS_RPC_SV= CGSSD} + eend $? +} + +stop() { + ebegin "Stopping svcgssd" + start-stop-daemon --stop --exec /usr/sbin/rpc.svcgssd + eend $? +} diff --git a/net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild b/net-fs/nfs-util= s/nfs-utils-1.2.3-r2.ebuild new file mode 100644 index 0000000..87bc166 --- /dev/null +++ b/net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-1.2.3-r1.e= build,v 1.1 2010/11/14 00:49:39 vapier Exp $ + +EAPI=3D"2" + +inherit autotools eutils flag-o-matic multilib + +DESCRIPTION=3D"NFS client and server daemons" +HOMEPAGE=3D"http://linux-nfs.org/" +SRC_URI=3D"mirror://sourceforge/nfs/${P}.tar.bz2" + +LICENSE=3D"GPL-2" +SLOT=3D"0" +KEYWORDS=3D"~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~= sparc ~x86" +IUSE=3D"caps ipv6 kerberos +nfsv3 +nfsv4 tcpd elibc_glibc" +RESTRICT=3D"test" #315573 + +# kth-krb doesn't provide the right include +# files, and nfs-utils doesn't build against heimdal either, +# so don't depend on virtual/krb. +# (04 Feb 2005 agriffis) +DEPEND_COMMON=3D"tcpd? ( sys-apps/tcp-wrappers ) + caps? ( sys-libs/libcap ) + sys-libs/e2fsprogs-libs + net-nds/rpcbind + net-libs/libtirpc + nfsv4? ( + >=3Ddev-libs/libevent-1.0b + >=3Dnet-libs/libnfsidmap-0.24 + kerberos? ( + net-libs/librpcsecgss + net-libs/libgssglue + net-libs/libtirpc[kerberos] + app-crypt/mit-krb5 + ) + )" +RDEPEND=3D"${DEPEND_COMMON} !net-nds/portmap" +# util-linux dep is to prevent man-page collision +DEPEND=3D"${DEPEND_COMMON} + >=3Dsys-apps/util-linux-2.12r-r7" + +src_prepare() { + epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch + epatch "${FILESDIR}"/${PN}-1.1.4-no-exec.patch + epatch "${FILESDIR}"/${P}-ti-rpc-static-ports.patch #340797 + # Add nfs.idmap, needed for kernel >=3D2.6.37 with new idmapper support + epatch "${FILESDIR}"/${P}-nfs-idmap.patch + eautoreconf +} + +src_configure() { + econf \ + --with-statedir=3D/var/lib/nfs \ + --enable-tirpc \ + $(use_with tcpd tcp-wrappers) \ + $(use_enable nfsv3) \ + $(use_enable nfsv4) \ + $(use_enable ipv6) \ + $(use_enable caps) \ + $(use nfsv4 && use_enable kerberos gss || echo "--disable-gss") +} + +src_install() { + emake DESTDIR=3D"${D}" install || die + + # Don't overwrite existing xtab/etab, install the original + # versions somewhere safe... more info in pkg_postinst + keepdir /var/lib/nfs/{,sm,sm.bak} + mv "${D}"/var/lib "${D}"/usr/$(get_libdir) || die + + # Install some client-side binaries in /sbin + dodir /sbin + mv "${D}"/usr/sbin/rpc.statd "${D}"/sbin/ || die + + dodoc ChangeLog README + docinto linux-nfs ; dodoc linux-nfs/* + + insinto /etc + doins "${FILESDIR}"/exports + + local f list=3D"" opt_need=3D"" + if use nfsv4 ; then + opt_need=3D"rpc.idmapd" + list=3D"${list} rpc.idmapd rpc.pipefs" + use kerberos && list=3D"${list} rpc.gssd rpc.svcgssd" + fi + for f in nfs nfsmount rpc.statd ${list} ; do + newinitd "${FILESDIR}"/${f}.initd ${f} || die "doinitd ${f}" + done + newconfd "${FILESDIR}"/nfs.confd nfs + dosed "/^NFS_NEEDED_SERVICES=3D/s:=3D.*:=3D\"${opt_need}\":" /etc/conf.= d/nfs #234132 + + # uClibc doesn't provide rpcgen like glibc, so lets steal it from nfs-u= tils + if ! use elibc_glibc ; then + dobin tools/rpcgen/rpcgen || die "rpcgen" + newdoc tools/rpcgen/README README.rpcgen + fi +} + +pkg_postinst() { + # Install default xtab and friends if there's none existing. In + # src_install we put them in /usr/lib/nfs for safe-keeping, but + # the daemons actually use the files in /var/lib/nfs. #30486 + local f + for f in "${ROOT}"/usr/$(get_libdir)/nfs/*; do + [[ -e ${ROOT}/var/lib/nfs/${f##*/} ]] && continue + einfo "Copying default ${f##*/} from /usr/$(get_libdir)/nfs to /var/li= b/nfs" + cp -pPR "${f}" "${ROOT}"/var/lib/nfs/ + done +}