NFSD: Server implementation of MAC Labeling
Implement labeled NFS on the server: encoding and decoding, and writing and reading, of file labels. Enabled with CONFIG_NFSD_V4_SECURITY_LABEL. Signed-off-by: Matthew N. Dodd <Matthew.Dodd@sparta.com> Signed-off-by: Miguel Rodel Felipe <Rodel_FM@dsi.a-star.edu.sg> Signed-off-by: Phua Eu Gene <PHUA_Eu_Gene@dsi.a-star.edu.sg> Signed-off-by: Khin Mi Mi Aung <Mi_Mi_AUNG@dsi.a-star.edu.sg> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:

committed by
J. Bruce Fields

parent
4bdc33ed5b
commit
18032ca062
@@ -28,6 +28,7 @@
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/exportfs.h>
|
||||
#include <linux/writeback.h>
|
||||
#include <linux/security.h>
|
||||
|
||||
#ifdef CONFIG_NFSD_V3
|
||||
#include "xdr3.h"
|
||||
@@ -621,6 +622,33 @@ int nfsd4_is_junction(struct dentry *dentry)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
|
||||
__be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
struct xdr_netobj *label)
|
||||
{
|
||||
__be32 error;
|
||||
int host_error;
|
||||
struct dentry *dentry;
|
||||
|
||||
error = fh_verify(rqstp, fhp, 0 /* S_IFREG */, NFSD_MAY_SATTR);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
dentry = fhp->fh_dentry;
|
||||
|
||||
mutex_lock(&dentry->d_inode->i_mutex);
|
||||
host_error = security_inode_setsecctx(dentry, label->data, label->len);
|
||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
||||
return nfserrno(host_error);
|
||||
}
|
||||
#else
|
||||
__be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
struct xdr_netobj *label)
|
||||
{
|
||||
return nfserr_notsupp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* defined(CONFIG_NFSD_V4) */
|
||||
|
||||
#ifdef CONFIG_NFSD_V3
|
||||
|
Reference in New Issue
Block a user