summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortim <tim@openbsd.org>2015-12-15 18:17:34 +0000
committertim <tim@openbsd.org>2015-12-15 18:17:34 +0000
commita3d08ac246d64833a9543ab6b47763ac8a6cc8bc (patch)
tree36b0542846309bc0b830a3a9dc6f0fe4946cea4a
parentmissing space in previous; (diff)
downloadwireguard-openbsd-a3d08ac246d64833a9543ab6b47763ac8a6cc8bc.tar.xz
wireguard-openbsd-a3d08ac246d64833a9543ab6b47763ac8a6cc8bc.zip
When (re)reading /etc/exports, handle the case where the mount point of an
export is not also the mount point of a local filesystem. In this case, the local filesystem would not be removed from the "unexport list", causing the export to be "unexported" again. This fix then also allows us to actually delete an export that has been removed from /etc/exports, by passing the MNT_DELEXPORT export flag to mount(2). Makes sense to millert@.
-rw-r--r--sbin/mountd/mountd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index c5f947a0182..a45b3f15ea6 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.82 2015/12/10 17:27:00 mmcc Exp $ */
+/* $OpenBSD: mountd.c,v 1.83 2015/12/15 18:17:34 tim Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -960,7 +960,8 @@ get_exportlist(void)
for (i = 0; i < num; i++) {
if ((fstbl[i].mntonname != NULL) &&
- (strcmp (dirp, fstbl[i].mntonname) == 0) &&
+ (strcmp(fsb.f_mntonname,
+ fstbl[i].mntonname) == 0) &&
(fstbl[i].exflags & MNT_DELEXPORT)) {
exflags |= MNT_DELEXPORT;
fstbl[i].exflags = 0;
@@ -1035,6 +1036,7 @@ nextline:
fprintf(stderr, "unexporting %s %s\n",
fsp->f_mntonname, fstbl[i].mntonname);
bzero(&targs, sizeof(targs));
+ targs.ua.export_info.ex_flags = MNT_DELEXPORT;
if (mount(fsp->f_fstypename, fsp->f_mntonname,
fsp->f_flags | MNT_UPDATE, &targs) < 0)
syslog(LOG_ERR, "Can't delete exports for %s: %m",