Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/vfs_export.c
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | vfs_hang_addrlist(struct mount *mp, struct netexport *nep, | ||||
int i; | int i; | ||||
struct radix_node *rn; | struct radix_node *rn; | ||||
struct sockaddr *saddr, *smask = NULL; | struct sockaddr *saddr, *smask = NULL; | ||||
#if defined(INET6) || defined(INET) | #if defined(INET6) || defined(INET) | ||||
int off; | int off; | ||||
#endif | #endif | ||||
int error; | int error; | ||||
KASSERT(argp->ex_numsecflavors > 0, | |||||
("%s: numsecflavors <= 0", __func__)); | |||||
KASSERT(argp->ex_numsecflavors < MAXSECFLAVORS, | |||||
("%s: numsecflavors >= MAXSECFLAVORS", __func__)); | |||||
/* | /* | ||||
* XXX: This routine converts from a `struct xucred' | * XXX: This routine converts from a `struct xucred' | ||||
* (argp->ex_anon) to a `struct ucred' (np->netc_anon). This | * (argp->ex_anon) to a `struct ucred' (np->netc_anon). This | ||||
* operation is questionable; for example, what should be done | * operation is questionable; for example, what should be done | ||||
* with fields like cr_uidinfo and cr_prison? Currently, this | * with fields like cr_uidinfo and cr_prison? Currently, this | ||||
* routine does not touch them (leaves them as NULL). | * routine does not touch them (leaves them as NULL). | ||||
*/ | */ | ||||
if (argp->ex_anon.cr_version != XUCRED_VERSION) { | if (argp->ex_anon.cr_version != XUCRED_VERSION) { | ||||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | |||||
* the structure is described in sys/mount.h | * the structure is described in sys/mount.h | ||||
*/ | */ | ||||
int | int | ||||
vfs_export(struct mount *mp, struct export_args *argp) | vfs_export(struct mount *mp, struct export_args *argp) | ||||
{ | { | ||||
struct netexport *nep; | struct netexport *nep; | ||||
int error; | int error; | ||||
if (argp->ex_numsecflavors < 0 | if ((argp->ex_flags & (MNT_DELEXPORT | MNT_EXPORTED)) == 0) | ||||
|| argp->ex_numsecflavors >= MAXSECFLAVORS) | |||||
return (EINVAL); | return (EINVAL); | ||||
if ((argp->ex_flags & MNT_EXPORTED) != 0 && | |||||
(argp->ex_numsecflavors <= 0 | |||||
|| argp->ex_numsecflavors >= MAXSECFLAVORS)) | |||||
return (EINVAL); | |||||
error = 0; | error = 0; | ||||
lockmgr(&mp->mnt_explock, LK_EXCLUSIVE, NULL); | lockmgr(&mp->mnt_explock, LK_EXCLUSIVE, NULL); | ||||
nep = mp->mnt_export; | nep = mp->mnt_export; | ||||
if (argp->ex_flags & MNT_DELEXPORT) { | if (argp->ex_flags & MNT_DELEXPORT) { | ||||
if (nep == NULL) { | if (nep == NULL) { | ||||
error = ENOENT; | error = ENOENT; | ||||
goto out; | goto out; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, | ||||
if (np == NULL) { | if (np == NULL) { | ||||
lockmgr(&mp->mnt_explock, LK_RELEASE, NULL); | lockmgr(&mp->mnt_explock, LK_RELEASE, NULL); | ||||
*credanonp = NULL; | *credanonp = NULL; | ||||
return (EACCES); | return (EACCES); | ||||
} | } | ||||
*extflagsp = np->netc_exflags; | *extflagsp = np->netc_exflags; | ||||
if ((*credanonp = np->netc_anon) != NULL) | if ((*credanonp = np->netc_anon) != NULL) | ||||
crhold(*credanonp); | crhold(*credanonp); | ||||
if (numsecflavors) | if (numsecflavors) { | ||||
*numsecflavors = np->netc_numsecflavors; | *numsecflavors = np->netc_numsecflavors; | ||||
KASSERT(*numsecflavors > 0, | |||||
("%s: numsecflavors <= 0", __func__)); | |||||
KASSERT(*numsecflavors < MAXSECFLAVORS, | |||||
("%s: numsecflavors >= MAXSECFLAVORS", __func__)); | |||||
} | |||||
if (secflavors) | if (secflavors) | ||||
*secflavors = np->netc_secflavors; | *secflavors = np->netc_secflavors; | ||||
lockmgr(&mp->mnt_explock, LK_RELEASE, NULL); | lockmgr(&mp->mnt_explock, LK_RELEASE, NULL); | ||||
return (0); | return (0); | ||||
} | } | ||||