1c5c4113dSnw /* 2c5c4113dSnw * CDDL HEADER START 3c5c4113dSnw * 4c5c4113dSnw * The contents of this file are subject to the terms of the 5c5c4113dSnw * Common Development and Distribution License (the "License"). 6c5c4113dSnw * You may not use this file except in compliance with the License. 7c5c4113dSnw * 8c5c4113dSnw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9c5c4113dSnw * or http://www.opensolaris.org/os/licensing. 10c5c4113dSnw * See the License for the specific language governing permissions 11c5c4113dSnw * and limitations under the License. 12c5c4113dSnw * 13c5c4113dSnw * When distributing Covered Code, include this CDDL HEADER in each 14c5c4113dSnw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15c5c4113dSnw * If applicable, add the following below this CDDL HEADER, with the 16c5c4113dSnw * fields enclosed by brackets "[]" replaced with your own identifying 17c5c4113dSnw * information: Portions Copyright [yyyy] [name of copyright owner] 18c5c4113dSnw * 19c5c4113dSnw * CDDL HEADER END 20c5c4113dSnw */ 21c5c4113dSnw /* 22*7a8a68f5SJulian Pullen * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23c5c4113dSnw * Use is subject to license terms. 24c5c4113dSnw */ 25c5c4113dSnw 26c5c4113dSnw /* 27c5c4113dSnw * Private Header for Identity Mapping 28c5c4113dSnw */ 29c5c4113dSnw 30c5c4113dSnw #ifndef _IDMAP_IMPL_H 31c5c4113dSnw #define _IDMAP_IMPL_H 32c5c4113dSnw 33c5c4113dSnw 34479ac375Sdm #include <rpc/xdr.h> 35479ac375Sdm #include <libscf.h> 36479ac375Sdm #include <resolv.h> 37479ac375Sdm 38c5c4113dSnw #include "idmap_prot.h" 39c5c4113dSnw #include "idmap_priv.h" 40*7a8a68f5SJulian Pullen 41479ac375Sdm 42c5c4113dSnw 43c5c4113dSnw #ifdef __cplusplus 44c5c4113dSnw extern "C" { 45c5c4113dSnw #endif 46c5c4113dSnw 47c5c4113dSnw #define _IDMAP_HANDLE_RPC_DOORS 1 48c5c4113dSnw 49c5c4113dSnw #define _IDMAP_GET_CLIENT_HANDLE(h, clnt) \ 50c5c4113dSnw if (h == NULL) \ 51c5c4113dSnw return (IDMAP_ERR_CLIENT_HANDLE);\ 52c5c4113dSnw if (h->type != _IDMAP_HANDLE_RPC_DOORS) \ 53c5c4113dSnw return (IDMAP_ERR_NOTSUPPORTED);\ 54c5c4113dSnw clnt = (CLIENT *)h->privhandle;\ 55c5c4113dSnw if (clnt == NULL)\ 56c5c4113dSnw return (IDMAP_ERR_RPC_HANDLE); 57c5c4113dSnw 58c5c4113dSnw struct idmap_handle { 59c5c4113dSnw int type; 60c5c4113dSnw void *privhandle; 61c5c4113dSnw /* locks */ 62c5c4113dSnw }; 63c5c4113dSnw 64c5c4113dSnw struct idmap_udt_handle { 65c5c4113dSnw struct idmap_handle *ih; 66c5c4113dSnw idmap_update_batch batch; 67c5c4113dSnw uint64_t next; 688e228215Sdm int64_t error_index; 698e228215Sdm idmap_stat commit_stat; 708e228215Sdm idmap_namerule error_rule; 718e228215Sdm idmap_namerule conflict_rule; 72c5c4113dSnw }; 73c5c4113dSnw 74651c0131Sbaban #define _IDMAP_RESET_UDT_HANDLE(uh) \ 75651c0131Sbaban (void) xdr_free(xdr_idmap_update_batch, (caddr_t)&uh->batch);\ 768e228215Sdm uh->next = 0;\ 778e228215Sdm uh->error_index = -1;\ 788e228215Sdm (void) xdr_free(xdr_idmap_namerule, (caddr_t)&uh->error_rule);\ 798e228215Sdm (void) xdr_free(xdr_idmap_namerule, (caddr_t)&uh->conflict_rule); 80651c0131Sbaban 81c5c4113dSnw typedef struct idmap_get_res { 82c5c4113dSnw idmap_id_type idtype; 83c5c4113dSnw uid_t *uid; 84c5c4113dSnw gid_t *gid; 85c5c4113dSnw int *is_user; 86c5c4113dSnw char **sidprefix; 87c5c4113dSnw idmap_rid_t *rid; 88c5c4113dSnw idmap_stat *stat; 8948258c6bSjp idmap_info *info; 903ee87bcaSJulian Pullen int cache_res; 91c5c4113dSnw } idmap_get_res_t; 92c5c4113dSnw 93c5c4113dSnw struct idmap_get_handle { 94c5c4113dSnw struct idmap_handle *ih; 95c5c4113dSnw idmap_mapping_batch batch; 96c5c4113dSnw idmap_get_res_t *retlist; 97c5c4113dSnw uint64_t next; 98c5c4113dSnw }; 99c5c4113dSnw 100651c0131Sbaban #define _IDMAP_RESET_GET_HANDLE(gh) \ 101651c0131Sbaban (void) xdr_free(xdr_idmap_mapping_batch, (caddr_t)&gh->batch);\ 102651c0131Sbaban if (gh->retlist) \ 103651c0131Sbaban free(gh->retlist);\ 104651c0131Sbaban gh->retlist = NULL;\ 105651c0131Sbaban gh->next = 0; 106651c0131Sbaban 107c5c4113dSnw struct idmap_iter { 108c5c4113dSnw struct idmap_handle *ih; 109c5c4113dSnw int type; 110c5c4113dSnw uint64_t limit; 111c5c4113dSnw void *arg; 112c5c4113dSnw idmap_retcode retcode; 113c5c4113dSnw uint64_t lastrowid; 114c5c4113dSnw uint64_t next; 115c5c4113dSnw void *retlist; 116c5c4113dSnw }; 117c5c4113dSnw 118c5c4113dSnw typedef struct stat_table { 119c5c4113dSnw idmap_retcode retcode; 120c5c4113dSnw const char *msg; 121c5c4113dSnw int errnum; 122c5c4113dSnw } stat_table_t; 123c5c4113dSnw 124c5c4113dSnw typedef idmap_retcode _idmap_stat; 125c5c4113dSnw 126651c0131Sbaban extern idmap_retcode _udt_extend_batch(idmap_udt_handle_t *); 127c5c4113dSnw extern idmap_retcode _get_ids_extend_batch(idmap_get_handle_t *); 128c5c4113dSnw extern idmap_stat _iter_get_next_list(int, idmap_iter_t *, void *, 129c5c4113dSnw uchar_t **, size_t, xdrproc_t, xdrproc_t); 130651c0131Sbaban extern idmap_stat _idmap_rpc2stat(CLIENT *); 131c5c4113dSnw 132479ac375Sdm extern idmap_stat idmap_get_prop_ds(idmap_handle_t *, idmap_prop_type, 133479ac375Sdm idmap_ad_disc_ds_t *); 134479ac375Sdm extern idmap_stat idmap_get_prop_str(idmap_handle_t *, idmap_prop_type, 135479ac375Sdm char **); 136479ac375Sdm 137479ac375Sdm 138c5c4113dSnw #ifdef __cplusplus 139c5c4113dSnw } 140c5c4113dSnw #endif 141c5c4113dSnw 142c5c4113dSnw #endif /* _IDMAP_IMPL_H */ 143