diff options
Diffstat (limited to 'sys/fs/nfs/nfs_commonsubs.c')
| -rw-r--r-- | sys/fs/nfs/nfs_commonsubs.c | 40 | 
1 files changed, 31 insertions, 9 deletions
| diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index ec95716ea485..f580a394a735 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -194,7 +194,6 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = {  	{ 0, 1, 1, 1, LK_EXCLUSIVE, 1, 1 },		/* Removexattr */  }; -static int ncl_mbuf_mhlen = MHLEN;  struct nfsrv_lughash {  	struct mtx		mtx;  	struct nfsuserhashhead	lughead; @@ -641,6 +640,7 @@ nfscl_fillsattr(struct nfsrv_descript *nd, struct vattr *vap,  		if ((flags & NFSSATTR_FULL) && vap->va_size != VNOVAL)  			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE);  		if ((flags & NFSSATTR_FULL) && vap->va_flags != VNOVAL) { +			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE);  			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN);  			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM);  		} @@ -769,7 +769,7 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int how)  		nd->nd_dpos += siz;  	} else if (nd->nd_md->m_next == NULL) {  		return (retp); -	} else if (siz > ncl_mbuf_mhlen) { +	} else if (siz > MHLEN) {  		panic("nfs S too big");  	} else {  		MGET(mp2, how, MT_DATA); @@ -1672,9 +1672,17 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,  			attrsum += NFSX_UNSIGNED;  			break;  		case NFSATTRBIT_ARCHIVE: -			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); -			if (compare && !(*retcmpp)) -				*retcmpp = NFSERR_ATTRNOTSUPP; +			NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); +			if (compare) { +				if (!(*retcmpp) && ((*tl == newnfs_true && +				    (nap->na_flags & UF_ARCHIVE) == 0) || +				    (*tl == newnfs_false && +				     (nap->na_flags & UF_ARCHIVE) != 0))) +					*retcmpp = NFSERR_NOTSAME; +			} else if (nap != NULL) { +				if (*tl == newnfs_true) +					nap->na_flags |= UF_ARCHIVE; +			}  			attrsum += NFSX_UNSIGNED;  			break;  		case NFSATTRBIT_CANSETTIME: @@ -2804,6 +2812,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,  			if (!has_hiddensystem) {  			    NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN);  			    NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM); +			    NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE);  			}  			if (clone_blksize == 0)  			    NFSCLRBIT_ATTRBIT(&attrbits, @@ -2888,6 +2897,14 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,  			*tl = txdr_unsigned(NFSV4ACE_SUPTYPES);  			retnum += NFSX_UNSIGNED;  			break; +		case NFSATTRBIT_ARCHIVE: +			NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); +			if ((vap->va_flags & UF_ARCHIVE) != 0) +				*tl = newnfs_true; +			else +				*tl = newnfs_false; +			retnum += NFSX_UNSIGNED; +			break;  		case NFSATTRBIT_CANSETTIME:  			NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);  			if (fsinf.fs_properties & NFSV3FSINFO_CANSETTIME) @@ -4174,10 +4191,15 @@ nfssvc_idname(struct nfsd_idargs *nidp)  	    nidp->nid_namelen);  	if (error == 0 && nidp->nid_ngroup > 0 &&  	    (nidp->nid_flag & NFSID_ADDUID) != 0) { -		grps = malloc(sizeof(gid_t) * nidp->nid_ngroup, M_TEMP, -		    M_WAITOK); -		error = copyin(nidp->nid_grps, grps, -		    sizeof(gid_t) * nidp->nid_ngroup); +		grps = NULL; +		if (nidp->nid_ngroup > NGROUPS_MAX) +			error = EINVAL; +		if (error == 0) { +			grps = malloc(sizeof(gid_t) * nidp->nid_ngroup, M_TEMP, +			    M_WAITOK); +			error = copyin(nidp->nid_grps, grps, +			    sizeof(gid_t) * nidp->nid_ngroup); +		}  		if (error == 0) {  			/*  			 * Create a credential just like svc_getcred(), | 
