summaryrefslogtreecommitdiffstats
path: root/support
Commit message (Collapse)AuthorAgeFilesLines
...
* libexport: Fix IP address check in check_netgroup()Chuck Lever2010-08-241-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | Neil Brown reports that recent changes to replace gethostby{addr,name}(3) with get{addr,info}name(3) may have inadvertently broken netgroup support. There used to be a gethostbyaddr(3) call in the third paragraph in check_netgroup(). The reason for that gethostbyaddr(3) call was that the first innetgr(3) call has already confirmed that hname is not a member of the netgroup. We also need to confirm that, if hname happens to be an IP address, the hostname bound to that IP address is not a member of the netgroup, either. Fix this by restoring appropriate address to hostname mapping of hname before retrying the innetgr(3) call. See http://marc.info/?l=linux-nfs&m=128084830214653&w=2 . Introduced by commit 0509d3428f523776ddd9d6e9fa318587d3ec7d84. Reviewed-by: Neil Brown <neilb@suse.de> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* bexport: Add a common exit label to check_netgroup()Chuck Lever2010-08-241-7/+16
| | | | | | | | | | check_netgroup() is going to be changed to free dynamically allocated resources before it returns, so a common exit point is needed. Reviewed-by: Neil Brown <neilb@suse.de> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove warnings from nfsctl.cSteve Dickson2010-08-091-1/+1
| | | | | | | nfsctl.c: In function 'expsetup': nfsctl.c:112: warning: signed and unsigned type in conditional expression Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from network.cSteve Dickson2010-08-091-0/+3
| | | | | | | network.c: In function 'nfs_verify_family': network.c:1366: warning: unused parameter 'family' Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from cache.cSteve Dickson2010-08-091-1/+1
| | | | | | | | | | | | | | | | | | 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 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-093-5/+5
| | | | | | | 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>
* nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller()Chuck Lever2010-07-191-2/+2
| | | | | | | | | | | | | | | Squelch compiler warnings reported with -Wextra: In file included from statd.c:24: ../../support/include/rpcmisc.h: In function nfs_getrpccaller_in: ../../support/include/rpcmisc.h:58: warning: dereferencing type-punned pointer might break strict-aliasing rules ../../support/include/rpcmisc.h: In function nfs_getrpccaller: ../../support/include/rpcmisc.h:63: warning: dereferencing type-punned pointer might break strict-aliasing rules Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Remove unused hostent-based DNS helper functionsChuck Lever2010-06-222-310/+16
| | | | | | | | | | | Clean up: Get rid of hostent-based DNS helper functions in libexport.a that have been replaced by addrinfo-based DNS helpers. None of the original code remains, so replace the copyright notice as well. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Replace matchhostname()Chuck Lever2010-06-221-2/+0
| | | | | | | | | | | | | | | | | So that exportfs can eventually support IPv6 addresses, copy statd's getaddrinfo(3)-based matchhostname to exportfs, with adjustments for dealing with export wildcards and netgroups. Until exportfs has full IPv6 support, however, we want to ensure that IPv6 addresses continue to remain blocked in the address comparison code used by exportfs. At a later point we'll replace much of this with the generic functions in sockaddr.h. Since it contains special logic for handling wildcard and netgroups, this function is specialized for exportfs, and does not belong in one of the shared libraries. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add documenting commentsChuck Lever2010-06-222-9/+39
| | | | | | | | Clean up. Add a few additional documenting comments for globally visible functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Make export_add() staticChuck Lever2010-06-222-5/+2
| | | | | | | | Clean up: export_add() is not called from outside of export.c, so make it a static helper. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Make export_read() return voidChuck Lever2010-06-222-3/+7
| | | | | | | | Clean up: export_read()'s return value is always zero, and its only caller never checks it. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Replace "struct hostent" with "struct addrinfo"Chuck Lever2010-06-224-138/+181
| | | | | | | | | | | | | | | | | | | 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-223-1/+365
| | | | | | | | | | | | | | | 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>
* 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>
* libexport.a: Refactor rmtab_read()Chuck Lever2010-05-241-23/+41
| | | | | | | | Clean up: Make it easier to add IPv6 support by refactoring part of rmtab_read() into a helper function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd/exportfs: Make m_addrlist field a nfs_sockaddrChuck Lever2010-05-053-15/+90
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* libexport.a: Clean up client_add()Chuck Lever2010-05-052-15/+12
| | | | | | | | | | | Clean up: client_add()'s current callers never set unknown m_type values, so the m_type check is unnecessary. All of client_add()'s callers are in the same source file where it is defined, so make it a static helper function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor client_init()Chuck Lever2010-05-051-43/+56
| | | | | | | | | | Clean up: Move subnet hostname parsing logic out of client_init() to make it simpler to introduce IPv6 support. Make client_init() a helper, since it's already static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Make capabilities support optionalMike Frysinger2010-04-231-0/+4
| | | | | | | | | | The new code using libcap is quite minor, so rather than always reqiure libcap support, make it a normal --enable type flag. Current default behavior is retained -- if libcap is found, it is enabled, else it is disabled like every nfs-utils version in the past. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Allow malloc(3) failures in client_lookup() and friendsChuck Lever2010-04-231-6/+9
| | | | | | | | | | | | | Clean up: Use malloc(3) instead of xmalloc() in client_lookup() and client_dup(), ensuring that a failed memory allocation here doesn't cause our process to exit suddenly. Allocation of nfs_client records and the m_hostname string are now consistently handled with malloc(3), calloc(3), strdup(3), and free(3). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Allow m_hostname allocation to fail instead of exitChuck Lever2010-04-231-6/+4
| | | | | | | | | | | | Clean up: Replace xstrdup() with strdup(3) in client_init(), to prevent the process from exiting if the memory allocation fails. Note that both of client_init()'s callers set m_hostname equal to NULL before calling, thus the extra free(3) at the top of client_init() is unneeded. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Allow client_init() to fail instead of exitChuck Lever2010-04-231-7/+17
| | | | | | | | | client_init()'s current callers can now deal correctly with a failure. Get rid of code that can cause our process to exit in client_init(), if address mask parsing or memory allocation fails. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add client_free()Chuck Lever2010-04-231-2/+8
| | | | | | | Clean up: Introduce a helper to free a nfs_client record. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: export_find() should handle address parsing errorsChuck Lever2010-04-161-0/+4
| | | | | | | | | | | | | | | An address mask parsing error can cause client_init(), and therefore client_dup(), to make our process exit suddenly. Soon we want to add more complex address parsing in client_init(), so we need this interface to be a little more robust. Since export_find() can return NULL in some cases, it can handle NULL returns from its subroutines if an address parsing error occurs, or if memory is exhausted. Allow for client_dup() to return NULL instead of exiting sideways. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add export_free()Chuck Lever2010-04-161-10/+17
| | | | | | | Clean up: Introduce a helper to free an nfs_export record. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add helper for populating m_addrlist[]Chuck Lever2010-04-151-18/+20
| | | | | | | | | Clean up: Move common code that populates an nfs_client record's m_addrlist to a helper function. This eliminates a little code duplication, and makes it simpler to add IPv6 support later. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Reduce code duplication in client_init()Chuck Lever2010-04-151-4/+5
| | | | | | | | | Clean up: Most cases in client_init() set clp->m_naddr to zero. Move it to the common part of the function, and simplify the logic. This will make adding IPv6 support here more straightforward. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: replace xlog(L_FATAL) in client_check()Chuck Lever2010-04-081-4/+9
| | | | | | | | | | | Clean up: Prevent the process from exiting in client_check(). Report bad m_type values, but return 0. This removes another site where a mountd or exportfs process can exit sideways. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor wildcard checking in client_check()Chuck Lever2010-04-081-12/+26
| | | | | | | | | | Clean up: refactor wildcard logic out of client_check() to make it easier to introduce IPv6 support. Match the style used for client_check_{fqdn,subnetwork,netgroup}. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor netgroup checking in client_check()Chuck Lever2010-04-081-40/+57
| | | | | | | | | | | | | | | | | | Clean up: refactor netgroup logic out of client_check() to make it easier to introduce IPv6 support. + Use preferred style of keeping #ifdef out of the middle of function definitions. Squelch compiler warnings for "#ifndef HAVE_INNETGR" by using __attribute__((unused)). + Use preferred style of not using curly braces around switch cases. + Match style used for check_{fqdn,subnetwork}. + Clarify comment documenting use of h_aliases Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Remove unused function client_checkaddr()Chuck Lever2010-04-081-7/+0
| | | | | | | Clean up. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Factor SUBNETWORK checking out of check_client()Chuck Lever2010-04-081-10/+22
| | | | | | | | | | | | | | | | | | | | Clean up: Factor the MCL_SUBNETWORK case out of check_client() and client_checkaddr(). This will make it easier to add IPv6 support eventually. The logic in the new helper function will get a little more tangled once IPv6 support is introduced. Each slot in the clp address list eventually may contain an address from either address family. Note that the switch statement in client_checkaddr() is redundant, since clp->cl_mtype is loop invariant. This change makes SUBNETWORK client checking more computationally efficient, at the cost of a few extra lines of code. This commit should not change code behavior in any way. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Factor FQDN checking out of check_client()Chuck Lever2010-04-081-8/+23
| | | | | | | | | | | | | | | | | | | | Clean up: Factor the MCL_FQDN case out of check_client() and client_checkaddr(). This will make it easier to add IPv6 support eventually. The logic in the new helper function will get a little more tangled once IPv6 support is introduced. Each slot in the clp address list eventually may contain an address from either address family. Note that the switch statement in client_checkaddr() is redundant, since clp->cl_mtype is loop invariant. This change makes FQDN client checking more computationally efficient, at the cost of a few extra lines of code. This commit should not change code behavior in any way. 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-082-1/+3
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: e_fslocdata should be freed with free(3)Chuck Lever2010-03-221-1/+1
| | | | | | | | Clean up: Since e_fslocdata is allocated with strdup(3), and not xstrdup(), it should be freed with free(3), and not xfree(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Fix whitespace damage in support/export/export.cChuck Lever2010-03-221-5/+6
| | | | | | | Clean up whitespace damage introduced by commit 4cacc965. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Clean up client_compose() and client_member()Chuck Lever2010-03-222-17/+29
| | | | | | | | Clean up: Replace outdated comments, and fix some function declarations. Use proper type for a couple of automatic variables. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Remove dead codeChuck Lever2010-03-222-24/+0
| | | | | | | | Clean up: I can't find any call sites for client_find() or client_match(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> 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-012-0/+24
| | | | | | | | | | | | | | | | | | 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>
* nfsd: Disble NFS 4.1 functionality by defaultSteve Dickson2010-02-171-0/+6
| | | | | | | | | | | | Due to the fact the current kernel code do not completely conform to the NFS 4.1 RFC, this patch disable the 4.1 support on the server. To control this 41 functionality, the NFS41_SUPPORTED configuration variable now exist that will allow us to re enable the functionality without any code changes. 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>
* Teach nfs_compare_sockaddr() to handle NULL arguments.Steve Dickson2010-01-251-0/+4
| | | | | Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>