nfs3acl.c (bf61c8840efe60fd8f91446860b63338fb424158) | nfs3acl.c (4ac7249ea5a0ceef9f8269f63f33cc873c3fac61) |
---|---|
1/* 2 * Process version 3 NFSACL requests. 3 * 4 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> 5 */ 6 7#include "nfsd.h" 8/* FIXME: nfsacl.h is a broken header */ --- 15 unchanged lines hidden (view full) --- 24} 25 26/* 27 * Get the Access and/or Default ACL of a file. 28 */ 29static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, 30 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) 31{ | 1/* 2 * Process version 3 NFSACL requests. 3 * 4 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> 5 */ 6 7#include "nfsd.h" 8/* FIXME: nfsacl.h is a broken header */ --- 15 unchanged lines hidden (view full) --- 24} 25 26/* 27 * Get the Access and/or Default ACL of a file. 28 */ 29static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, 30 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) 31{ |
32 svc_fh *fh; | |
33 struct posix_acl *acl; | 32 struct posix_acl *acl; |
33 struct inode *inode; 34 svc_fh *fh; |
|
34 __be32 nfserr = 0; 35 36 fh = fh_copy(&resp->fh, &argp->fh); 37 nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); 38 if (nfserr) 39 RETURN_STATUS(nfserr); 40 | 35 __be32 nfserr = 0; 36 37 fh = fh_copy(&resp->fh, &argp->fh); 38 nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); 39 if (nfserr) 40 RETURN_STATUS(nfserr); 41 |
42 inode = fh->fh_dentry->d_inode; 43 |
|
41 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 42 RETURN_STATUS(nfserr_inval); 43 resp->mask = argp->mask; 44 45 if (resp->mask & (NFS_ACL|NFS_ACLCNT)) { | 44 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 45 RETURN_STATUS(nfserr_inval); 46 resp->mask = argp->mask; 47 48 if (resp->mask & (NFS_ACL|NFS_ACLCNT)) { |
46 acl = nfsd_get_posix_acl(fh, ACL_TYPE_ACCESS); | 49 acl = get_acl(inode, ACL_TYPE_ACCESS); |
47 if (IS_ERR(acl)) { | 50 if (IS_ERR(acl)) { |
48 int err = PTR_ERR(acl); 49 50 if (err == -ENODATA || err == -EOPNOTSUPP) 51 acl = NULL; 52 else { 53 nfserr = nfserrno(err); 54 goto fail; 55 } | 51 nfserr = nfserrno(PTR_ERR(acl)); 52 goto fail; |
56 } 57 if (acl == NULL) { 58 /* Solaris returns the inode's minimum ACL. */ | 53 } 54 if (acl == NULL) { 55 /* Solaris returns the inode's minimum ACL. */ |
59 60 struct inode *inode = fh->fh_dentry->d_inode; | |
61 acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); 62 } 63 resp->acl_access = acl; 64 } 65 if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) { 66 /* Check how Solaris handles requests for the Default ACL 67 of a non-directory! */ | 56 acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); 57 } 58 resp->acl_access = acl; 59 } 60 if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) { 61 /* Check how Solaris handles requests for the Default ACL 62 of a non-directory! */ |
68 69 acl = nfsd_get_posix_acl(fh, ACL_TYPE_DEFAULT); | 63 acl = get_acl(inode, ACL_TYPE_DEFAULT); |
70 if (IS_ERR(acl)) { | 64 if (IS_ERR(acl)) { |
71 int err = PTR_ERR(acl); 72 73 if (err == -ENODATA || err == -EOPNOTSUPP) 74 acl = NULL; 75 else { 76 nfserr = nfserrno(err); 77 goto fail; 78 } | 65 nfserr = nfserrno(PTR_ERR(acl)); 66 goto fail; |
79 } 80 resp->acl_default = acl; 81 } 82 83 /* resp->acl_{access,default} are released in nfs3svc_release_getacl. */ 84 RETURN_STATUS(0); 85 86fail: --- 4 unchanged lines hidden (view full) --- 91 92/* 93 * Set the Access and/or Default ACL of a file. 94 */ 95static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, 96 struct nfsd3_setaclargs *argp, 97 struct nfsd3_attrstat *resp) 98{ | 67 } 68 resp->acl_default = acl; 69 } 70 71 /* resp->acl_{access,default} are released in nfs3svc_release_getacl. */ 72 RETURN_STATUS(0); 73 74fail: --- 4 unchanged lines hidden (view full) --- 79 80/* 81 * Set the Access and/or Default ACL of a file. 82 */ 83static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, 84 struct nfsd3_setaclargs *argp, 85 struct nfsd3_attrstat *resp) 86{ |
87 struct inode *inode; |
|
99 svc_fh *fh; 100 __be32 nfserr = 0; | 88 svc_fh *fh; 89 __be32 nfserr = 0; |
90 int error; |
|
101 102 fh = fh_copy(&resp->fh, &argp->fh); 103 nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); | 91 92 fh = fh_copy(&resp->fh, &argp->fh); 93 nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); |
94 if (nfserr) 95 goto out; |
|
104 | 96 |
105 if (!nfserr) { 106 nfserr = nfserrno( nfsd_set_posix_acl( 107 fh, ACL_TYPE_ACCESS, argp->acl_access) ); | 97 inode = fh->fh_dentry->d_inode; 98 if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { 99 error = -EOPNOTSUPP; 100 goto out_errno; |
108 } | 101 } |
109 if (!nfserr) { 110 nfserr = nfserrno( nfsd_set_posix_acl( 111 fh, ACL_TYPE_DEFAULT, argp->acl_default) ); 112 } | |
113 | 102 |
103 error = fh_want_write(fh); 104 if (error) 105 goto out_errno; 106 107 error = inode->i_op->set_acl(inode, argp->acl_access, ACL_TYPE_ACCESS); 108 if (error) 109 goto out_drop_write; 110 error = inode->i_op->set_acl(inode, argp->acl_default, 111 ACL_TYPE_DEFAULT); 112 113out_drop_write: 114 fh_drop_write(fh); 115out_errno: 116 nfserr = nfserrno(error); 117out: |
|
114 /* argp->acl_{access,default} may have been allocated in 115 nfs3svc_decode_setaclargs. */ 116 posix_acl_release(argp->acl_access); 117 posix_acl_release(argp->acl_default); 118 RETURN_STATUS(nfserr); 119} 120 121/* --- 146 unchanged lines hidden --- | 118 /* argp->acl_{access,default} may have been allocated in 119 nfs3svc_decode_setaclargs. */ 120 posix_acl_release(argp->acl_access); 121 posix_acl_release(argp->acl_default); 122 RETURN_STATUS(nfserr); 123} 124 125/* --- 146 unchanged lines hidden --- |