exportfs: make root unexportable
Subsystems (2)
PATCH 1/1 exportfs: make root unexportable
If root of the filesystem is exported, it cannot be explicitly unexported, since unexportfs_parsed, in order to deal with trailing '/', will leave nlen at 0 for root exported case
--- utils/exportfs/exportfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/exportfs/exportfs.c +1 -1
@@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose)* so need to deal with it. */ size_t nlen =strlen (path); -while (path[nlen -1 ] =='/' ) +while ((path[nlen -1 ] =='/' ) && (nlen >1 )) nlen--;for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
Signature · 1 line
2.21.0
Hi SteveD,
This is a real problem introduced by my previous update. Sorry for it.
How about also adding this tag:
Thanks,
Yongcheng
Quoted 25 lines · Roberto Bergantinos Corpas
If root of the filesystem is exported, it cannot be explicitly unexported, since
unexportfs_parsed, in order to deal with trailing '/', will leave nlen at 0 for root exported caseSigned-off-by Roberto Bergantinos Corpas <[email protected]>--- utils/exportfs/exportfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/exportfs/exportfs.c +1
-1@@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose)* so need to deal with it. */ size_t nlen =strlen (path); -while (path[nlen -1 ] =='/' ) +while ((path[nlen -1 ] =='/' ) && (nlen >1 )) nlen--;for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {Signature · 1 line
2.21.0
Hello,
Quoted 14 lines · Roberto Bergantinos Corpas
If root of the filesystem is exported, it cannot be explicitly unexported, since
unexportfs_parsed, in order to deal with trailing '/', will leave nlen at 0 for root exported caseSigned-off-by Roberto Bergantinos Corpas <[email protected]>--- utils/exportfs/exportfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/exportfs/exportfs.c +0
-0
utils/exportfs/exportfs.c unexportfs_parsed(char *hname, char *path, int verbose) · line 376
Quoted 6 lines
utils/exportfs/exportfs.c +1
-1@@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose)* so need to deal with it. */ size_t nlen =strlen (path); -while (path[nlen -1 ] =='/' ) +while ((path[nlen -1 ] =='/' ) && (nlen >1 )) nlen--;
I decided to use Ondrej's version sine the nlen is tested first before the index into path was made.
steved.
Quoted 3 lines
utils/exportfs/exportfs.c +0
-0for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {