#include <linux/types.h>
#include <linux/parser.h>
#include <linux/fs.h>
#include <net/net_namespace.h>
#include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
#include <linux/key.h>
#include <linux/keyctl.h>
#include <linux/key-type.h>
#include <keys/user-type.h>
#include <keys/request_key_auth-type.h>
#include <linux/module.h>
#include <linux/user_namespace.h>
#include "internal.h"
#include "netns.h"
#include "nfs4idmap.h"
#include "nfs4trace.h"
#define NFS_UINT_MAXLEN …
static const struct cred *id_resolver_cache;
static struct key_type key_type_id_resolver_legacy;
struct idmap_legacy_upcalldata { … };
struct idmap { … };
static struct user_namespace *idmap_userns(const struct idmap *idmap)
{ … }
void nfs_fattr_init_names(struct nfs_fattr *fattr,
struct nfs4_string *owner_name,
struct nfs4_string *group_name)
{ … }
static void nfs_fattr_free_owner_name(struct nfs_fattr *fattr)
{ … }
static void nfs_fattr_free_group_name(struct nfs_fattr *fattr)
{ … }
static bool nfs_fattr_map_owner_name(struct nfs_server *server, struct nfs_fattr *fattr)
{ … }
static bool nfs_fattr_map_group_name(struct nfs_server *server, struct nfs_fattr *fattr)
{ … }
void nfs_fattr_free_names(struct nfs_fattr *fattr)
{ … }
void nfs_fattr_map_and_free_names(struct nfs_server *server, struct nfs_fattr *fattr)
{ … }
int nfs_map_string_to_numeric(const char *name, size_t namelen, __u32 *res)
{ … }
EXPORT_SYMBOL_GPL(…);
static int nfs_map_numeric_to_string(__u32 id, char *buf, size_t buflen)
{ … }
static struct key_type key_type_id_resolver = …;
int nfs_idmap_init(void)
{ … }
void nfs_idmap_quit(void)
{ … }
static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
const char *type, size_t typelen, char **desc)
{ … }
static struct key *nfs_idmap_request_key(const char *name, size_t namelen,
const char *type, struct idmap *idmap)
{ … }
static ssize_t nfs_idmap_get_key(const char *name, size_t namelen,
const char *type, void *data,
size_t data_size, struct idmap *idmap)
{ … }
static ssize_t nfs_idmap_lookup_name(__u32 id, const char *type, char *buf,
size_t buflen, struct idmap *idmap)
{ … }
static int nfs_idmap_lookup_id(const char *name, size_t namelen, const char *type,
__u32 *id, struct idmap *idmap)
{ … }
enum { … };
static const match_table_t nfs_idmap_tokens = …;
static int nfs_idmap_legacy_upcall(struct key *, void *);
static ssize_t idmap_pipe_downcall(struct file *, const char __user *,
size_t);
static void idmap_release_pipe(struct inode *);
static void idmap_pipe_destroy_msg(struct rpc_pipe_msg *);
static const struct rpc_pipe_ops idmap_upcall_ops = …;
static struct key_type key_type_id_resolver_legacy = …;
static void nfs_idmap_pipe_destroy(struct dentry *dir,
struct rpc_pipe_dir_object *pdo)
{ … }
static int nfs_idmap_pipe_create(struct dentry *dir,
struct rpc_pipe_dir_object *pdo)
{ … }
static const struct rpc_pipe_dir_object_ops nfs_idmap_pipe_dir_object_ops = …;
int
nfs_idmap_new(struct nfs_client *clp)
{ … }
void
nfs_idmap_delete(struct nfs_client *clp)
{ … }
static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
struct idmap_msg *im,
struct rpc_pipe_msg *msg)
{ … }
static bool
nfs_idmap_prepare_pipe_upcall(struct idmap *idmap,
struct idmap_legacy_upcalldata *data)
{ … }
static void nfs_idmap_complete_pipe_upcall(struct idmap_legacy_upcalldata *data,
int ret)
{ … }
static void nfs_idmap_abort_pipe_upcall(struct idmap *idmap,
struct idmap_legacy_upcalldata *data,
int ret)
{ … }
static int nfs_idmap_legacy_upcall(struct key *authkey, void *aux)
{ … }
static int nfs_idmap_instantiate(struct key *key, struct key *authkey, char *data, size_t datalen)
{ … }
static int nfs_idmap_read_and_verify_message(struct idmap_msg *im,
struct idmap_msg *upcall,
struct key *key, struct key *authkey)
{ … }
static ssize_t
idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
{ … }
static void
idmap_pipe_destroy_msg(struct rpc_pipe_msg *msg)
{ … }
static void
idmap_release_pipe(struct inode *inode)
{ … }
int nfs_map_name_to_uid(const struct nfs_server *server, const char *name, size_t namelen, kuid_t *uid)
{ … }
int nfs_map_group_to_gid(const struct nfs_server *server, const char *name, size_t namelen, kgid_t *gid)
{ … }
int nfs_map_uid_to_name(const struct nfs_server *server, kuid_t uid, char *buf, size_t buflen)
{ … }
int nfs_map_gid_to_group(const struct nfs_server *server, kgid_t gid, char *buf, size_t buflen)
{ … }