summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* idmapd: allow non-ASCII characters (UTF-8) in NFSv4 domain nameSuresh Jayaraman2012-12-171-23/+5
| | | | | | | | | | | | | | | | | | | | | | The validateascii() check in imconv() maps NFSv4 domain names with non-ASCII characters to 'nobody'. In setups where Active directory or LDAP is used this causes names with UTF-8 characters to being mapped to 'nobody' because of this check. As Bruce Fields puts it: "idmapd doesn't seem like the right place to enforce restrictions on names. Once the system has allowed a name it's too late to be complaining about it here." Replace the validateascii() call in imconv() with a check for null-termination just to be extra-careful and remove the validateascii() function itself as the only user of that function is being removed by this patch. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix is_subdirectory to understand '/'NeilBrown2012-12-171-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | The is_subdirectory() function checks if a given 'child' is a subdirectory of the given 'parent'. However it always fails if 'parent' == "/" (because 'child' doesn't begin with 'parent' followed by "/"). So change is_subdirectory() to special-case "/". subexport() also tests if one directory is a subdirectory of the other, and contains the same bug. So change it to use is_subdirectory(). Finally, move is_subdirectory() and related path_matches() and export_matches() earlier in the file to avoid a forward-reference. This patch fixes a bug wherein if you export "/" with 'crossmnt', the crossmnt flag is ineffective and you can only access the root filesystem, not any descendants. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix checking for errors when exporting filesystemsNeilBrown2012-12-171-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | commit 5604b35a61e22930873ffc4e9971002f578e7978 nfs-utils: Increase the stdio file buffer size for procfs files changed writes to some sysfs files to be line buffered (_IOLBF) where they weren't before. While this probably makes sense, it introduced a bug. With fully buffered streams, you don't expect to get an error until you call fflush(). With line buffered streams you can get the error from fprintf() et al. qword_eol() only tests the return from fflush(), not from fprintf(). Consequently errors were not noticed. One result of this is that if you export, with crossmnt, a filesystem underneath which are mounted non-exportable filesystems (e.g. /proc) then an 'ls -l' on the client will block indefinitely waiting for a meaningful 'yes' or 'no' from the server, but will never get one. This patch changes qword_eol to test both fprintf and fflush. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Report the absolute path used to load the junction plug-inChuck Lever2012-12-121-0/+7
| | | | | | | | | | | | | | | | | | As a debugging feature, report the absolute pathname of the plug-in library that mountd loads to resolve junctions. Since mountd passes a relative path to dlopen(3), dlopen(3) must search for the right library. Displaying the absolute pathname of the object that it found verifies that mountd loaded the correct plug-in. Note: dlinfo(3) is provided by libdl, but there doesn't seem to be a man page on Fedora 16 for dlinfo(3). Instead, see: http://www.unix.com/man-page/all/3/dlinfo/ Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: xtab.c no longer needs #include xmalloc.hChuck Lever2012-12-121-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: rmtab.c no longer needs #include xmalloc.hChuck Lever2012-12-121-3/+3
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: cache.c no longer needs #include xmalloc.hChuck Lever2012-12-121-1/+0
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: auth.c no longer needs #include xmalloc.hChuck Lever2012-12-121-1/+2
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: base the size of the fd array on the RLIMIT_NOFILE limit.NeilBrown2012-11-281-0/+5
| | | | | | | | | | | We have previously raised the size of the 'pollarray' once (32 -> 256) and I have had another request to make it bigger. Rather than changing the hard-coded value, make it depend on RLIMIT_NOFILE. This is an upper limit on the size of the array that can be passed to poll() anyway. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd_proc: remove pointless test against FD_ALLOC_BLOCK in process_pipedirNeilBrown2012-11-281-3/+2
| | | | | | | | I can see no possible point for this test against FD_ALLOC_BLOCK, so just remove the test. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd_proc: use pollsize, not FD_ALLOC_BLOCK, in get_poll_index()NeilBrown2012-11-281-2/+2
| | | | | | | | | | | | get_poll_index wants to walk the entire "pollarray", but uses the constant FD_ALLOC_BLOCK, rather than the variable pollsize (which has the same value). If we want to make the size of the array variable, it is best not to use the constant. As pollsize is 'unsigned long', 'i' should be too. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Handle the target name correctlyTrond Myklebust2012-11-283-14/+18
| | | | | | | | | | | | | | | | | | | The target name contains a hostname in the realm that we are authenticating to. Since we may be authenticating to a different realm than the default realm for the server, we should not assume that the target name and host name point to the same string. In fact, the kernel NFS client will always use its own hostname as the target name, since it is always authenticating to its own default realm. On the other hand, the NFS server's callback channel will pass the hostname of the NFS client that it is authenticating too (Section 3.4, RFC3530). This patch fixes the handling of the target name in process_krb5_upcall, and ensures that it gets passed to find_keytab_entry(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Remove insane sanity checks of the service nameTrond Myklebust2012-11-281-12/+1
| | | | | | | | | | | | | | | Either we trust the info file, or we don't. The current 'checks' only work for the combination 'nfs', '100003' and a version number between 2 and 4. The problem is that the callback channel also wants to use 'nfs' in combination with a different program number and version number. This patch throws the bogus checks out altogether and lets the kernel use whatever combination it wants.... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: skip "." and ".." when trying to clean out legacy recdirJeff Layton2012-11-281-0/+11
| | | | | | | | readdir picks up these two entries as "normal" dentries, but rmdir'ing them won't work (and we wouldn't want to remove them anyway). Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: error message clean up.Steve Dickson2012-11-281-1/+1
| | | | | | Remove a unnecessary newline in an error message. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Continue to trying address when the server return EACCESSteve Dickson2012-11-281-0/+2
| | | | | | | | | | | | | | | | | | With recent changes to the /etc/hosts file, the 'localhost' host name is now multiply defined as both an IPv4 address (127.0.01) and an IPv6 address (::1). This causes first address returned by getaddrinfo('localhost') to be the IPv6 address instead of the IPv4 address. The change in the default 'localhost' address type causes existing exports using '127.0.0.1' to fail, because the '::1' address is tried first and fails. The problem is not all the addresses in the address list are being tried. So this patch allows that address list to continue to be process when a 'EACCES' error is returned by the server. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: auth_unix_ip should downcall on error to prevent hangsJ. Bruce Fields2012-11-281-7/+4
| | | | | | | | | | | | Since bf6a4febaa78bf188896b7b5b02c46562dd08b70 "mountd: handle allocation failures in auth_unix_ip upcall", a failure to map the address of an incoming client to a name could result in a hang. We should be responding with an error in the case, not just skipping the downcall and leaving everybody hanging. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* svcgssd: Encryption types not being parsed correctlySteve Dickson2012-11-191-0/+7
| | | | | | | | When svcgssd reads the supported encrytion types from the kernel, they are prefixed with a 'enctypes='. That prefix has to be ignored to correctly parse the rest of the types. Signed-off-by: Steve Dickson <steved@redhat.com>
* Release 1.2.7Steve Dickson2012-11-112-1528/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* configure.ac: When v4 is disable v4.1 should also be disabled.Steve Dickson2012-11-111-1/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* configure.ac: Disabling v4 should not break the gssd buildSteve Dickson2012-11-111-5/+5
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: Ensure the build is diabled when NFS v4 is disabledJeff Layton2012-11-111-0/+2
| | | | | | | | When '--disable-nfsv4' is in the configure options, then the building of nfsdcltrack need to be disabled as well. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: update the README about server startup orderJeff Layton2012-11-111-21/+2
| | | | | | | Now that nfsdcld is gone, remove the section about starting it up. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: remove the nfsdcld daemonJeff Layton2012-11-114-797/+2
| | | | | | | | | Since we want to move to using the usermodehelper upcall unconditionally, just remove nfsdcld. The kernel code to handle this will be formally deprecated in 3.10 as well. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: add a manpage for nfsdcltrackJeff Layton2012-11-112-1/+212
| | | | | Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: add a legacy transition mechanismJeff Layton2012-11-111-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | If the kernel passes the legacy recdir path in the environment, then we can use that to transition from the old legacy tracker to the new one. On a "check" operation, if there is no record of the client in the database, check to see if there is a matching recoverydir. If there isn't then just refuse the reclaim. If there is, then insert a new record for this client into the db, and remove the legacy recoverydir. If either of those operations fail, then refuse the reclaim. On a "gracedone" operation, clean out the entire legacy recoverydir after purging any unreclaimed records from the db. There's not much we can do if this fails, so just log a warning if it does. Note that this is a one-way conversion. If the user later boots back into an older kernel, it will have no knowledge of the new database. In principle, we could create a tool that would walk the clients table, md5 hash the clientids and create directories in the v4recovery dir. Doing that automatically would be pretty difficult however. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: add a new "one-shot" program for manipulating the client ↵Jeff Layton2012-11-114-3/+441
| | | | | | | | | | | | | | | | | | | tracking db Usermode helper upcalls are all the rage these days for infrequent upcalls, since they make it rather idiot-proof. No running daemon is required, so there's really no setup beyond ensuring that the callout exists and is runnable. This program adds a callout program to nfs-utils for that purpose. The storage engine on the backend is identical to the one used by nfsdcld. This just adds a new frontend for it. For now, building with --enable-nfsdcltrack gives you both nfsdcld and nfsdcltrack programs. A later patch will remove nfsdcld altogether. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: break out a function to open the database handleJeff Layton2012-11-112-15/+35
| | | | | | | | | | | | | When we add a new usermodehelper upcall program to do the database access, the existing "init" function will be overkill every time we start up the program. Break out the database handle establishment routine into a separate function that we can call from each upcall command in the one-shot program. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: remove pointless sqlite_topdir variableJeff Layton2012-11-113-10/+5
| | | | | | | | | This is holdover from an earlier version of the code and doesn't really provide any benefit. Also, mark the topdir and dirname arguments const since they should never be changed. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: rename the nfsdcld directory and options to nfsdcltrackJeff Layton2012-11-118-12/+12
| | | | | | | | | | | | | We'll soon be adding a new nfsdcltrack program, at which point it won't make much sense to call this directory and the config option "nfsdcld". Rename it to be a bit more generic. While we're at it, change the default for --enable-cltrack to "yes". When we introduce the one-shot program, we're going to want to build it by default anyway. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: fix segfault in sqlite debug loggingJeff Layton2012-11-111-1/+1
| | | | | | | One too few arguments... Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.gssd: Squelch compiler errorChuck Lever2012-10-301-1/+1
| | | | | | | | | gssd_proc.c: In function handle_krb5_upcall: gssd_proc.c:1117:2: warning: ISO C forbids return with expression, in function returning void [-pedantic] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.gssd: Squelch compiler warningChuck Lever2012-10-301-5/+6
| | | | | | | | gssd_proc.c: At top level: gssd_proc.c:782:5: warning: no previous prototype for create_auth_rpc_client [-Wmissing-prototypes] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.gssd: Squelch compiler warningChuck Lever2012-10-301-1/+1
| | | | | | | | | gss_util.c: At top level: gss_util.c:98:36: warning: ISO C does not allow extra ; outside of a function [-pedantic] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Avoid unnecessary type conversionsChuck Lever2012-10-301-2/+2
| | | | | | Fixed a number of -Wconversion warnings Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Avoid unnecessary type conversionsChuck Lever2012-10-301-1/+1
| | | | | | | Removed a Wsign-conversion warning Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Avoid unnecessary type conversionsChuck Lever2012-10-301-4/+4
| | | | | | | | | | | | | Clean up compiler warnings: cache.c: In function get_uuid: cache.c:249:2: warning: conversion to size_t from int may change the sign of the result [-Wsign-conversion] And the like. signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Make local functions staticChuck Lever2012-10-301-2/+4
| | | | | | | | | | | | | | | | | | | | | Removed a couple Wmissing-prototypes warnings in the mountd code. Once the parse_fsid() function was made static, the compiler detected execution paths through it that did not initialize some fields in *parsed. [ I'm pretty sure these problems are currently harmless, since each path is taken depending on the value of the .fsidtype field. Each path accesses only the fields in *parsed that it cares about. ] This is because parsed_fsid isn't a union type. parse_fsid() leaves uninitialized fields that are not used by a particular fsidtype. To prevent an accidental dereference of stack garbage (.fhuuid being an example of a pointer that is left uninitialized sometimes), have parse_fsid() defensively pre-initialize *parsed to zero. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Eliminate unnecessary type conversionsChuck Lever2012-10-301-2/+2
| | | | | | Removed a copule Wsign-conversion in the mountd code. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Avoid unnecessary type conversionsChuck Lever2012-10-303-5/+11
| | | | | | | | | Removed a number of Wconversion warnings in the mountd code. Took the opportunity to eliminate some code duplication. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Eliminate dereferencing type punned pointersChuck Lever2012-10-301-6/+4
| | | | | | | | | | Removed a number of Wstrict-aliasing warnings Note also that site-local IPv6 addresses are deprecated, and thus are no longer encountered. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Simplify "no junction support" caseChuck Lever2012-10-221-13/+19
| | | | | | | | | | We've added logic in the "not an export" case in nfsd_export(), so it's no longer a simple function call. Clean up this code by splitting it into a new function, and make plain what happens when junction support is compiled out. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Dynamically allocate exportent that represents junctionsChuck Lever2012-10-221-24/+31
| | | | | | | | | | | | | | We're now duplicating a real exportent with arbitrary export options to create a junction exportent. After a dupexportent() call, several of the structure's fields can point to dynamically allocated memory. We have to be careful about not orphaning that memory. What's more, returning a pointer to a static structure is as 90's as a bad mullet. It's more straightforward to allocate the exportent dynamically and release it when we are through with it. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Add exportent_release()Chuck Lever2012-10-222-7/+13
| | | | | | | | | Split out the logic that releases dynamically allocated data in an exportent. The junction resolution code will invoke this to clean up the junction exportent once it has been dumped to the kernel. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Junctions inherit parent export's optionsChuck Lever2012-10-221-20/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Attempting to access junctions on a Linux NFS server from an NFS client connected via an ephemeral source port fails with a "client insecure" error on the server. This happens even when the "insecure" export option is specified on the junction's parent export. As a test, via a mountd code change, I added "insecure" to the fixed export options that mountd sets up for each junction, and the error disappeared. It's simple enough for old-school referrals configured directly in /etc/exports ("refer=") to have the needed options specified there. Cache entries for junctions, however, are created on the fly by mountd, and don't ever appear in /etc/exports. So there's nowhere obvious that export options for junctions can be specified. Bruce suggested that in order to specify unique export options for junctions, they should inherit the export options of their parent export. The junction's parent's exportent is duplicated in order to create an exportent for the junction itself. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Add lookup_export_parent()Chuck Lever2012-10-221-9/+70
| | | | | | | | | | | | | | | | | | In a moment I will be adding some logic that needs to know an junction's parent export. Here's a function that can discover an export's parent. It takes the target export's pathname, chops off the rightmost component, and tries a lookup_export(). If that succeeds, we have our answer. If not, it chops off the next rightmost component and tries again, until the root is reached. At the same time, infrastructure is added to pass the parent export down into the functions that convert locations into a new junction export entry. For now the parent export remains unused. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Set e_fslocdata field directlyChuck Lever2012-10-221-14/+23
| | | | | | | | | | | | | | | | | | | To create an export entry for a junction, an options string is constructed from the set of locations in the junction. This options string is then passed to mkexportent() where it is parsed and converted into an exportent. There is only one export option that is used to create a junction's exportent: "refer=". When that option is parsed, it's value is simply copied to a fresh string and planted in the new export's e_fslocdata field. Let's avoid the option parsing and extra string copy. Construct a string for the new e_fslocdata field and plant it in the exportent directly. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use static buffer when constructing junction export optionsChuck Lever2012-10-221-31/+5
| | | | | | | | | | | | Clean up: Simplify locations_to_export() by constructing a junction's export options in a static buffer. We can do this because all of this code is called serially, in one thread, and the result is thrown away immediately after the caller is finished. The returned exportent itself is static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Warn when a broken junction is encounteredChuck Lever2012-10-221-5/+14
| | | | | | | | A broken junction is a problem that administrators will want to know about and correct. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* GSSD: Pass GSS_context lifetime to the kernel.Andy Adamson2012-10-181-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | From: Andy Adamson <andros@netapp.com> The kernel gss_cl_ctx stores the context lifetime in gc_expiry, set by gssd in do_downcall() called by process_krb5_upcall(). The lifetime value is currently not related at all to the Kerberos TGS lifetime. It is either set to the value of gssd -t <timeout>, or to a kernel default of 3600 seconds. Most of the time the gssd -t command line is not set, and a timeout value of zero was sent to the kernel triggering the use of the 3600 second kernel default timeout. In order for the kernel to properly know when to renew a context, or to stop buffering writes for a context about to expire, the gc_expiry value needs to reflect the credential lifetime used to create the context. Note that gss_inquire_cred returns the number of seconds for which the context remains valid in the lifetime_rec parameter. Send the actual TGS remaining lifetime to the kernel. It can still be overwritten by the gssd -t command line option, or set to the kernel default if the gss_inquire_cred call fails (which sets the lifetime_rec to zero). Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>