summaryrefslogtreecommitdiffstats
path: root/utils/mountd
Commit message (Collapse)AuthorAgeFilesLines
* autoconf: only link binaries that need it to libtirpcJeff Layton2012-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is essentially the same as the previous version, but has been respun to fix up some merge conflicts with some of Chuck's recent changes. When we first added tirpc support, we took a "big hammer" approach, and had it add libtirpc to $LIBS. That had the effect of making it so that that library was linked into every binary. That's unnecessary, and wasteful with memory. Don't let AC_CHECK_LIB add -ltirpc to $LIBS. Instead, have the autoconf tests set $(LIBTIRPC) in the makefiles, and have the programs that need it explicitly include that library. In the event that we're not using libtirpc, then set $LIBTIRPC to a blank string. This necessitates a change to the bindresvport_sa check too. Since that library is no longer included in $LIBS, we need to convert that check to use AC_CHECK_LIB instead of AC_CHECK_FUNCS. This patch also fixes a subtle bug. If the library was usable, but the includes were not, the test would set $enable_tirpc to "no", but HAVE_LIBTIRPC would still be true. That configuration would likely fail to build. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support junction management plug-insChuck Lever2012-01-052-2/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support FedFS and NFS junctions without introducing additional build-time or run-time dependencies on nfs-utils, the community has chosen to use a dynamically loadable library to handle junction resolution. There is one plug-in library for mountd that will handle any NFS- related junction type. Currently there are two types: o nfs-basic locally stored file set location data, and o nfs-fedfs file set location data stored on an LDAP server mountd's support for this library is enabled at build time by the presence of the junction API definition header: /usr/include/nfs-plugin.h If this header is not found on the build system, mountd will build without junction support, and will operate as before. Note that mountd does not cache junction resolution results. NFSD already caches these results in its exports cache. Thus each time NFSD calls up to mountd, it is, in essence, requesting a fresh junction resolution operation, not a cached response. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: remove newline from xlog() format specifier stringsChuck Lever2012-01-051-5/+5
| | | | | | | | Clean up: xlog() already adds a newline to the end of each line of output. Remove the superfluous newline from a number of xlog() call sites in mountd. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Plug v4root memory leakChuck Lever2012-01-051-1/+1
| | | | | | | | | | | | Valgrind reports that the memory allocated for eep's e_hostname field was not being freed. eep is not visible outside of v4root_create(), so we don't need to strdup() that string. Introduced by commit 3b777b0 "exports: NFSv4 pseudoroot support routines" (Dec 1, 2009). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fixed strcmp usage in in insert groups.Matthew Treinish2011-08-031-1/+1
| | | | | | | | | Fixed the usage of strcmp in the duplicate check in insert groups. Fixes an issue with showmount and other commands that required the group information. Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: let mountd consult /etc/services for portMi Jinlong2011-08-031-1/+4
| | | | | | | | | | | | 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>
* mountd: move fsidtype-specific code to helpersJ. Bruce Fields2011-06-271-111/+129
| | | | | | | Now we can move these big switch statements into helper functions. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: gather fsid information into one structJ. Bruce Fields2011-06-271-34/+45
| | | | | | | | | | | | A large part of nfsd_fh() is concerned with extracting fsid-type-specific information from the fsid, then matching that information with information from the export list and the filesystem. Moving all that information into one struct will allow some further simplifications. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: prefer explicit subexports over crossmnt parentsJ. Bruce Fields2011-06-271-3/+15
| | | | | | | | | | | | | | If a parent is exported with crossmnt, and if a child is also explicitly exported, then both exports could potentially produce matches in this loop; that isn't a bug. Instead of warning and ignoring the second match we find, we should instead prefer whichever export is deeper in the tree, so that children's options can override those of their parents. Reported-by: Olga Kornievskaia <aglo@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix missing varialble assignment in auth_unix_gidPavel Shilovsky2011-06-071-2/+4
| | | | | | | | | When we get into auth_unix_gid at the second time, groups_len is not 0 and ngroups variable leave as 0. Then we use ngroups in getgrouplist that fails in this case. This patch fixes it. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed compilation warnings from mountd/cache.cJim Rees2011-05-181-5/+5
| | | | | | | Commit 5604b35a6 introduced a number of missing initializer warnings that were missed. This patch removes those warnings. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Increase the stdio file buffer size for procfs filesSean Finney2011-04-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when writing to /proc/net/rpc/*/channel, if a cache line were larger than the default buffer size (likely 1024 bytes), mountd and svcgssd would split writes into a number of buffer-sized writes. Each of these writes would get an EINVAL error back from the kernel procfs handle (it expects line-oriented input and does not account for multiple/split writes), and no cache update would occur. When such behavior occurs, NFS clients depending on mountd to finish the cache operation would block/hang, or receive EPERM, depending on the context of the operation. This is likely to happen if a user is a member of a large (~100-200) number of groups. Instead, every fopen() on the procfs files in question is followed by a call to setvbuf(), using a per-file dedicated buffer of RPC_CHAN_BUF_SIZE length. Really, mountd should not be using stdio-style buffered file operations on files in /proc to begin with. A better solution would be to use internally managed buffers and calls to write() instead of these stdio calls, but that would be a more extensive change; so this is proposed as a quick and not-so-dirty fix in the meantime. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use a dynamic buffer for storing lists of gid'sSean Finney2011-04-191-9/+20
| | | | | | | | | | | | | Previously, in auth_unix_gid, group lists were stored in an array of hard-coded length 100, and in the situation that the group lists for a particular call were too large, the array was swapped with a dynamically allocated/freed buffer. For environments where users are commonly in a large number of groups, this isn't an ideal approach. Instead, use malloc/realloc to grow the list on an as-needed basis. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports: add a configurable time-to-live for the kernel cache entriesChuck Lever2011-04-061-7/+8
| | | | | | | | | | | | | | | | | | | | | | 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 v4root.cSteve Dickson2011-04-061-3/+6
| | | | | | v4root.c:176:9: warning: variable 'ret' set but not used Signed-off-by: Steve Dickson <steved@redhat.com>
* Fixed segfault in rpc.mountdSteve Dickson2011-01-261-0/+1
| | | | | | | | | A unallocated piece of memory, instead of a NULL point, was being used to initialize a ->next point in the mount link list which caused a segfault after a few remote accesses via the showmount command. Signed-off-by: Steve Dickson <steved@redhat.com>
* Updated rpc.mountd man pageSteve Dickson2010-10-201-3/+3
| | | | | | | | Updated the rpc.mountd man page to no longer reference v3 as the "newer" version and also mentioned v4 as a supported version. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Clear mountd registrations at start upChuck Lever2010-10-141-6/+4
| | | | | | | | Clear stale MNT registrations before mountd tries to create fresh listeners, to ensure that mountd starts. This is also what statd does. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Update mountd/exportfs man pages to reflect IPv6 changesChuck Lever2010-09-271-86/+154
| | | | | | | | | | | | Document IPv6 support in rpc.mountd and exportfs, and clarify existing language in the man page. Clean up: Use bold consistently for program names, and italics consistently for file names. Use "rpc.mountd" consistently as the name of the mountd daemon. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use MNT status values instead of NFSERRChuck Lever2010-09-271-11/+11
| | | | | | | | | Clean up: The MNT protocol has its own enum type defining error status values. While the values can be the same as the NFSERR enum type on some systems, it's not guaranteed to be true everywhere. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix up version and usage messagesChuck Lever2010-09-271-16/+22
| | | | | | | | | Clean up: rpc.mountd is no longer known as kmountd. Use the program's basename rather than the full pathname for the usage message. Display a version message at start up similar to statd's. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Unregister mountd if my_svc_run() returnsChuck Lever2010-09-271-1/+2
| | | | | | | | | | | Fix a long standing bug: when my_svc_run() returns, mountd should unregister itself with the local rpcbind so that it can subsequently start cleanly. Log a more helpful error message in this case. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support TI-RPC mountd listenerChuck Lever2010-09-271-9/+17
| | | | | | | | | | | If TI-RPC is available, use it to create mountd's svc listener. If not, use the old function, rpc_init(), to create mountd's listener. IPv6 can be supported if TI-RPC is available. In this case, /etc/netconfig is searched to determine which transports to advertise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Make NFS version checks more strictChuck Lever2010-09-271-8/+39
| | | | | | | | Ensure users and programmers specify NFS version numbers correctly. This also makes the next patch more clean. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Ensure cache downcall can handle IPv6 addressesChuck Lever2010-09-161-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Handle IPv6 addresses in kernel auth_unix_ip upcallsChuck Lever2010-09-161-3/+3
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: clean up cache APIChuck Lever2010-09-163-14/+43
| | | | | | | | | | | | | | | | | | | | | | | Clean up: Squelch compiler warnings and document public parts of cache API. cache.c: At top level: cache.c:67: warning: no previous prototype for auth_unix_ip cache.c:123: warning: no previous prototype for auth_unix_gid cache.c:217: warning: no previous prototype for get_uuid cache.c:247: warning: no previous prototype for uuid_by_path cache.c:326: warning: no previous prototype for nfsd_fh cache.c:745: warning: no previous prototype for nfsd_export cache.c:820: warning: no previous prototype for cache_open cache.c:832: warning: no previous prototype for cache_set_fd cache.c:841: warning: no previous prototype for cache_process_req cache.c:921: warning: no previous prototype for cache_export cache.c:953: warning: no previous prototype for cache_get_filehandle Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support IPv6 in mountlist_list()Chuck Lever2010-09-161-7/+9
| | | | | | | | | | | Replace inet_aton(3) and gethostbyaddr(3) calls in mountlist_list() with calls to the new host_foo() DNS helpers. The new functions will support IPv6 without additional changes, once IPv6 is enabled in the generic hostname helpers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Handle memory exhaustion in mountlist_list()Chuck Lever2010-09-161-8/+24
| | | | | | | | | | | | I'm about to replace inet_aton(3)/gethostbyaddr(3) with host_pton()/host_canonname() in mountlist_list(). Since host_canonname() returns a string allocated with strdup(3) instead of xstrdup(), mountlist_list() must now deal with memory exhaustion properly. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Add mountlist_freeall()Chuck Lever2010-09-161-6/+13
| | | | | | | | I'm about to add a second bit of logic that needs to free all mountlist records, so introduce a helper for freeing them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: support IPv6 in mountlist_del_all()Chuck Lever2010-09-163-9/+7
| | | | | | | | Replace IPv4-specific code in the mountlist_del_all() path with code that is address family agnostic. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support IPv6 in mountd's svc routinesChuck Lever2010-09-161-20/+59
| | | | | | | | | | | | | | Replace IPv4-specific code with use of our generic hostname helpers in the routines that handle incoming MNT RPC requests. These functions will support IPv6 without additional changes, once IPv6 is enabled in the generic hostname helpers. As part of this update, I've modified all of mountd's _svc routines to use a debug message format that is consistent with statd. It may be overkill for some of these; if so we can pull them out later. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: add IPv6 support in auth_authenticate()Chuck Lever2010-09-164-35/+39
| | | | | | | Make the entire auth_authenticate() code path address-family agnostic. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnfs.a: Fix API for getfh() & friendsChuck Lever2010-09-161-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Removed warnings from mountd.cSteve Dickson2010-08-091-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mountd.c: In function 'mount_null_1_svc': mountd.c:195: warning: unused parameter 'rqstp' mountd.c:195: warning: unused parameter 'argp' mountd.c:195: warning: unused parameter 'resp' mountd.c: In function 'mount_dump_1_svc': mountd.c:213: warning: unused parameter 'argp' mountd.c: In function 'mount_umnt_1_svc': mountd.c:224: warning: unused parameter 'resp' mountd.c: In function 'mount_umntall_1_svc': mountd.c:248: warning: unused parameter 'argp' mountd.c:248: warning: unused parameter 'resp' mountd.c: In function 'mount_export_1_svc': mountd.c:258: warning: unused parameter 'argp' mountd.c: In function 'mount_exportall_1_svc': mountd.c:269: warning: unused parameter 'argp' mountd.c: In function 'mount_dump_1_svc': mountd.c:216: warning: unused parameter 'argp' mountd.c: In function 'mount_umnt_1_svc': mountd.c:227: warning: unused parameter 'resp' mountd.c: In function 'mount_umntall_1_svc': mountd.c:251: warning: unused parameter 'argp' mountd.c:251: warning: unused parameter 'resp' mountd.c: In function 'mount_export_1_svc': mountd.c:261: warning: unused parameter 'argp' mountd.c: In function 'mount_exportall_1_svc': mountd.c:272: warning: unused parameter 'argp' Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from cache.cSteve Dickson2010-08-091-9/+9
| | | | | | | | | | | | | | | | | | cache.c:812: warning: missing initializer cache.c:812: warning: (near initialization for 'cachelist[0].f') cache.c:813: warning: missing initializer cache.c:813: warning: (near initialization for 'cachelist[1].f') cache.c:814: warning: missing initializer cache.c:814: warning: (near initialization for 'cachelist[2].f') cache.c:815: warning: missing initializer cache.c:815: warning: (near initialization for 'cachelist[3].f') cache.c:816: warning: missing initializer cache.c:816: warning: (near initialization for 'cachelist[4].f') cache.c: In function 'cache_export_ent': cache.c:887: warning: comparison between signed and unsigned integer expressions cache.c:907: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from fsloc.cSteve Dickson2010-08-093-3/+3
| | | | | | | fsloc.c: In function 'replicas_lookup': fsloc.c:149: warning: unused parameter 'key' Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix memcmp result comparison error for uuid match.Doug Nazar2010-07-191-1/+1
| | | | | | Fixed Small typo in the new fs uuid comparison code Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Replace "struct hostent" with "struct addrinfo"Chuck Lever2010-06-223-58/+67
| | | | | | | | | | | | | | | | | | | struct hostent can store either IPv4 or IPv6 addresses, but it can't store both address families concurrently for the same host. Neither can hostent deal with parts of socket addresses that are outside of the sin{,6}_addr field. Replace the use of "struct hostent" everywhere in libexport.a, mountd, and exportfs with "struct addrinfo". This is a large change, but there are so many strong dependencies on struct hostent that this can't easily be broken into smaller pieces. One benefit of this change is that hostent_dup() is no longer required, since the results of getaddrinfo(3) are already dynamically allocated. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add helpers to manage DNS lookupsChuck Lever2010-06-222-9/+12
| | | | | | | | | | | | | | | Introduce DNS query helpers based on getaddrinfo(3) and getnameinfo(3). These will eventually replace the existing hostent-based functions in support/export/hostname.c. Put some of these new helpers to immediate use, where convenient. As they are part of libexport.a, I've added the forward declarations for these new functions in exportfs.h rather than misc.h, where the hostent-based forward declarations are currently. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Improve support for exporting btrfs subvolumesNeilBrown2010-06-221-29/+78
| | | | | | | | | | | | | | | | | | | If you export two subvolumes of a btrfs filesystem, they will both be given the same uuid so lookups will be confused. blkid cannot differentiate the two, so we must use the fsid from statfs64 to identify the filesystem. We cannot tell if blkid or statfs is best without knowing internal details of the filesystem in question, so we need to encode specific knowledge of btrfs in mountd. This is unfortunate. To ensure smooth handling of this and possible future changes in uuid generation, we add infrastructure for multiple different uuids to be recognised on old filehandles, but only the preferred on is used on new filehandles. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Mountd listens on 2 different versions for NFSv2 (MOUNTv1 and MOUNTv2)NeilBrown2010-05-241-6/+8
| | | | | | | | | | | | | | | | | | | | | and one for NFSv3 (MOUNTv3) When --no-nfs-version requests an NFS version to be disabled, the code actually disabled the MOUNT version. This works is several cases, but requires --no-nfs-version 1 to completely disable NFSv2, which is wrong. So if we do disable 1, 2, and 3. mountd complain and won't run, it is not possible to run just v4 - i.e. not listening for MOUNT requests at all (as v4 doesn't need them). So change the handling of "--no-nfs-version 2" it disable MOUNTv1 as well as MOUNTv2, and allow mountd to continue running as long as one of NFSv2 NFSv3 NFSv4 is enabled. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd/exportfs: Make m_addrlist field a nfs_sockaddrChuck Lever2010-05-052-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | To store non-AF_INET addresses in the nfs_client structure, we need to use more than in_addr for the m_addrlist field. Make m_addrlist larger, then add a few helper functions to handle type casting and array indexing cleanly. We could treat the nfs_client address list as if all the addresses in the list were the same family. This might work for MCL_SUBNETWORK type nfs_clients. However, during the transition to IPv6, most hosts will have at least one IPv4 and one IPv6 address. For MCL_FQDN, I think we need to have the ability to store addresses from both families in one nfs_client. Additionally, IPv6 scope IDs are not part of struct sin6_addr. To support link-local IPv6 addresses and the like, a scope ID must be stored. Thus, each slot in the address list needs to be capable of storing an entire socket address, and not simply the network address part. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: trivial: name parameters for clarityJ. Bruce Fields2010-03-081-4/+4
| | | | | | | | | | Part of the reason for the previous bug was confusion between "subpath" and "path"; which is the shorter path, and which the longer? "child" and "parent" seem less ambiguous. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix path comparison for v4 crossmntJ. Bruce Fields2010-03-081-1/+1
| | | | | | | | This was obviously wrong, since path[strlen(path)] == '\0' should always be true. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix --manage-gids hang due to int/uint bugSteve Dickson2010-03-081-7/+7
| | | | | | | | | | | | | 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>
* nfs-utils: dont leak fd in mountlist_listBen Myers2010-02-121-1/+4
| | | | | | Don't leak this file descriptor if stat should fail. Signed-off-by: Steve Dickson <steved@redhat.com>
* tcpwrapper: Add support for IPv6Chuck Lever2010-01-171-4/+2
| | | | | | | | | | Assuming the tcp_wrappers library can actually support IPv6 addresses, here's a crack at IPv6 support in nfs-utils' TCP wrapper shim. Some reorganization is done to limit the number of times that @sap is converted to a presentation address string. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
* tcp_wrapper: Clean up logit()Chuck Lever2010-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Eliminate these compiler warnings: tcpwrapper.c: In function logit tcpwrapper.c:225: warning: unused parameter procnum tcpwrapper.c:225: warning: unused parameter prognum Actually, @procnum is not used anywhere in our tcpwrapper.c, so let's just get rid of it. Since there is only one logit() call site in tcpwrapper.c, the macro wrapper just adds needless clutter. Let's get rid of that too. Finally, both mountd and statd now use xlog(), which adds an appropriate program name prefix to every message. Replace the open-coded syslog(2) call with an xlog() call in order to consistently identify the RPC service reporting the intrusion. Since logit() no longer references "deny_severity" and no nfs-utils caller sets either allow_severity or deny_severity, we remove them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: better hiding of v4root exports from mountd clientsJ. Bruce Fields2010-01-131-0/+4
| | | | | | | | | | | | | We've hidden v4root exports from get_exportlist (hence from the showmount command), but not from other mountd operations--allowing clients to attempt to mount exports when they should be getting an immediate error. Symptoms observed on a linux client were that a mount that previously would have returned an error immediately now hung. This restores the previous behavior. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>