linux/fs/nfsd/nfs4idmap.c

/*
 *  Mapping of UID/GIDs to name and vice versa.
 *
 *  Copyright (c) 2002, 2003 The Regents of the University of
 *  Michigan.  All rights reserved.
 *
 *  Marius Aamodt Eriksen <[email protected]>
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *  3. Neither the name of the University nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/sunrpc/svc_xprt.h>
#include <net/net_namespace.h>
#include "idmap.h"
#include "nfsd.h"
#include "netns.h"
#include "vfs.h"

/*
 * Turn off idmapping when using AUTH_SYS.
 */
static bool nfs4_disable_idmapping =;
module_param(nfs4_disable_idmapping, bool, 0644);
MODULE_PARM_DESC();

/*
 * Cache entry
 */

/*
 * XXX we know that IDMAP_NAMESZ < PAGE_SIZE, but it's ugly to rely on
 * that.
 */

struct ent {};

/* Common entry handling */

#define ENT_HASHBITS
#define ENT_HASHMAX

static void
ent_init(struct cache_head *cnew, struct cache_head *citm)
{}

static void
ent_put(struct kref *ref)
{}

static struct cache_head *
ent_alloc(void)
{}

/*
 * ID -> Name cache
 */

static uint32_t
idtoname_hash(struct ent *ent)
{}

static int
idtoname_upcall(struct cache_detail *cd, struct cache_head *h)
{}

static void
idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
    int *blen)
{}

static int
idtoname_match(struct cache_head *ca, struct cache_head *cb)
{}

static int
idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
{}

static void
warn_no_idmapd(struct cache_detail *detail, int has_died)
{}


static int         idtoname_parse(struct cache_detail *, char *, int);
static struct ent *idtoname_lookup(struct cache_detail *, struct ent *);
static struct ent *idtoname_update(struct cache_detail *, struct ent *,
				   struct ent *);

static const struct cache_detail idtoname_cache_template =;

static int
idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
{}

static struct ent *
idtoname_lookup(struct cache_detail *cd, struct ent *item)
{}

static struct ent *
idtoname_update(struct cache_detail *cd, struct ent *new, struct ent *old)
{}


/*
 * Name -> ID cache
 */

static inline int
nametoid_hash(struct ent *ent)
{}

static int
nametoid_upcall(struct cache_detail *cd, struct cache_head *h)
{}

static void
nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
    int *blen)
{}

static int
nametoid_match(struct cache_head *ca, struct cache_head *cb)
{}

static int
nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
{}

static struct ent *nametoid_lookup(struct cache_detail *, struct ent *);
static struct ent *nametoid_update(struct cache_detail *, struct ent *,
				   struct ent *);
static int         nametoid_parse(struct cache_detail *, char *, int);

static const struct cache_detail nametoid_cache_template =;

static int
nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
{}


static struct ent *
nametoid_lookup(struct cache_detail *cd, struct ent *item)
{}

static struct ent *
nametoid_update(struct cache_detail *cd, struct ent *new, struct ent *old)
{}

/*
 * Exported API
 */

int
nfsd_idmap_init(struct net *net)
{}

void
nfsd_idmap_shutdown(struct net *net)
{}

static int
idmap_lookup(struct svc_rqst *rqstp,
		struct ent *(*lookup_fn)(struct cache_detail *, struct ent *),
		struct ent *key, struct cache_detail *detail, struct ent **item)
{}

static char *
rqst_authname(struct svc_rqst *rqstp)
{}

static __be32
idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
		u32 *id)
{}

static __be32 encode_ascii_id(struct xdr_stream *xdr, u32 id)
{}

static __be32 idmap_id_to_name(struct xdr_stream *xdr,
			       struct svc_rqst *rqstp, int type, u32 id)
{}

static bool
numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
{}

static __be32
do_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
{}

static __be32 encode_name_from_id(struct xdr_stream *xdr,
				  struct svc_rqst *rqstp, int type, u32 id)
{}

__be32
nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
		kuid_t *uid)
{}

__be32
nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
		kgid_t *gid)
{}

__be32 nfsd4_encode_user(struct xdr_stream *xdr, struct svc_rqst *rqstp,
			 kuid_t uid)
{}

__be32 nfsd4_encode_group(struct xdr_stream *xdr, struct svc_rqst *rqstp,
			  kgid_t gid)
{}