summaryrefslogtreecommitdiffstats
path: root/utils/mountd/v4root.c
Commit message (Collapse)AuthorAgeFilesLines
* mountd: Honor the no_root_squash flag on pseudo rootsJ. Bruce Fields2012-05-291-1/+4
| | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> If root squashing is turned off on a export that has multiple directories, the parent directories of the pseudo exports that's built, also needs to have root squashing turned off. Tested-by: Steve Dickson <steved@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* v4_root_add_parents: remove a possible buffer overflow.NeilBrown2012-05-011-2/+2
| | | | | | | | | | | | | | | | | | | | | The loop in v4root_add_parents() is a little odd. The first time through, 'ptr' points immediately "beyond" a '/' character (the first). For every other iterration it points directly "at" a '/' character. Such inconsistency is error prone and infact there is an error. If "path" is precisely "/", then the first call to ptr = strchr(ptr, '/') will be given a 'ptr' which is beyond the '\0' at the end of "path". This could potentially contain anything and the strchr() could search well beyond a buffer (though this depends on exactly how the string is set up which depends on separate code). So change the loop to have 'ptr' always point at a '/', and handle the special case of "/" explicitly. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* v4root: set the time-to-live for V4ROOT exports to the DEFAULT.NeilBrown2012-05-011-0/+1
| | | | | | | | | | | | | | e_ttl is set to the default in init_exportent(). However V4ROOT exports never see init_exportent() as they are created with dupexportent from a template. So e_ttl does not get set and export entries expire immediately. This results in an upcall to mountd every time a V4ROOT directory in accessed. So set e_ttl in the template. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* 4set_root: force "fsid=0" for all exports of '/'NeilBrown2012-05-011-0/+7
| | | | | | | | | | | | | | | When "fsid=0" is not explicitly given in /etc/exports, v4set_root creates a pseudo (NFSEXP_V4ROOT) export for '/' with fsid 0 so that an NFSv4 client can find the root. However if '/' is explicitly exported to the client, then that explicit export must be used, and it will not have fsid=0. So we must impose fsid=0 on all exports of '/'. Without this, if '/' is exported to a client, that client will not be able to mount '/' with NFSv4. Signed-off-by: NeilBrown <neilb@suse.de> 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>
* 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>
* mountd: minor v4root_set cleanup, check strdup returnJ. Bruce Fields2010-01-131-18/+28
| | | | | | | | | | | | Move more of v4root_set into a helper function. Also, check the return value from strdup. (We don't really handle the error well yet--we'll end up giving negative replies to export upcalls when we should be giving the kernel exports, resulting in spurious -ENOENTs or -ESTALE's--but that's better than crashing with a NULL dereference.) Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* mountd: simplify export list deferral in v4root_setJ. Bruce Fields2010-01-131-3/+2
| | | | | | | We're adding new entries, but not deleting them, so we don't need to do the usual double-counter trick here. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* mountd: minor optimization in v4root_setJ. Bruce Fields2010-01-131-0/+7
| | | | | | | | | | | | | | Since we're adding new exports as we traverse the export list, it's possible we may find ourselves revisiting an export we just added. It's harmless to reprocess those exports, as we're currently doing. But it's also pointless. (Actually, the current code appears to always add new export entries at the head of each list, so we shouldn't hit this case. It still may be a good idea to keep this check, though, as insulation against future changes to that data structure.) Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* exports: NFSv4 pseudoroot support routinesSteve Dickson2010-01-131-0/+180
Create v4root exports for each directory that is a parent of an explicit export. Give each the minimal security required to traverse to any of its children. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>