diff options
author | 1997-08-09 12:59:14 +0000 | |
---|---|---|
committer | 1997-08-09 12:59:14 +0000 | |
commit | 727dee7f77b47b988c3f95c88f39865cd672b53f (patch) | |
tree | 1afbca9618f0d77c101de007ebcd7990f390426f | |
parent | SYN flood protection, by specifying (diff) | |
download | wireguard-openbsd-727dee7f77b47b988c3f95c88f39865cd672b53f.tar.xz wireguard-openbsd-727dee7f77b47b988c3f95c88f39865cd672b53f.zip |
struct statfs uses a signed short f_flags field. This field is used in
the long (the type) expression that makes up the mount flags field passed
to mount(2). If we are dealing with a noatime mount this means sign
extension will occur and the flag field will get messed up. I.e. noatime
mounts (at least rw ones) ended up not exportable. I fixed this by casting
to u_short in the expressions, but I would like to change struct statfs
instead, but that is an API issue it is not for me to decide on.
I also added error decoding in two syslog calls.
This was made possible by the arglist heuristics printout of OpenBSD/alpha
DDB :-)
-rw-r--r-- | sbin/mountd/mountd.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 5224a41782c..9cc4c14e0ab 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mountd.c,v 1.18 1997/08/06 01:45:21 deraadt Exp $ */ +/* $OpenBSD: mountd.c,v 1.19 1997/08/09 12:59:14 niklas Exp $ */ /* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */ /* @@ -721,9 +721,10 @@ get_exportlist() targs.ua.fspec = NULL; targs.ua.export.ex_flags = MNT_DELEXPORT; if (mount(fsp->f_fstypename, fsp->f_mntonname, - fsp->f_flags | MNT_UPDATE, + (u_short)fsp->f_flags | MNT_UPDATE, (caddr_t)&targs) < 0) - syslog(LOG_ERR, "Can't delete exports for %s", + syslog(LOG_ERR, + "Can't delete exports for %s: %m", fsp->f_mntonname); } fsp++; @@ -1650,7 +1651,8 @@ do_mount(ep, grp, exflags, anoncrp, dirp, dirplen, fsb) * exportable file systems and not just MOUNT_FFS. */ while (mount(fsb->f_fstypename, dirp, - fsb->f_flags | MNT_UPDATE, (caddr_t)&args) < 0) { + (u_short)fsb->f_flags | MNT_UPDATE, (caddr_t)&args) < + 0) { if (cp) *cp-- = savedc; else @@ -1682,7 +1684,7 @@ do_mount(ep, grp, exflags, anoncrp, dirp, dirplen, fsb) if (cp == dirp) { if (debug) fprintf(stderr, "mnt unsucc\n"); - syslog(LOG_ERR, "Can't export %s", dirp); + syslog(LOG_ERR, "Can't export %s: %m", dirp); return (2); } savedc = *cp; |