From owner-svn-src-all@freebsd.org Tue Jun 16 21:30:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15C593355BD; Tue, 16 Jun 2020 21:30:31 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49mhFL6rkfz3WGW; Tue, 16 Jun 2020 21:30:30 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC051158D8; Tue, 16 Jun 2020 21:30:30 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05GLUUGQ089196; Tue, 16 Jun 2020 21:30:30 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05GLUUJc089194; Tue, 16 Jun 2020 21:30:30 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202006162130.05GLUUJc089194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Tue, 16 Jun 2020 21:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362252 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2020 21:30:31 -0000 Author: freqlabs Date: Tue Jun 16 21:30:30 2020 New Revision: 362252 URL: https://svnweb.freebsd.org/changeset/base/362252 Log: Apply default security flavor in vfs_export There may be some version of mountd out there that does not supply a default security flavor when none is given for an export. Set the default security flavor in vfs_export if none is given, and remove the workaround for oexport compat. Reported by: npn Reviewed by: rmacklem Approved by: mav (mentor) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25300 Modified: head/sys/kern/vfs_export.c head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Tue Jun 16 21:29:02 2020 (r362251) +++ head/sys/kern/vfs_export.c Tue Jun 16 21:30:30 2020 (r362252) @@ -61,6 +61,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address structure"); #if defined(INET) || defined(INET6) @@ -303,7 +306,7 @@ vfs_export(struct mount *mp, struct export_args *argp) return (EINVAL); if ((argp->ex_flags & MNT_EXPORTED) != 0 && - (argp->ex_numsecflavors <= 0 + (argp->ex_numsecflavors < 0 || argp->ex_numsecflavors >= MAXSECFLAVORS)) return (EINVAL); @@ -340,6 +343,10 @@ vfs_export(struct mount *mp, struct export_args *argp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_EXPUBLIC; MNT_IUNLOCK(mp); + } + if (argp->ex_numsecflavors == 0) { + argp->ex_numsecflavors = 1; + argp->ex_secflavors[0] = AUTH_SYS; } if ((error = vfs_hang_addrlist(mp, nep, argp))) goto out; Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Tue Jun 16 21:29:02 2020 (r362251) +++ head/sys/kern/vfs_mount.c Tue Jun 16 21:30:30 2020 (r362252) @@ -70,9 +70,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include - #include #include @@ -1131,8 +1128,6 @@ vfs_domount_update( switch (len) { case (sizeof(struct oexport_args)): bzero(&o2export, sizeof(o2export)); - o2export.ex_numsecflavors = 1; - o2export.ex_secflavors[0] = AUTH_SYS; /* FALLTHROUGH */ case (sizeof(o2export)): bcopy(bufp, &o2export, len);