summaryrefslogtreecommitdiffstats
path: root/support/nfs
Commit message (Collapse)AuthorAgeFilesLines
* Add a default flavor to an export's e_secinfo listChuck Lever2013-03-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The list of security flavors that mountd allows for the NFSv4 pseudo-fs is constructed from the union of flavors of all current exports. exports(5) documents that the default security flavor for an export, if "sec=" is not specified, is "sys". Suppose /etc/exports contains: /a *(rw) /b *(rw,sec=krb5:krb5i:krb5p) The resulting security flavor list for the pseudo-fs is missing "sec=sys". /proc/net/rpc/nfsd.export/content contains: /a *(rw,root_squash,sync,wdelay,no_subtree_check, uuid=095c95bc:08e4407a:91ab8601:05fe0bbf) /b *(rw,root_squash,sync,wdelay,no_subtree_check, uuid=2a6fe811:0cf044a7:8fc75ebe:65180068, sec=390003:390004:390005) / *(ro,root_squash,sync,no_wdelay,v4root,fsid=0, uuid=2a6fe811:0cf044a7:8fc75ebe:65180068, sec=390003:390004:390005) The root entry is not correct, as there does exist an export whose unspecified default security flavor is "sys". The security settings on the root cause sec=sys mount attempts to be incorrectly rejected. The reason is that when the line in /etc/exports for "/a" is parsed, the e_secinfo list for that exportent is left empty. Thus the union of e_secinfo lists created by set_pseudofs_security() is "krb5:krb5i:krb5p". I fixed this by ensuring that if no "sec=" option is specified for an export, its e_secinfo list gets at least an entry for AUTH_UNIX. [ Yes, we could make the security flavors allowed for the pseudo-fs a fixed list of all flavors the server supports. That becomes complicated by the special meaning of AUTH_NULL, and we still have to check /etc/exports for whether Kerberos flavors should be listed. I opted for a simple approach for now. ] Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix checking for errors when exporting filesystemsNeilBrown2012-12-171-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | commit 5604b35a61e22930873ffc4e9971002f578e7978 nfs-utils: Increase the stdio file buffer size for procfs files changed writes to some sysfs files to be line buffered (_IOLBF) where they weren't before. While this probably makes sense, it introduced a bug. With fully buffered streams, you don't expect to get an error until you call fflush(). With line buffered streams you can get the error from fprintf() et al. qword_eol() only tests the return from fflush(), not from fprintf(). Consequently errors were not noticed. One result of this is that if you export, with crossmnt, a filesystem underneath which are mounted non-exportable filesystems (e.g. /proc) then an 'ls -l' on the client will block indefinitely waiting for a meaningful 'yes' or 'no' from the server, but will never get one. This patch changes qword_eol to test both fprintf and fflush. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Avoid unnecessary type conversionsChuck Lever2012-10-301-0/+5
| | | | | | | | | Removed a number of Wconversion warnings in the mountd code. Took the opportunity to eliminate some code duplication. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmap: Hide global symbols from libidmap pluginsNoah Friedman2012-03-161-0/+2
| | | | | | | | | This patch limits the visibility of the symbols in the nfs-utils conffile.c so that they are only visible to programs linked directly to it. This forces the objects dynamically loaded via libnfsidmap to use the functions defined in that shared library instead. Signed-off-by: Steve Dickson <steved@redhat.com>
* Kill SPKM3: Remove also the dependent lipkey mechanismSimo Sorce2012-03-121-3/+0
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Kill SPKM3: Remove spkm3 support from exportsSimo Sorce2012-03-121-3/+0
| | | | | signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsmount: Fixed parsing error in the nfsmount.conf code.Steve Dickson2012-03-061-13/+6
| | | | | | | | When the options where prefixed with spaces (instead of tabs) the second option in the list was missed to so a miscalculation the the nfsmount.conf parsing code. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsctl: fix building with newer archesMike Frysinger2012-01-051-1/+7
| | | | | | | Newer arches omitting both nfsctl and nfsservctl which breaks nfsctl. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmapd: Sections in idmapd.conf are ignored.Steve Dickson2011-11-141-1/+2
| | | | | | | | | | In the parsing routine, conf_parse_line(), a string is not being null terminated which is causing section of the config file to be ignored. https://bugzilla.linux-nfs.org/show_bug.cgi?id=205 Signed-off-by: Steve Dickson <steved@redhat.com>
* pdate addres for Free Software FoundationNeilBrown2011-08-293-6/+6
| | | | | | | | | | | | License texts contain multiple address for FSF, some wrong. So update them and replace COPYING file with http://www.gnu.org/licenses/gpl-2.0.txt which has a few changes to preamble and commentary. Also remove extra COPYING file from utils/statd/ Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: let mountd consult /etc/services for portMi Jinlong2011-08-032-45/+44
| | | | | | | | | | | | At RHEL, if user set port for mountd at /etc/services as "mount 12345/tcp", mountd should be bind to 12345, but the latest nfs-utils, mountd get a rand port, not 12345. This patch make sure mountd be bind to the port which was set at /etc/service. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: closing fd associated with /proc/fs/nfsd/export_featuresMasatake YAMATO2011-07-121-2/+3
| | | | | | | | | The fd associated with /proc/fs/nfsd/export_features opened in get_export_features is not closed. Acked-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove risk of nfs_addmntent corrupting mtabNeilBrown2011-05-231-0/+9
| | | | | | | | | | | | nfs_addmntent is used to append directly to /etc/mtab. If the write partially fail, e.g. due to RLIMIT_FSIZE, truncate back to original size and return an error. See also https://bugzilla.redhat.com/show_bug.cgi?id=697975 (CVE-2011-1749) CVE-2011-1749 nfs-utils: mount.nfs fails to anticipate RLIMIT_FSIZE Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: getexportent interprets -test-client- as default optionsBen Myers2011-05-231-3/+8
| | | | | | | | | | | | | | | | | | | | With commit 1374c3861abdc66f3a1410e26cc85f86760b51dd Neil added a -test-client- export to test the exportability of filesystems when exportfs is run. When using the old cache controls (i.e. /proc/fs/nfsd is not mounted) exportfs will read /proc/fs/nfs/exports to process existing exports and find these test client entries. The dash at the beginning of -test-client- will be cause getexportent to look for default options in the rest of the string, which test-client- will not match: exportfs: /proc/fs/nfs/exports:1: unknown keyword "test-client-(rw" This patch resolves that problem (as Steve suggested) by not processing any default options if we are reading the list of existing exports from the kernel. Default options are converted to individual exports by exportfs so the kernel won't have any regardless. Signed-off-by: Ben Myers <bpm@sgi.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports: add a configurable time-to-live for the kernel cache entriesChuck Lever2011-04-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | From: Trond Myklebust <Trond.Myklebust@netapp.com> The fedfs ldap server will specify a ttl for its entries. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> This is a refactoring change only. There should be no change in behavior. Original patch had updates to utils/mountd/junctions.c, which no longer exists. These are not included here. Create a macro for the default cache TTL, which is used in several places besides the export cache. Make e_ttl unsigned. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed a warning from conffile.cSteve Dickson2011-04-061-0/+1
| | | | | | conffile.c:258:19: warning: 'j' may be used uninitialized in this function Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleaned up a warning in rpcdispatch.cSteve Dickson2011-03-051-1/+1
| | | | | | | rpcdispatch.c:40:20: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: Checking RPC Procedure ID before process itSid Moore2010-12-031-0/+5
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* libnfs.a: fix a bug when parse section's argMi Jinlong2010-11-291-2/+2
| | | | | | | When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message. Signed-off-by: Steve Dickson <steved@redhat.com>
* export: Ensure that we free struct exportent->e_uuidTrond Myklebust2010-10-141-0/+2
| | | | | | | | | | | | | | | | | | Currently, the exportent->e_uuid is initialised in support/nfs/exports.c:parseopts(), but it is never freed. Also ensure that exportent->e_uuid is duplicated correctly in dupexportent(). Adjusted to account for the new export_free() helper. Also, e_uuid points to memory that is always allocated with strdup(3), not with xstrdup(). Thus it must be freed via free(3) and not via xfree(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnfs.a: Allow multiple RPC listeners to share listener port numberChuck Lever2010-10-141-6/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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=190 Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix style nits in atomicio.cSteve Dickson2010-10-131-16/+6
| | | | | Signed-off-by: Jim Rees <rees@umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Move common code into supportSteve Dickson2010-10-134-1/+213
| | | | | | | | | | There are several source files and headers present in the ./utils/idmapd directory which are also usable in a doimapd daemon. Because of this we move that support into the support directory such that it can be shared by both daemons. Signed-off-by: Jim Rees <rees@umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Fix source code character encodingChuck Lever2010-09-272-2/+2
| | | | | | | | | | | | | Minor clean up. Most modern Linux distributions set UTF-8 locales. Standardize the character encoding of source files on UTF-8, to squelch vim com- plaints. I probably missed a few spots. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnfs.a: Remove support/nfs/fstab.cSteve Dickson2010-09-271-554/+0
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* libnfs.a: Fix API for getfh() & friendsChuck Lever2010-09-161-6/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is more of a clean-up than a behavioral change. POSIX requires that a "struct sockaddr" is the same size as a "struct sockaddr_in". Therefore, a variable or field of type "struct sockaddr" cannot contain an AF_INET6 address. However, "struct sockaddr *" is often used to reference a generic (ie non-address family specific) socket address, generating some confusion about this. The nfsctl_arg struct uses a struct sockaddr (not a pointer) to pass the client's IP address to the kernel. This means the legacy nfsctl() kernel API can never support IPv6. Fortunately for us, this legacy interface was replaced by a text-based cache interface a few years back. We don't need to support non-AF_INET addresses here. The getfh() functions in nfs-utils provide a handy C API for the kernel's nfsctl interface. The getfh() functions still take a struct sockaddr *, though, and that can imply that a non-IPv4 address can be passed via this API. To make it abundantly clear that only IPv4 addresses can be used with this interface, change the synopses of getfh() and friends to take a struct sockaddr_in * instead of a struct sockaddr * . This makes these functions conform with other places in mountd and exportfs that already grok the difference between a struct sockaddr and a struct sockaddr_in. While we're here... Introduce some nice documenting comments for the get_fh() functions, and... Since mountd will support IPv6 in the near future, assert that the family of client addresses passed to this API is indeed AF_INET, in order to prevent non-AF_INET addresses from ever being passed to the legacy nfsctl() interface. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Recognize "rdma" and "rdma6" netidChuck Lever2010-09-091-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | The mount.nfs command must recognize the values of "rdma" and "rdma6" with the "proto=" mount option. Typically the mount.nfs command relies on libtirpc or getprotobyname(3) to recognize netids and translate them to protocol numbers. RFCs 5665 and 5666 define the "rdma" and "rdma6" netids. IANA defines a specific port number for NFS over RDMA (20049), but has not provided a protocol name and number for RDMA transports, and is not expected to. The best we can do is translate these by hand, as needed, to get RDMA mount requests to the kernel without erroring out. Only the forward translation is needed until such time that "rdma" and "rdma6" start to appear in rpcbind registries. For now, the version and transport negotiation logic is skipped, avoiding rpcbind queries for RDMA mounts. Note: As of kernel 2.6.36, the kernel's NFS over RDMA transport capability does not support IPv6. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from conffile.cSteve Dickson2010-08-091-4/+4
| | | | | | | | | | conffile.c: In function 'conf_parse_line': conffile.c:301: warning: comparison between signed and unsigned integer expressions conffile.c: In function 'conf_load_defaults': conffile.c:356: warning: unused parameter 'tr' Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove warnings from nfs_mntent.cSteve Dickson2010-08-091-1/+1
| | | | | | | nfs_mntent.c: In function 'mangle': nfs_mntent.c:36: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* emove warnings from cacheio.cSteve Dickson2010-08-091-1/+1
| | | | | | | cacheio.c: In function 'cache_flush': cacheio.c:352: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove warnings from svc_socket.cSteve Dickson2010-08-092-4/+4
| | | | | | | svc_socket.c: In function 'svcudp_socket': svc_socket.c:160: warning: unused parameter 'reuse' Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from rpcdispatch.cSteve Dickson2010-08-091-2/+2
| | | | | | | | | | rpcdispatch.c: In function 'rpc_dispatch': rpcdispatch.c:30: warning: comparison between signed and unsigned integer expressions rpcdispatch.c:35: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Convert colons in IPv6 presentation addresses tosemicolonsChuck Lever2010-05-241-3/+39
| | | | | | | | | | | | | | The /var/lib/nfs/rmtab file delineates fields in each of its lines with a ":". The first field contains the IP address of a client, in presentation format. IPv6 presentation format addresses contain colons, which screws up the field delineation of rmtab. Use a simple simple scheme to convert the colons in incoming client names to some other character, and then convert them back when the rmtab file is read. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove some warnings that were introduced by commit 6ca440cSteve Dickson2010-04-081-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix --manage-gids hang due to int/uint bugSteve Dickson2010-03-081-0/+19
| | | | | | | | | | | | | A uid or gid should be represented as unsigned, not signed. The conversion to signed here could cause a hang on access by an unknown user to a server running mountd with --manage-gids; such a user is likely to be mapped to 232-1, which may be converted to 231-1 when represented as an int, resulting in a downcall for uid 231-1, hence the original rpc hanging forever waiting for a cache downcall for 232-1. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Use authunix_create() instead of authsys_create() to fix regression.Steve Dickson2010-03-081-1/+1
| | | | | | | | | | | | | Commit 409b8 introduced a regression when the --disable-tirpc configuration flag is set. The authsys_create() interface, which was introduced, does not exist in the legacy glibc library. Since the authsys_create() interface is a redefined of the authunix_create() interface, which is defined in glibc, using authunix_create() resolves the regression, Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: add and use nfs_authsys_createJeff Layton2010-03-011-0/+21
| | | | | | | | | | | | | | | | | | The current mount, umount and showmount code uses authunix_create_default to get an auth handle. The one provided by glibc returned a truncated list of groups when there were more than 16 groups. libtirpc however currently does an abort() in this case, which causes the program to crash and dump core. nfs-utils just uses these auth handles for the MNT protocol, so the group list doesn't make a lot of difference here. Add a new function that creates an auth handle with a supplemental gids list that consists only of the primary gid. Have nfs-utils use that function anywhere that it currently uses authunix_create_default. Also, have the caller properly check for a NULL return from that function. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: don't fdatasync the rmtabBen Myers2010-02-122-8/+20
| | | | | | | If we're using the new caching interface the rmtab will be ignored by exportfs so there is no need to fdatasync. This improves mountd performance. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: remove xflock timeoutBen Myers2010-02-121-17/+1
| | | | | | | Remove this 10 second timeout which can cause unexpected behavior and corruption in the rmtab when hit. Signed-off-by: Steve Dickson <steved@redhat.com>
* Tone down a number xlog messages in svc_create_bindaddr()Steve Dickson2010-01-151-11/+5
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: Support TI-RPC statd listenerChuck Lever2010-01-152-1/+254
| | | | | | | | | | | | | | | | | | | | If TI-RPC is available, use it to create statd's svc listener. If not, use the old function, rpc_init(), to create statd's listener. IPv6 can be supported if TI-RPC is available. In this case, /etc/netconfig is searched to determine which transports to advertise. Add the new listener creation API in libnfs.a since other components of nfs-utils (such as rpc.mountd) will eventually want to share it. A little re-arrangement of when the statd listener is created is done to make unregistration of the statd service more reliable. As it is now, the statd service is never unregistered when it exits. After it is gone, other programs usually hang when trying to access statd or see if it's running, since the registration is still there but statd itself does not respond. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
* nfs-utils: Collect socket address helpers into one locationChuck Lever2010-01-152-57/+19
| | | | | | | | | | | | | Introduce generic helpers for managing socket addresses. These are general enough that they are useful for pretty much any component of nfs-utils. We also include the definition of nfs_sockaddr here, so it can be shared. See: https://bugzilla.redhat.com/show_bug.cgi?id=448743 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
* Revert "Automatically set 'nohide' on referral exports."J. Bruce Fields2010-01-131-6/+0
| | | | | | | | | | | | | This partially reverts commit ec637de16210c1c6fcb3a0df34d7889592f577dc. Only NFSv4 clients will actually want to see referall points--others are better off just seeing an empty directory, that they can manually (or with automount) mount the appropriate filesystem on. So we want the kernel to automatically traverse only in the v4 case (as recent kernels do). Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* exports: common exportent initializerJ. Bruce Fields2010-01-131-32/+27
| | | | | | Consolidate duplicated initialization code. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* exports: NFSv4 pseudoroot support routinesSteve Dickson2010-01-131-1/+1
| | | | | | | | | Create v4root exports for each directory that is a parent of an explicit export. Give each the minimal security required to traverse to any of its children. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* exports: let kernel decide which flags vary by flavorJ. Bruce Fields2010-01-131-26/+57
| | | | | | | | | Query the kernel to ask which flavors vary by pseudoflavor, and use that instead of a fixed constant. To allow the possibility of more flags varying by pseudoflavor, use the set/clear_flags functions for all options instead of setting some by hand. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* exports: minor parse_opts cleanupJ. Bruce Fields2010-01-131-5/+13
| | | | | | | Move this into a helper function. (We'll be adding a little more code here.) Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* libnfs.a: Provide shared helpers for managing netidsChuck Lever2009-12-111-7/+85
| | | | | | | | Introduce a couple of shared functions that can convert netids to protocol numbers and families, and back. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleaned up parsing errors to hopeful be more preciseSteve Dickson2009-08-171-5/+5
| | | | | | | Also had mount_config_init() call xlog_open() so the program name is set on xlog() calls. Signed-off-by: Steve Dickson <steved@redhat.com>
* Added support for line comments parsing which shouldBenny Halevy2009-08-171-5/+19
| | | | | | help with readability with in the configuration file. Signed-off-by: Steve Dickson <steved@redhat.com>