diff --git a/usr.sbin/mountd/exports.5 b/usr.sbin/mountd/exports.5 index 018a865..a96f3f2 100644 --- a/usr.sbin/mountd/exports.5 +++ b/usr.sbin/mountd/exports.5 @@ -108,7 +108,7 @@ any .Dq Pa \&. or .Dq Pa .. -components. +components or end with a trailing / other than "/" itself. Mount points for a file system may appear on multiple lines each with different sets of hosts and export options. .Pp diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 89c7afb..6dbbc1f 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -3149,7 +3149,8 @@ check_options(struct dirlist *dp) } /* - * Check an absolute directory path for any symbolic links. Return true + * Check an absolute directory path for any symbolic links and + * the path does not end with a /. Return true */ int check_dirpath(char *dirp) @@ -3168,6 +3169,10 @@ check_dirpath(char *dirp) } cp++; } + --cp; + /* If dirp is not root and ends with a / */ + if (cp != dirp && *cp == '/') + ret = 0; if (lstat(dirp, &sb) < 0 || !S_ISDIR(sb.st_mode)) ret = 0; return (ret);