4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer/*
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * nfsidmap_internal.h
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer *
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * nfs idmapping library, primarily for nfs4 client/server kernel idmapping
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * and for userland nfs4 idmapping by acl libraries.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer *
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * Copyright (c) 2004 The Regents of the University of Michigan.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * All rights reserved.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer *
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * Andy Adamson <andros@umich.edu>
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer *
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * Redistribution and use in source and binary forms, with or without
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * modification, are permitted provided that the following conditions
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * are met:
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer *
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * 1. Redistributions of source code must retain the above copyright
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * notice, this list of conditions and the following disclaimer.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * 2. Redistributions in binary form must reproduce the above copyright
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * notice, this list of conditions and the following disclaimer in the
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * documentation and/or other materials provided with the distribution.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * 3. Neither the name of the University nor the names of its
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * contributors may be used to endorse or promote products derived
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * from this software without specific prior written permission.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer *
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer */
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzerchar *get_default_domain(void);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzerstruct conf_list *get_local_realms(void);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzertypedef struct trans_func * (*libnfsidmap_plugin_init_t)(void);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzerstruct trans_func {
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer char *name;
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*init)(void);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*princ_to_ids)(char *secname, char *princ, uid_t *uid, gid_t *gid,
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer extra_mapping_params **ex);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*name_to_uid)(char *name, uid_t *uid);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*name_to_gid)(char *name, gid_t *gid);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*uid_to_name)(uid_t uid, char *domain, char *name, size_t len);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*gid_to_name)(gid_t gid, char *domain, char *name, size_t len);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int (*gss_princ_to_grouplist)(char *secname, char *princ, gid_t *groups,
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer int *ngroups, extra_mapping_params **ex);
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer};
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzerstruct mapping_plugin {
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer void *dl_handle;
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer struct trans_func *trans;
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer};
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzertypedef enum {
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer IDTYPE_USER = 1,
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer IDTYPE_GROUP = 2
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer} idtypes;
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzerextern int idmap_verbosity;
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzerextern nfs4_idmap_log_function_t idmap_log_func;
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer/* Level zero always prints, others print depending on verbosity level */
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer#define IDMAP_LOG(LVL, MSG) \
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer do { if (LVL <= idmap_verbosity) (*idmap_log_func)MSG; } while (0)
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer/*
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * from libnfsidmap's cfg.h (same license as above)
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * Copyright (c) 1998, 1999, 2001 Niklas Hallqvist. All rights reserved.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer * Copyright (c) 2000, 2003 H�kan Olsson. All rights reserved.
4466604d78e5ffd017e69e6861f7d78242b351fbNoam Meltzer */
ffc8c06969d79238f0e0cd8969c56eaca54afa17Lukas Slebodnikextern const char *conf_get_str(const char *, const char *);