summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* The mount sockaddr len (mnt_salen) is not be set inSteve Dickson2009-02-171-2/+3
| | | | | | | | nfs_extract_server_addresses() which causes the mount.nfs command to segmentation fault when a NFS server only supports UDP mounts. Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: fix return value from po_rightmost()Chuck Lever2009-02-174-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently commit 0dcb83a8 changed the po_rightmost() function to distinguish among several possible mount options by taking a table containing the alternatives, and returning the table index of the entry which is rightmost in the mount option string. If it didn't find any mount option that matches an entry from the passed-in table, it returned zero. This was the same behavior it had before, when it only checked for two options at a time. It returned PO_NEITHER_FOUND, which was zero. Since this is C, however, zero also happens to be a valid index into the passed-in array of options. Modify the po_rightmost() function to return -1 if the entry wasn't found, and fix up the callers to look for a C-style array index that starts at zero. Thanks to Steve Dickson for troubleshooting the problem. His solution was merely to bump the return value, as callers already expected an ordinal index instead of a C-style index. I prefer this equivalent but slightly more extensive change because it makes the behavior of po_rightmost() more closely match how humans understand C arrays to work. Let's address some of the confusion that caused this bug, as well as fixing the run-time behavior. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: support AF_INET6 in rewrite_mount_options()Chuck Lever2009-01-271-25/+49
| | | | | | | | | | Now that we have an AF_INET6-capable probe_bothports(), we can support AF_INET6 when rewriting text-based NFS mount options. This should be adequate to support NFS transport protocol and version negotiation with AF_INET6 NFS servers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: fix mount option rewriting logicChuck Lever2009-01-271-34/+79
| | | | | | | Fix a bunch of corner cases in the text-based mount option rewriting logic. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount options: Use new pmap stuffer when rewriting mount optionsChuck Lever2009-01-271-63/+5
| | | | | | | | | | | all nfs_options2pmap() in nfs_rewrite_mount_options() instead of open-coding the logic to convert mount options to a pmap struct. The new nfs_options2pmap() function is more careful about avoiding invalid mount option values, and handles multiply-specified transport protocol options correctly. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: Function to stuff "struct pmap" from mount optionsChuck Lever2009-01-272-0/+219
| | | | | | | | | Both the text-based mount.nfs command and the umount.nfs command need to fill in a pmap structure based on string mount options. Introduce a shared function that can do this. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: make po_rightmost() work for N optionsChuck Lever2009-01-273-24/+41
| | | | | | | | | | | Sometimes we need to choose the rightmost option among multiple different mount options. For example, we want to find the rightmost of "proto," "tcp," and "udp". Or, the rightmost of "vers," "nfsvers," "v2," and "v3". Update po_rightmost() to choose among N options instead of just two. Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: Quiesce warning when TI-RPC is disabledChuck Lever2009-01-071-7/+7
| | | | | | | | | | Make sure nfs_sm_pgmtbl is not compiled if TI-RPC functions are not available. This quiesces the following compiler warning: showmount.c:53: warning: nfs_sm_pgmtbl defined but not used Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* configure: Add new build option "--enable-tirpc"Chuck Lever2009-01-071-8/+22
| | | | | | | | | | | | | | | | | | | | | | Allow easier testing of nfs-utils in legacy environments by providing a "configure" option to force the build not to use libtirpc, even if it's present on the build system. This can also be tried as a fallback if problems are found with the new TI-RPC-based nfs-utils code. The new option is: --enable-tirpc enable use of TI-RPC [default=no] Build option matrix: --disable-tirpc --disable-ipv6 Default; IPv4 only, glibc RPC --disable-tirpc --enable-ipv6 'configure' will fail --enable-tirpc --disable-ipv6 IPv4 only, TI-RPC --enable-tirpc --enable-ipv6 IPv4 and IPv6, TI-RPC Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* configure: Remove inet_ntop(3) check from configure.acChuck Lever2009-01-071-3/+1
| | | | | | | | nfs-utils no longer uses inet_ntop(3) so remove checks for it from configure.ac. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Merge branch 'master' of git://linux-nfs.org/nfs-utilsSteve Dickson2009-01-073-31/+127
|\
| * configure: use "--disable-uuid" instead of "--without-uuid"Chuck Lever2009-01-061-1/+1
| | | | | | | | | | | | | | | | | | Reported by Kevin Coffman and Jonathan Andrews. Apparently --without-uuid doesn't work with some older versions of autoconf, so correct the help text to document the option that actually does the trick. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
| * mount command: Random clean upChuck Lever2009-01-062-2/+3
| | | | | | | | | | | | | | Fix some documenting comments and an error message in configure.ac. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
| * mount: getport: don't use getaddrinfo(3) on old systemsChuck Lever2009-01-061-10/+59
| | | | | | | | | | | | | | | | | | Older glibc versions have a getaddrinfo(3) that doesn't support AI_ADDRCONFIG. Detect that case and build something else for getport.c that will work adequately on those systems. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
| * mount command: use gethostbyname(3) when building on old systemsChuck Lever2009-01-062-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Glibc's getaddrinfo(3) implementation was added over time. Some old versions support AI_ADDRCONFIG, but don't define it in header files. Some older versions don't support AI_ADDRCONFIG at all. Let's add specific checks to configure.ac to see that the local getaddrinfo(3) implementation is complete. If it isn't, we will make available a resolver that uses gethostbyname(3) and disable IPv6 entirely. This patch should apply to 1.1.4 as well as the current nfs-utils repo. The next patch has a fix for the getaddrinfo(3) call added since 1.1.4 in support/nfs/getport.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
| * mount: revert recent fix for build problems on old systemsChuck Lever2009-01-061-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert the patch that added local definitions of AI_ADDRCONFIG and friends to utils/mount/network.c. While old header versions don't have those flags, even older versions of getaddrinfo(3) don't support those flags at all. The result is this error: mount.nfs: DNS resolution failed for 10.10.10.10: Bad value for ai_flags Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* | gssd: By default, don't spam syslog when users' credentials expireKevin Coffman2009-01-054-11/+11
|/ | | | | | | | | | | | | | | | | | Change the priority of "common" log messages so that syslog doesn't get slammed/spammed when users' credentials expire, or there is another common problem which would cause error messages for all context creation requests. Note that this will now require that gssd or svcgssd option "-v" is used to debug these common cases. Original patch from Andrew Pollock <apollock@google.com>. Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com> CC: Andrew Pollock <apollock@google.com>
* Now that the TCP wrapper actually works, mounts willSteve Dickson2009-01-031-4/+16
| | | | | | | | be denied with misconfigured DNS configurations. Warnings will be logged when these types of configurations are detected. Signed-off-by: Steve Dickson <steved@redhat.com>
* To ensure the hash table of clients has validSteve Dickson2008-12-191-3/+42
| | | | | | | | | access rights, check the modification times on both access files. If one of them have change, update the hash entry instead of creating a new entry. Signed-off-by: Steve Dickson <steved@redhat.com>
* Clients IP address and host names are check onSteve Dickson2008-12-191-0/+79
| | | | | | | | | | every RPC request, to both mountd and statd when TCP wrappers are enabled. To help this process scale better the access rights are stored in a hash table, which are hashed per IP address, RPC program and procudure numbers. Signed-off-by: Steve Dickson <steved@redhat.com>
* When clients are define as IP addresses in /etc/hosts.deny,Steve Dickson2008-12-191-44/+45
| | | | | | | | access is allow due to misinterpreting the return value of hosts_ctl(). This patch reworks that logic which closes that hole. Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: not unlinking host filesSteve Dickson2008-12-173-17/+19
| | | | | | | | | | | | | | | Statd is not unlinking host files during SM_UNMON and SM_UNMON_ALL calls because the given host is still on the run-time notify list (rtnl) and the check flag is set when xunlink() is called. But the next thing the caller of xunlink() does is remove the host from the rtnl list which means the unlink will never happen. So this patch removes the check flag from xunlink() since its not needed and correctly allocates and frees memory used by xunlink(). Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify command: fix a use-after-free bugChuck Lever2008-12-171-11/+14
| | | | | | | | | | | | | The recv_reply() function was referencing host->ai in a freeaddrinfo(3) call after it had freed @host. This is not likely to be harmful in a single-threaded user context, but it's still bad form, and it will get called out if testing sm-notify with poisoned free memory. The less noise, the better we are able to see real problems. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: use po_get_numeric() for handling retryChuck Lever2008-12-171-9/+11
| | | | | | | | Replace the logic in nfs_parse_retry_option() with a call to the new po_get_numeric() function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: add function to parse numeric mount optionsChuck Lever2008-12-172-0/+58
| | | | | | | | Introduce a function that is especially for parsing keyword mount options that take a numeric value. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* svcgssd: use the actual context expiration for cacheKevin Coffman2008-12-111-7/+13
| | | | | | | | | | | | | | | Instead of sending down an infinite expiration value for the rsi(init) and rsc(context) cache entries, use a reasonable value for the rsi cache, and the actual context expiration value for the rsc cache. Prompted by a proposal from Neil Brown as a result of a complaint of a server running out of kernel memory when under heavy load of rpcsec_gss traffic. Neil's original patch used one minute for the init cache and one hour for the context cache. Using the actual expiration time prevents unnecessary context re-negotiation. Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd/svcgssd: add support to retrieve actual context expirationKevin Coffman2008-12-118-17/+30
| | | | | | | | | Add some plumbing so that the context expiration can be returned while serializing the information. Later patch(es) will actually get the expiration and pass it down to the kernel. Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: AF_INET6 support for probe_bothports()Chuck Lever2008-12-112-21/+68
| | | | | | | | | | | | | | | | Introduce an AF_INET6 capable probe_bothports() API. This means replacing "struct sockaddr_in *" arguments with a "struct sockaddr *" and a socklen_t arguments. These functions often combine a "struct sockaddr_in" and a "struct pmap" into a single "clnt_addr_t" argument. Instead of modifying "clnt_addr_t" and all the legacy code that uses it, I'm going to create a new probe_bothports() API for the text-based mount command that takes a "struct sockaddr *" and sockaddr length, and leave the existing probe_bothports() interface, which takes "clnt_addr_t" arguments, for legacy use. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: support AF_INET6 in probe_nfsport() and probe_mntport()Chuck Lever2008-12-111-16/+42
| | | | | | | | Flesh out support for AF_INET6 in the intermediate helper functions probe_nfsport() and probe_mntport(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: full support for AF_INET6 addresses in probe_port()Chuck Lever2008-12-111-10/+44
| | | | | | | | Now that probe_port() uses an AF_INET6-capable rpcbind query and RPC ping, finish updating probe_port() to support AF_INET6 addresses fully. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify: always exiting without any notificationSteve Dickson2008-12-061-1/+2
| | | | | | | | Added curly brackets around the record_pid() check which stop sm-notify from exiting when a pid file does not exist. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: remove local getport() implementationChuck Lever2008-12-021-74/+2
| | | | | | | | Eliminate local getport() implementation from utils/mount/network.c, as it is no longer used. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: Replace clnt_ping() and getport() calls in probe_port()Chuck Lever2008-12-021-14/+29
| | | | | | | | | | | Update the mount command's probe_port() function to call the new shared rpcbind query and RPC ping functions. This provides immediate support for rpcbind v3/v4 queries, and paves the way for supporting AF_INET6 in the probe_bothports() path. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: Use nfs_error() instead of perror()Chuck Lever2008-12-021-1/+2
| | | | | | | | So we can ensure that error output is directed appropriately, use nfs_error() instead of perror() in start_statd(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: Use nfs_pmap_getport() in probe_statd()Chuck Lever2008-12-021-18/+16
| | | | | | | | Repace the getport() and clnt_ping() calls in probe_statd() with their new shared equivalents. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Ensure statd gets started if required when non-rootNeil Brown2008-11-262-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | user mounts an NFS filesystem. The first time an NFS filesystem is mounted, we start statd from /sbin/mount.nfs. If this first time is a non-root user doing the mount, (thanks to e.g. the 'users' option in /etc/fstab) then we need to be sure that the 'setuid' status from mount.nfs is inherited through to rpc.statd so that it runs as root. There are two places where we loose our setuid status due to the shell (/bin/sh) discarding. 1/ mount.nfs uses "system" to run /usr/sbin/start-statd. This runs a shell which is likely to drop privileges. So change that code to use 'fork' and 'execl' explicitly. 2/ start-statd is a shell script. To convince the shell to allow the program to run in privileged mode, we need to add a "-p" flag. We could just call setuid(getuid()) at some appropriate time, and it might be worth doing that as well, however I think that getting rid of 'system()' is a good idea and once that is done, the adding of '-p' is trivial and sufficient. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: unblock DNOTIFY_SIGNAL in case it was blocked.Neil Brown2008-11-261-0/+6
| | | | | | | | | | | | | | | | | | | | I have a situation where rpc.gssd appears to not be working. Mount attempts which need to communicate with it block. I've narrowed down the problem to that fact that all realtime signals have been blocked. This means that DNOTIFY_SIGNAL (which is a realtime signal) is never delivered, so gssd never rescans the rpc_pipe/nfs directory. It seems start_kde (or whatever it is called) and all descendants have these signals blocked. xfce seems to do the same thing. gnome doesn't. So if you start rpc.gssd from a terminal window while logged in via KDE, it doesn't behave as expected. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: support querying IPv6 serversChuck Lever2008-11-251-0/+36
| | | | | | | | | | Introduce a version of nfs_get_mount_client() that supports AF_INET6 and AF_INET server addresses. If the TI-RPC library is not available when the showmount command is built, fall back to the legacy RPC user-space API. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: move logic to acquire RPC client handle out of main()Chuck Lever2008-11-251-52/+64
| | | | | | | | | | In preparation to support IPv6 in the showmount command, extract the logic that parses/acquires the target hostname and converts it into an RPC client handle to contact the remote mountd service, and move it into its own function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: Remove unused local getport() implementationChuck Lever2008-11-251-105/+0
| | | | | | | | Clean up: remove showmount.c's local getport() implementation, now that the showmount command uses the shared one. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: call nfs_getport instead of local getportChuck Lever2008-11-251-6/+8
| | | | | | | | | | Have the showmount command invoke the shared nfs_getport() function instead of its own local version. This gives the showmount command immediate support for querying via rpcbindv3/v4 in addition to portmapper, and sets the stage for AF_INET6 support in showmount. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Added support/nfs/getport.cSteve Dickson2008-11-181-0/+965
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce rpcbind client utility functionsChuck Lever2008-11-172-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that at least the mount command and the showmount command need to query a server's rpcbind daemon. They need to query over AF_INET6 as well as AF_INET. libtirpc provides an rpcbind query capability with the rpcb_getaddr(3) interface, but it takes a hostname and netconfig entry rather than a sockaddr and a protocol type, and always uses a lengthy timeout. The former is important to the mount command because it sometimes must operate using a specific port and IP address rather than depending on rpcbind and DNS to convert a [hostname, RPC program, netconfig] tuple to a [socket address, port number, transport protocol] tuple. The rpcb_getaddr(3) API also always uses a privileged port (at least for setuid root executables like mount.nfs), which is not required for an rpcbind query. This can exhaust the local system's reserved port space quickly. This patch provides a reserved-port-friendly AF_INET6-capable rpcbind query C API that can be shared among commands and tools in nfs-utils, and allows a query to a specified socket address and port rather than a hostname. In addition to an rpcbind query interface, this patch also provides a facility to ping the remote RPC service to ensure that it is operating as advertised by rpcbind. It's useful to combine an RPC ping with an rpcbind query because in many cases, components of nfs-utils already ping an RPC service immediately after receiving a successful GETPORT result. There are also a handful of utility routines provided, such as a functions that can map between [sockaddr, port] and a universal address. I've made an attempt to make these new functions build and operate on systems that do not have libtirpc. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Add AF_INET6-capable API to acquire an RPC CLIENT *Chuck Lever2008-11-174-1/+605
| | | | | | | | | | | | Provide a simple interface that any component of nfs-utils can use to acquire an RPC CLIENT *. This is an AF_INET6-enabled API, and can also handle PF_LOCAL sockets if libtirpc is present on the system. When libtirpc is not available, legacy RPC services will be used instead, and an attempt to connect to an AF_INET6 address will fail. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Get rid of empty AUTHORS fileJan Engelhardt2008-10-212-1/+2
| | | | | | | | | | build: remove redundant AUTHORS file One can use the --foreign automake option to make it not enforce presence of an AUTHORS file. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Release 1.1.4Steve Dickson2008-10-171-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify should exit as soon as its determinedPhil Endecott2008-10-141-3/+10
| | | | | | | there are no hosts to notify. This also decreases start up time by a few seconds. Signed-off-by: Steve Dickson <steved@redhat.com>
* rpcgen: include sys/ioctl.h on linux systemsMike Frysinger2008-10-081-0/+3
| | | | | | | | | The rpcgen tool included with nfs-utils will generate calls to ioctl() but not actually generate the sys/ioctl.h header include. Attached patch should fix this. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Clarify behavior of the mountproto= and proto= optionsChuck Lever2008-10-081-0/+85
| | | | | | | | Document the interaction between the mountproto= and the proto= mount options in a new subsection of nfs(5). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: make makesock() staticChuck Lever2008-10-081-42/+40
| | | | | | | | | | | | | | | | | | Clean up: The makesock() function can become static since it is only used in rpcmisc.c, where it is defined. Fix some minor nits while we're in the area: o Move it so we can remove it's forward declaration. o Get rid of unneeded newlines in the xlog() format strings. o Use htonl(INADDR_ANY) instead of INADDR_ANY to initialize sin_addr. Should make no run-time difference, but is slightly more proper, as the standard definition of INADDR_ANY is in host byte-order. o Remove the parentheses in the "return" statements. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>