summaryrefslogtreecommitdiffstats
path: root/support
Commit message (Collapse)AuthorAgeFilesLines
* Cleaned up some warnings in the mount config file code.Steve Dickson2009-08-271-0/+1
| | | | 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>
* Now that only the Section names are case-insensitiveSteve Dickson2009-08-162-12/+10
| | | | | | | | | the mount code has to make sure the the mount options given to the kernel are in the correct case. Fixed a couple of warnings on #ifndefs Signed-off-by: Steve Dickson <steved@redhat.com>
* Added an conditional argument to the Section namesSteve Dickson2009-08-162-19/+97
| | | | | | | | | | | | | | with the format being: [ Section <"argument"> ] This will help group similar functioning Section together. The argument is conditional but must be surrounded by the '"' characters. The new conf_get_section() interface can used to locate a Section by its Section name and/or argument. Signed-off-by: Steve Dickson <steved@redhat.com>
* Make Section names case-insensitive which shouldSteve Dickson2009-08-161-0/+15
| | | | | | | help in locating them resulting in make the config files a bit less error prone Signed-off-by: Steve Dickson <steved@redhat.com>
* Taught conf_parse_line() to ignore spaces in theSteve Dickson2009-08-161-9/+26
| | | | | | '[section]' parsing and before the assignment statements Signed-off-by: Steve Dickson <steved@redhat.com>
* Move idmapd's configuration file parsing routines intoSteve Dickson2009-08-164-2/+920
| | | | | | | the shared libnfs.a library, making them available to\ other daemons and programs. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: clean up NFSCTL_* macros for handling protocol bitsJeff Layton2009-08-011-4/+11
| | | | | | | | | | They are a little hard to follow currently. Clean them up and add new macros that can set these bits in addition to the ones that unset them. Also add a new macro that reports when any valid protocol bit is set. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: move nfssvc.c to nfsd dir and clean up linking of nfsdJeff Layton2009-08-013-189/+1
| | | | | | | | | | rpc.nfsd is the only user of nfssvc.c, so we might as well move it out of libnfs.a. Also, don't link in libexport.a and libmisc.a, they aren't needed. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* errno not be set on RPC errorsSteve Dickson2009-07-151-1/+5
| | | | | | | | | | | | Changed both nfs_advise_umount() and nfs_gp_ping() to set the errno by calling CLNT_GETERR() after a CLNT_CALL() error. Also added code to rpc_strerror() that will log the errno value, when set, via strerror(). These changes added essential information to the error message making it much easier to detect errorsuch as "Connection refused" Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Introduce sockaddr helpers to get and set IP port numbersChuck Lever2009-07-143-39/+58
| | | | | | | | | | Introduce address family-agnostic functions that get and set IP port numbers in socket addresses. We can already replace a few similar functions in the mount command, and a few more will come up with statd and sm-notify. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Convert TCP connection refused to RPC_CANTRECVChuck Lever2009-07-141-0/+3
| | | | | | | | | | | | | In a similar vein to the timeout logic we just restored, a refused TCP connection should be mapped to an equivalent UDP error code: RPC_CANTRECV. This is new behavior for TCP connections; the legacy mount command appears to have simply failed immediately if a TCP connection was refused during an rpcbind query. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Restore historical TCP connect timeout error codeChuck Lever2009-07-141-2/+24
| | | | | | | | | | | | | | | | | The latest versions of mount.nfs appear not to fall back to UDP if TCP isn't available on the server. Our new nfs_getport() implementation is missing a bit of logic from the original mount getport() implementation. Without it, nfs_probe_port() sees a TCP connect timeout as a permanent error, so it fails immediately instead of attempting to try again with UDP. Similar changes for our new ping API (see the old clnt_ping() function, which is still in utils/mount/network.c). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Clear shared error fields before trying rpcbind queriesChuck Lever2009-07-143-0/+31
| | | | | | | | | Some RPC errors set fields in rpc_createerr.cf_error in addition to cf_stat. Be sure to clear _all_ error fields in rpc_createerr each time through the rpcbind API. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: RPC_PROGNOTREGISTERED is a permanent errorChuck Lever2009-07-141-1/+1
| | | | | | | | | | | | | | | rpcbind returns RPC_PROGNOTREGISTERED if it knows for certain that an RPC program is not supported for a given transport. This is a permanent and authoritative error, so the library's rpcbind query API should never retry the query -- it will only get the same answer. A similar change was submitted for libtirpc. Unlike rpcb_getaddr(3t), mount.nfs's rpcbind client only retries once (with RPCB3PROC_GETADDR), but an extra TCP socket in this case would leave another port in TIME_WAIT. It's infrequent enough, but might as well get rid of it. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Set proper retransmit timeout for datagram transportsChuck Lever2009-07-141-1/+3
| | | | | | | | | Instead of setting the total timeout and the retransmit timeout to the same value for datagram transports, use a 1 second retransmit timeout, so we actually get a retransmit or two before failing. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Don't return RPC_UNKNOWNHOST from rpc_socket.cChuck Lever2009-07-141-2/+2
| | | | | | | | | | RPC_UNKNOWNHOST means a hostname isn't known -- basically it's EAI_NONAME from getaddrinfo(3). Since the functions in rpc_socket.c don't take a hostname argument, RPC_UNKNOWNHOST is not an appropriate return code from these functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Use HAVE_LIBTIRPC to switch in bindresvport_sa(3t)Chuck Lever2009-07-141-3/+3
| | | | | | | | | | | commit 383a026d99624c88c0e802103ef4c4865db8eb71, which fixed an earlier commit, is still not quite correct. bindresvport_sa(3t) is available whenever libtirpc is linked. There's no need to use IPV6_SUPPORTED here. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Remove unneeded @salen argumentsChuck Lever2009-07-142-28/+18
| | | | | | | | Clean up: Now that getnameinfo(3) is no longer used, the @salen argument to nfs_sockaddr2universal() is no longer needed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: replace getnameinfo(NI_NUMERICHOST) with inet_ntop(3)Chuck Lever2009-07-141-47/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getnameinfo(3) with the NI_NUMERICHOST flag is used in support/nfs/getport.c to convert socket addresses to universal address strings. Older versions of glibc do not have getnameinfo(3), however. In order for nfs-utils to build on older systems we switch in legacy code via HAVE_GETNAMEINFO and use inet_ntoa(3). A problem with this is that we have to double our test matrix to be sure that both versions of these routines build and operate correctly. Another minor problem is that inet_ntoa(3) is officially deprecated. So let's always use a single implementation based on inet_ntop(3). Universal address strings do not support link-local / scope IDs, so we don't lose any functionality by using inet_ntop(3) here. This means we open code a bit of logic that is available in most modern versions of glibc, but in return we can use exactly the same code for all builds (on systems with getnameinfo(3) and without). An additional benefit is we can avoid using NI_MAXHOST for character buffers that live on the stack: it's 1025 bytes. Instead, INET6_ADDRSTRLEN is used, which is just 46 bytes, plus an additional eight bytes for the port information. We add beefier buffer overflow detection logic as well. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Remove AI_ADDRCONFIG from nfs_gp_loopback_address()Chuck Lever2009-07-141-44/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | AI_ADDRCONFIG was used ostensibly to figure out if the local system had IPv6 available when generating a loopback address. A legacy version of nfs_gp_loopback_address() was created to handle ANYADDR address generation for old versions of glibc where AI_ADDRCONFIG doesn't exist. This means we have to be careful to test both the normal and legacy versions when committing changes in this area. But it turns out that even contemporary versions of glibc ignore AI_ADDRCONFIG when the hostname string is NULL. getaddrinfo(3) always returns an AF_INET and an AF_INET6 loopback address in this case, no matter how the system is configured. Change nfs_gp_loopback_address() to have one version that simply looks up "localhost" instead of doing anything fancy. If "localhost" is an IPv6 address, we'll use that. Otherwise, it should nearly always be an AF_INET loopback address. This eliminates the need for AI_ADDRCONFIG, and removes the duplicate version of nfs_gp_loopback_address(). Note that callers never used the port number in the returned socket address, so get rid of the "sunrpc" service string too. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: RPCB_GETADDR's r_addr should contain rpcbind port, not zeroChuck Lever2009-07-141-14/+23
| | | | | | | | | | | Similar to a change made to the kernel's rpcbind client. See kernel commit 143b6c4008a7928de7e139c3a77a90e4cad8db2c. The r_addr argument of RPCB_GETADDR procedures contains the rpcbind server's address and port number. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: RPCB_GETADDR r_owner should be an empty stringChuck Lever2009-07-141-5/+1
| | | | | | | | | | | Some servers reject RPCB_GETADDR requests with a non-empty r_owner field. "RPC: Server can't decode arguments" An empty string is already used by libtirpc and the kernel for RPCB_GETADDR requests. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The closeall function is broken in such a way that it almost neverSteve Dickson2009-06-221-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | closes any file descriptors. It's calling strtol on the text representation of the file descriptor, and then checking to see if the value of *endptr is not '\0' before trying to close the file. This check is wrong. When strtol returns an endptr that points to a NULL byte, that indicates that the conversion was completely successful. I believe this check should instead be requiring that endptr is pointing to '\0' before closing the fd. Also, fix up the function to check for conversion errors from strtol. If one occurs, just skip the close on that entry. Finally, as Trond pointed out, it's unlikely that readdir will return a blank string in d_name but that situation wouldn't be detected by the current code. This patch adds such a check and skips the close if it occurs. Reported-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Replace the Sun RPC license with the BSD license,Tom spot Callaway2009-06-022-50/+46
| | | | | | | with the explicit permission of Sun Microsystems Signed-off-by: Tom "spot" Callaway <tcallawa@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Fix IPv6 support in support/nfs/rpc_socket.cChuck Lever2009-05-181-7/+5
| | | | | | | | | | | Use the correct #ifdef variable to enable IPv6 support for privileged RPC clients. Without this fix, unmounting an IPv6 NFSv2/v3 server fails. Introduced by commit 8c94296bc84f3a204f2061c0391a1d2350e4f37e. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* utils/nfsd: add support for minorvers4Benny Halevy2009-05-043-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | minorvers4 can be used to either enable or disable nfsv4.x. If minorvers4 is a positive integer n, in the allowed range (only minorversion 1 is supported for now), the string "+4.n" is appended to the versions string written onto /proc/fs/nfsd/versions. Correspondingly, if minorver4 is a negative integer -n, the string "-4.n" is written. With the default value, minorvers4==0, the minor version setting is not changed. Note that unlike the protocol versions 2, 3, or 4. The minor version setting controls the *maximum* minor version nfsd supports. Particular minor version cannot be controlled on their own. With only minor version 1 supported at the moment the difference doesn't matter, but for future minor versions greater than 1, enabling minor version X will enable support for all minor versions 1 through X. Disabling minor version X will disable support for minor versions X and up, enabling 1 through X-1. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Host aliases need to be checked when netgroups is used in exports.Steve Dickson2009-04-291-1/+7
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Provide an API for creating a privileged RPC clientChuck Lever2009-04-182-8/+143
| | | | | | | | | | | | | | We needed to guarantee that some RPC programs, such as PMAP, got an unprivileged port, to prevent exhausting the local privileged port space sending RPC requests that don't need such privileges. nfs_get_rpcclient() provides that feature. However, some RPC programs, such as MNT and UMNT, require a privileged port. So, let's provide an additional API for this that also supports IPv6 and setting a destination port. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport.c: fix non-standard CChuck Lever2009-04-151-2/+2
| | | | | | | | | Squelch a compiler warning in getport.c: getport.c:65: warning: ¿static¿ is not at beginning of declaration Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* cacheio: return any original error from qword_eolKevin Coffman2009-04-031-2/+8
| | | | | | | | | If the initial fflush() fails in qword_eol, log the failure and return the indication of the original failure, not the successful cover-up. Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Mountd should use separate lockfilesBen Myers2009-04-034-17/+30
| | | | | | | | | | | | | | | | Mountd keeps file descriptors used for locks separate from those used for io and seems to assume that the lock will only be released on close of the file descriptor that was used with fcntl. Actually the lock is released when any file descriptor for that file is closed. When setexportent() is called after xflock() he closes and reopens the io file descriptor and defeats the lock. This patch fixes that by using a separate file for locking, cleaning them up when finished. Signed-off-by: Ben Myers <bpm@sgi.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* In recent Fedora builds, the '-D _FORTIFY_SOURCE=2' compileSteve Dickson2009-03-231-3/+13
| | | | | | | | flag has been set. This cause warnings to be generated when return values from reads/writes (and other calls) are not checked. The patch address those warnings. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Include legacy or TI-RPC headers, not bothChuck Lever2009-03-162-45/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Data type incompatibilities between the legacy RPC headers and the TI-RPC headers mean we can't use libtirpc with code that was compiled against the legacy RPC headers. The definition of rpcprog_t for example is "unsigned long" in the legacy library, but it's "uint32_t" for TI-RPC. On 32-bit systems, these types happen to have the same width, but on 64-bit systems they don't, making more complex data structures that use these types in fields ABI incompatible. Adopt a new strategy to deal with this issue. When --enable-tirpc is set, append "-I/usr/include/tirpc" to the compilation steps. This should cause the compiler to grab the tirpc/ headers instead of the legacy headers. Now, for TI-RPC builds, the TI-RPC legacy functions and the TI-RPC headers will be used. On legacy systems, the legacy headers and legacy glibc RPC implementation will be used. A new ./configure option is introduced to allow system integrators to use TI-RPC headers in some other location than /usr/include/tirpc. /usr/include/tirpc remains the default setting for this new option. The gssd implementation presents a few challenges, but it turns out the gssglue library is similar to the auth_gss pieces of TI-RPC. To avoid similar header incompatibility issues, gssd now uses libtirpc instead of libgssglue if --enable-tirpc is specified. There may be other issues to tackle with gssd, but for now, we just make sure it builds with --enable-tirpc. Note also: svc_getcaller() is a macro in both cases that points to a sockaddr field in the svc_req structure. The legacy version points to a sockaddr_in type field, but the TI-RPC version points to a sockaddr_in6 type field. rpc.mountd unconditionally casts the result of svc_getcaller() to a sockaddr_in *. This should be OK for TI-RPC as well, since rpc.mountd still uses legacy RPC calls (provided by glibc, or emulated by TI-RPC) to set up its listeners, and therefore rpc.mountd callers will always be from AF_INET addresses for now. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: replace function-specific switches with HAVE_LIBTIRPCChuck Lever2009-03-162-43/+43
| | | | | | | | | | | | | Instead of switching in TI-RPC-specific logic with a function-specific switch like HAVE_CLNT_VG_CREATE, let's use the more generic HAVE_LIBTIRPC macro everywhere. This simplifies ./configure (always a good thing), and makes it more clear in the source code exactly what the extra conditionally compiled code is for. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Added back the some logging variables which are noSteve Dickson2009-03-081-1/+9
| | | | | | | | | longer used but, unfortunately, they are extern-ed by public headers files which are not under the control of this package. Spotted-by: Juergen Daubert <jue@jue.li> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Provide type-checked version of svc_getcaller()Chuck Lever2009-03-051-0/+9
| | | | | | | | | | | | | TI-RPC's version of the svc_getcaller() macro points to a sockaddr_in6, not a sockaddr_in, though for AF_INET callers, an AF_INET address resides there. To squelch compiler warnings when the TI-RPC version of the svc_req structure is used, add inline helpers with appropriate type casting. Note that tcp_wrappers support only AF_INET addresses for now. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Replace getservbyname(3)Chuck Lever2009-03-053-94/+63
| | | | | | | | | The getservbyname(3) function is not re-entrant, and anyway, the man page says it is obsolete. Replace it with a call to getaddrinfo(3). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Have sizeof using the correct value in nfs_getlocalport()Ben Greear2009-03-041-1/+1
| | | | | Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Remove fprintf() call from support/nfs/getport.cChuck Lever2009-03-041-3/+0
| | | | | | | | getport.c is effectively a library, so it should not be emitting messages via printf. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* General clean up. Removed unused routines. Reworked syslogSteve Dickson2009-03-041-130/+5
| | | | | | | | message to (hopefully) make it more sensible. Move "#ifdef HAVE_LIBWRAP" around so nothing will be defined when tcp wrapper is not configured. Signed-off-by: Steve Dickson <steved@redhat.com>
* Converted good_client() to correctly use the tcp wrapperSteve Dickson2009-03-041-50/+7
| | | | | | | interface and added a note to the mountd man page saying hostnames will be ignored when they can not be looked up. Signed-off-by: Steve Dickson <steved@redhat.com>
* Only hash on IP address and Program number. Including the ProcedureSteve Dickson2009-03-041-12/+11
| | | | | | number only creates needles extra hash entries. Signed-off-by: Steve Dickson <steved@redhat.com>
* Exportfs and rpc.mountd optimalizationTomas Richter2009-02-184-31/+104
| | | | | | | | | | | | | | | | | | | | | | | | There were some problems with exportfs and rpc.mountd for long export lists - see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76643 I do optimalization as my bachelors thesis (Facuulty of informatics, Masaryk's university Brno, Czech Republic), under lead of Yenya Kasprzak. Both exportfs and rpc.mount build linked list of exports (shared functions in export.c). Every time they are inserting new export into list, they search for same export in list. I replaced linked list by hash table and functions export_add and export_lookup by functions hash_export_add and hash_export_lookup (export.c). Because some other functions required exportlist as linked list, hash table has some implementation modification im comparison with ordinary hash table. It also keeps exports in linked list and has pointer to head of the list. So there's no need of implementation function <for_all_in_hash_table>. Signed-off-by: Tomas Richter <krik3t@gmail.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>
* 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>