NFS: Add secinfo procedure
Subsystems (2)
PATCH v6 3/5 NFS: Add secinfo procedure
This patch adds the nfs4 operation secinfo as a
valid nfs rpc operation.
Signed-off-by Bryan Schumaker <[email protected]>
--- fs/nfs/nfs4proc.c | 35 ++++++++++++ fs/nfs/nfs4xdr.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4.h | 1 + include/linux/nfs_xdr.h | 37 +++++++++++++ 4 files changed, 208 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +35 -0
@@ -4649,6 +4649,40 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,return status; } +static int _nfs4_proc_secinfo (struct inode *dir,const struct qstr *name,struct nfs4_secinfo_flavors *flavors) +{ +int status; +struct nfs4_secinfo_arg args = { + .dir_fh =NFS_FH (dir), + .name = name, + }; +struct nfs4_secinfo_res res = { + .flavors = flavors, + }; +struct rpc_message msg = { + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SECINFO ], + .rpc_argp = &args, + .rpc_resp = &res, + }; + +dprintk ("NFS call secinfo %s\n" , name->name); + status =nfs4_call_sync (NFS_SERVER (dir)->client,NFS_SERVER (dir), &msg, &args.seq_args, &res.seq_res,0 ); +dprintk ("NFS reply secinfo: %d\n" , status); +return status; +} + +int nfs4_proc_secinfo (struct inode *dir,const struct qstr *name,struct nfs4_secinfo_flavors *flavors) +{ +struct nfs4_exception exception = { }; +int err; +do { + err =nfs4_handle_exception (NFS_SERVER (dir), +_nfs4_proc_secinfo (dir, name, flavors), + &exception); + }while (exception.retry); +return err; +} +#ifdef CONFIG_NFS_V4_1 /* * Check the exchange flags returned by the server for invalid flags, having
@@ -5860,6 +5894,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .close_context = nfs4_close_context, .open_context = nfs4_atomic_open, .init_client = nfs4_init_client, + .secinfo = nfs4_proc_secinfo, };static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = {
fs/nfs/nfs4xdr.c +135 -0
183 lines not on this page · raw message
include/linux/nfs4.h +1 -0
@@ -550,6 +550,7 @@ enum {NFSPROC4_CLNT_SETACL ,NFSPROC4_CLNT_FS_LOCATIONS ,NFSPROC4_CLNT_RELEASE_LOCKOWNER , +NFSPROC4_CLNT_SECINFO ,/* nfs41 */ NFSPROC4_CLNT_EXCHANGE_ID,
include/linux/nfs_xdr.h +37 -0
@@ -3,6 +3,7 @@#include <linux/nfsacl.h> #include <linux/nfs3.h> +#include <linux/sunrpc/gss_api.h> /* * To change the maximum rsize and wsize supported by the NFS client, adjust
@@ -14,6 +15,9 @@#define NFS_DEF_FILE_IO_SIZE (4096U)#define NFS_MIN_FILE_IO_SIZE (1024U) +/* Forward declaration for NFS v3 */ +struct nfs4_secinfo_flavors ; +struct nfs_fsid {uint64_t major;uint64_t minor;
@@ -959,6 +963,38 @@ struct nfs4_fs_locations_res {struct nfs4_sequence_res seq_res; }; +struct nfs4_secinfo_oid { +unsigned int len; +char data[GSS_OID_MAX_LEN ]; +}; + +struct nfs4_secinfo_gss { +struct nfs4_secinfo_oid sec_oid4; +unsigned int qop4; +unsigned int service; +}; + +struct nfs4_secinfo_flavor { +unsigned int flavor; +struct nfs4_secinfo_gss gss; +}; + +struct nfs4_secinfo_flavors { +unsigned int num_flavors; +struct nfs4_secinfo_flavor flavors[0 ]; +}; + +struct nfs4_secinfo_arg { +const struct nfs_fh *dir_fh; +const struct qstr *name; +struct nfs4_sequence_args seq_args; +}; + +struct nfs4_secinfo_res { +struct nfs4_secinfo_flavors *flavors; +struct nfs4_sequence_res seq_res; +}; +#endif /* CONFIG_NFS_V4 */ struct nfstime4 {
@@ -1142,6 +1178,7 @@ struct nfs_rpc_ops { struct iattr *iattr);int (*init_client) (struct nfs_client *,const struct rpc_timeout *,const char *,rpc_authflavor_t ,int ); +int (*secinfo)(struct inode *,const struct qstr *,struct nfs4_secinfo_flavors *); };/*
Signature · 1 line
1.7.4.1