2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A/*
2N/A * Header File for Clients of Native Identity Mapping Service
2N/A */
2N/A
2N/A#ifndef _IDMAP_H
2N/A#define _IDMAP_H
2N/A
2N/A
2N/A#include <stdlib.h>
2N/A#include <ctype.h>
2N/A#include <sys/param.h>
2N/A#include <sys/types.h>
2N/A#include <sys/stat.h>
2N/A#include <sys/idmap.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/* Status */
2N/Atypedef int32_t idmap_stat;
2N/A
2N/Atypedef uint32_t idmap_rid_t;
2N/A
2N/A/* Opaque "get-mapping" handle */
2N/Atypedef struct idmap_get_handle idmap_get_handle_t;
2N/A
2N/A/* Logger prototype which is based on syslog */
2N/Atypedef void (*idmap_logger_t)(int, const char *, ...);
2N/A
2N/A/*
2N/A * Setup API
2N/A */
2N/A
2N/A/* Status code to string */
2N/Aextern const char *idmap_stat2string(idmap_stat);
2N/A
2N/A/* Free memory allocated by the API */
2N/Aextern void idmap_free(void *);
2N/A
2N/A
2N/A/*
2N/A * Supported flag values for mapping requests.
2N/A * These flag values are applicable to the batch API and the
2N/A * Windows Name API below.
2N/A */
2N/A/* Use the libidmap cache */
2N/A#define IDMAP_REQ_FLG_USE_CACHE 0x00000010
2N/A
2N/A/*
2N/A * API to batch SID to UID/GID mapping requests
2N/A */
2N/A/* Create handle */
2N/Aextern idmap_stat idmap_get_create(idmap_get_handle_t **);
2N/A
2N/A/* Given SID, get UID */
2N/Aextern idmap_stat idmap_get_uidbysid(idmap_get_handle_t *, char *,
2N/A idmap_rid_t, int, uid_t *, idmap_stat *);
2N/A
2N/A/* Given SID, get GID */
2N/Aextern idmap_stat idmap_get_gidbysid(idmap_get_handle_t *, char *,
2N/A idmap_rid_t, int, gid_t *, idmap_stat *);
2N/A
2N/A/* Given SID, get UID or GID */
2N/Aextern idmap_stat idmap_get_pidbysid(idmap_get_handle_t *, char *,
2N/A idmap_rid_t, int, uid_t *, int *, idmap_stat *);
2N/A
2N/A/* Given UID, get SID */
2N/Aextern idmap_stat idmap_get_sidbyuid(idmap_get_handle_t *, uid_t, int,
2N/A char **, idmap_rid_t *, idmap_stat *);
2N/A
2N/A/* Given GID, get SID */
2N/Aextern idmap_stat idmap_get_sidbygid(idmap_get_handle_t *, gid_t, int,
2N/A char **, idmap_rid_t *, idmap_stat *);
2N/A
2N/A/* Process the batched requests */
2N/Aextern idmap_stat idmap_get_mappings(idmap_get_handle_t *);
2N/A
2N/A/* Destroy the handle */
2N/Aextern void idmap_get_destroy(idmap_get_handle_t *);
2N/A
2N/A
2N/A/*
2N/A * API to get Windows name by UID/GID and vice-versa
2N/A */
2N/A/* Given UID, get Windows name */
2N/Aextern idmap_stat idmap_getwinnamebyuid(uid_t, int, char **, char **);
2N/A
2N/A/* Given GID, get Windows name */
2N/Aextern idmap_stat idmap_getwinnamebygid(gid_t, int, char **, char **);
2N/A
2N/A/* Given Windows name, get UID */
2N/Aextern idmap_stat idmap_getuidbywinname(const char *, const char *,
2N/A int, uid_t *);
2N/A
2N/A/* Given Windows name, get GID */
2N/Aextern idmap_stat idmap_getgidbywinname(const char *, const char *,
2N/A int, gid_t *);
2N/A
2N/A/*
2N/A * Private versions of the functions above with special semantics for NFSv4.
2N/A *
2N/A * Private, subject to change without notice.
2N/A */
2N/Aextern idmap_stat idmap_nfsv4_getwinnamebyuid(uid_t, int, char **);
2N/Aextern idmap_stat idmap_nfsv4_getwinnamebygid(gid_t, int, char **);
2N/Aextern idmap_stat idmap_nfsv4_getuidbysid(const char *, int, uid_t *);
2N/Aextern idmap_stat idmap_nfsv4_getgidbysid(const char *, int, gid_t *);
2N/A
2N/A/* Logger */
2N/Aextern void idmap_set_logger(idmap_logger_t funct);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _IDMAP_H */