Page MenuHomeFreeBSD

D14438.id39546.diff
No OneTemporary

D14438.id39546.diff

Index: head/usr.sbin/mountd/mountd.c
===================================================================
--- head/usr.sbin/mountd/mountd.c
+++ head/usr.sbin/mountd/mountd.c
@@ -1053,8 +1053,6 @@
*/
if (realpath(rpcpath, dirpath) == NULL ||
stat(dirpath, &stb) < 0 ||
- (!S_ISDIR(stb.st_mode) &&
- (dir_only || !S_ISREG(stb.st_mode))) ||
statfs(dirpath, &fsb) < 0) {
chdir("/"); /* Just in case realpath doesn't */
syslog(LOG_NOTICE,
@@ -1064,10 +1062,23 @@
warnx("stat failed on %s", dirpath);
bad = ENOENT; /* We will send error reply later */
}
+ if (!bad &&
+ !S_ISDIR(stb.st_mode) &&
+ (dir_only || !S_ISREG(stb.st_mode))) {
+ syslog(LOG_NOTICE,
+ "mount request from %s for non-directory path %s",
+ numerichost, dirpath);
+ if (debug)
+ warnx("mounting non-directory %s", dirpath);
+ bad = ENOTDIR; /* We will send error reply later */
+ }
/* Check in the exports list */
sigprocmask(SIG_BLOCK, &sighup_mask, NULL);
- ep = ex_search(&fsb.f_fsid);
+ if (bad)
+ ep = NULL;
+ else
+ ep = ex_search(&fsb.f_fsid);
hostset = defset = 0;
if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset,
&numsecflavors, &secflavorsp) ||
@@ -1118,7 +1129,8 @@
"mount request succeeded from %s for %s",
numerichost, dirpath);
} else {
- bad = EACCES;
+ if (!bad)
+ bad = EACCES;
syslog(LOG_NOTICE,
"mount request denied from %s for %s",
numerichost, dirpath);

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 26, 8:35 PM (20 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16857549
Default Alt Text
D14438.id39546.diff (1 KB)

Event Timeline