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*c5866007SKeyur Desai * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 23c5c4113dSnw */ 24c5c4113dSnw 25c5c4113dSnw /* 26c5c4113dSnw * Private Header for Identity Mapping 27c5c4113dSnw */ 28c5c4113dSnw 29c5c4113dSnw #ifndef _IDMAP_IMPL_H 30c5c4113dSnw #define _IDMAP_IMPL_H 31c5c4113dSnw 32c5c4113dSnw 33479ac375Sdm #include <rpc/xdr.h> 34479ac375Sdm #include <libscf.h> 35479ac375Sdm #include <resolv.h> 36479ac375Sdm 379b214d32SJordan Brown #include <rpcsvc/idmap_prot.h> 38c5c4113dSnw #include "idmap_priv.h" 397a8a68f5SJulian Pullen 40479ac375Sdm 41c5c4113dSnw 42c5c4113dSnw #ifdef __cplusplus 43c5c4113dSnw extern "C" { 44c5c4113dSnw #endif 45c5c4113dSnw 46c5c4113dSnw #define _IDMAP_HANDLE_RPC_DOORS 1 47c5c4113dSnw 48c5c4113dSnw #define _IDMAP_GET_CLIENT_HANDLE(h, clnt) \ 49c5c4113dSnw if (h == NULL) \ 50c5c4113dSnw return (IDMAP_ERR_CLIENT_HANDLE);\ 51c5c4113dSnw if (h->type != _IDMAP_HANDLE_RPC_DOORS) \ 52c5c4113dSnw return (IDMAP_ERR_NOTSUPPORTED);\ 53c5c4113dSnw clnt = (CLIENT *)h->privhandle;\ 54c5c4113dSnw if (clnt == NULL)\ 55c5c4113dSnw return (IDMAP_ERR_RPC_HANDLE); 56c5c4113dSnw 57c5c4113dSnw struct idmap_handle { 58c5c4113dSnw int type; 59c5c4113dSnw void *privhandle; 60c5c4113dSnw /* locks */ 61c5c4113dSnw }; 62c5c4113dSnw 63c5c4113dSnw struct idmap_udt_handle { 64c5c4113dSnw struct idmap_handle *ih; 65c5c4113dSnw idmap_update_batch batch; 66c5c4113dSnw uint64_t next; 678e228215Sdm int64_t error_index; 688e228215Sdm idmap_stat commit_stat; 698e228215Sdm idmap_namerule error_rule; 708e228215Sdm idmap_namerule conflict_rule; 71c5c4113dSnw }; 72c5c4113dSnw 73651c0131Sbaban #define _IDMAP_RESET_UDT_HANDLE(uh) \ 74651c0131Sbaban (void) xdr_free(xdr_idmap_update_batch, (caddr_t)&uh->batch);\ 758e228215Sdm uh->next = 0;\ 768e228215Sdm uh->error_index = -1;\ 778e228215Sdm (void) xdr_free(xdr_idmap_namerule, (caddr_t)&uh->error_rule);\ 788e228215Sdm (void) xdr_free(xdr_idmap_namerule, (caddr_t)&uh->conflict_rule); 79651c0131Sbaban 80c5c4113dSnw typedef struct idmap_get_res { 81c5c4113dSnw idmap_id_type idtype; 82c5c4113dSnw uid_t *uid; 83c5c4113dSnw gid_t *gid; 84c5c4113dSnw int *is_user; 85c5c4113dSnw char **sidprefix; 86c5c4113dSnw idmap_rid_t *rid; 87c5c4113dSnw idmap_stat *stat; 8848258c6bSjp idmap_info *info; 893ee87bcaSJulian Pullen int cache_res; 90c5c4113dSnw } idmap_get_res_t; 91c5c4113dSnw 92c5c4113dSnw struct idmap_get_handle { 93c5c4113dSnw struct idmap_handle *ih; 94c5c4113dSnw idmap_mapping_batch batch; 95c5c4113dSnw idmap_get_res_t *retlist; 96c5c4113dSnw uint64_t next; 97c5c4113dSnw }; 98c5c4113dSnw 99651c0131Sbaban #define _IDMAP_RESET_GET_HANDLE(gh) \ 100651c0131Sbaban (void) xdr_free(xdr_idmap_mapping_batch, (caddr_t)&gh->batch);\ 101651c0131Sbaban if (gh->retlist) \ 102651c0131Sbaban free(gh->retlist);\ 103651c0131Sbaban gh->retlist = NULL;\ 104651c0131Sbaban gh->next = 0; 105651c0131Sbaban 106c5c4113dSnw struct idmap_iter { 107c5c4113dSnw struct idmap_handle *ih; 108c5c4113dSnw int type; 109c5c4113dSnw uint64_t limit; 110c5c4113dSnw void *arg; 111c5c4113dSnw idmap_retcode retcode; 112c5c4113dSnw uint64_t lastrowid; 113c5c4113dSnw uint64_t next; 114c5c4113dSnw void *retlist; 115c5c4113dSnw }; 116c5c4113dSnw 117c5c4113dSnw typedef struct stat_table { 118c5c4113dSnw idmap_retcode retcode; 119c5c4113dSnw const char *msg; 120c5c4113dSnw int errnum; 121c5c4113dSnw } stat_table_t; 122c5c4113dSnw 123c5c4113dSnw typedef idmap_retcode _idmap_stat; 124c5c4113dSnw 125651c0131Sbaban extern idmap_retcode _udt_extend_batch(idmap_udt_handle_t *); 126c5c4113dSnw extern idmap_retcode _get_ids_extend_batch(idmap_get_handle_t *); 127c5c4113dSnw extern idmap_stat _iter_get_next_list(int, idmap_iter_t *, void *, 128c5c4113dSnw uchar_t **, size_t, xdrproc_t, xdrproc_t); 129651c0131Sbaban extern idmap_stat _idmap_rpc2stat(CLIENT *); 130c5c4113dSnw 131*c5866007SKeyur Desai extern idmap_logger_t logger; 132479ac375Sdm 133c5c4113dSnw #ifdef __cplusplus 134c5c4113dSnw } 135c5c4113dSnw #endif 136c5c4113dSnw 137c5c4113dSnw #endif /* _IDMAP_IMPL_H */ 138