idmap_api.c revision dd5829d1456ba00e6f704e6a88e7eaae608e3c1b
20c794b39650d115e17a15983b6b82e46238cf45gavinm * CDDL HEADER START
20c794b39650d115e17a15983b6b82e46238cf45gavinm * The contents of this file are subject to the terms of the
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Common Development and Distribution License (the "License").
20c794b39650d115e17a15983b6b82e46238cf45gavinm * You may not use this file except in compliance with the License.
20c794b39650d115e17a15983b6b82e46238cf45gavinm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
20c794b39650d115e17a15983b6b82e46238cf45gavinm * See the License for the specific language governing permissions
20c794b39650d115e17a15983b6b82e46238cf45gavinm * and limitations under the License.
20c794b39650d115e17a15983b6b82e46238cf45gavinm * When distributing Covered Code, include this CDDL HEADER in each
20c794b39650d115e17a15983b6b82e46238cf45gavinm * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
20c794b39650d115e17a15983b6b82e46238cf45gavinm * If applicable, add the following below this CDDL HEADER, with the
20c794b39650d115e17a15983b6b82e46238cf45gavinm * fields enclosed by brackets "[]" replaced with your own identifying
20c794b39650d115e17a15983b6b82e46238cf45gavinm * information: Portions Copyright [yyyy] [name of copyright owner]
20c794b39650d115e17a15983b6b82e46238cf45gavinm * CDDL HEADER END
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
b7d3956b92a285d8dac2c7f5f7e28d2ef5347ef8stephh * Use is subject to license terms.
20c794b39650d115e17a15983b6b82e46238cf45gavinm#pragma ident "%Z%%M% %I% %E% SMI"
20c794b39650d115e17a15983b6b82e46238cf45gavinm * libidmap API
20c794b39650d115e17a15983b6b82e46238cf45gavinm#define __ITER_ERR_RETURN(itera, argu, xdr_argu, iretcod)\
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Free memory allocated by libidmap API
20c794b39650d115e17a15983b6b82e46238cf45gavinm * ptr - memory to be freed
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Create and Initialize idmap client handle for rpc/doors
20c794b39650d115e17a15983b6b82e46238cf45gavinm * handle - idmap handle
20c794b39650d115e17a15983b6b82e46238cf45gavinm hptr = (struct idmap_handle *)calloc(1, sizeof (*hptr));
b7d3956b92a285d8dac2c7f5f7e28d2ef5347ef8stephh * Finalize idmap handle
b7d3956b92a285d8dac2c7f5f7e28d2ef5347ef8stephh * handle - idmap handle
20c794b39650d115e17a15983b6b82e46238cf45gavinm * Create/Initialize handle for updates
b7d3956b92a285d8dac2c7f5f7e28d2ef5347ef8stephh * udthandle - update handle
b7d3956b92a285d8dac2c7f5f7e28d2ef5347ef8stephhidmap_udt_create(idmap_handle_t *handle, idmap_udt_handle_t **udthandle) {
20c794b39650d115e17a15983b6b82e46238cf45gavinm * All the updates specified by the update handle are committed
20c794b39650d115e17a15983b6b82e46238cf45gavinm * in a single transaction. i.e either all succeed or none.
20c794b39650d115e17a15983b6b82e46238cf45gavinm * udthandle - update handle with the update requests
return (IDMAP_ERR_ARG);
TIMEOUT);
return (retcode);
goto errout;
if (windomain) {
goto errout;
if (winname) {
goto errout;
if (unixname) {
goto errout;
return (IDMAP_SUCCESS);
if (rule)
return (retcode);
goto errout;
if (windomain) {
goto errout;
if (winname) {
goto errout;
if (unixname) {
goto errout;
return (IDMAP_SUCCESS);
if (rule)
return (retcode);
goto errout;
return (IDMAP_SUCCESS);
return (retcode);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
if (windomain) {
goto errout;
if (winname) {
goto errout;
if (unixname) {
goto errout;
return (IDMAP_SUCCESS);
int *direction) {
if (windomain)
if (winname)
if (unixname)
if (is_nt4)
*is_nt4 = 0;
if (direction)
return (IDMAP_ERR_ARG);
return (retcode);
return (retcode);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
if (windomain) {
goto errout;
if (winname) {
goto errout;
if (unixname) {
goto errout;
if (is_nt4)
if (direction)
return (IDMAP_NEXT);
return (retcode);
return (IDMAP_SUCCESS);
char *str;
if (sidprefix)
if (rid)
if (winname)
if (windomain)
if (unixname)
if (pid)
if (direction)
return (IDMAP_ERR_ARG);
return (retcode);
return (retcode);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
if (sidprefix) {
goto errout;
if (rid)
if (winname) {
goto errout;
if (windomain) {
goto errout;
if (unixname) {
goto errout;
if (pid)
if (direction)
return (IDMAP_NEXT);
return (retcode);
case IDMAP_LIST_NAMERULES:
case IDMAP_LIST_MAPPINGS:
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_MEMORY);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_ARG);
goto errout;
goto errout;
return (IDMAP_SUCCESS);
if (mapping)
return (retcode);
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_ARG);
goto errout;
goto errout;
return (IDMAP_SUCCESS);
if (mapping)
return (retcode);
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_ARG);
goto errout;
goto errout;
return (IDMAP_SUCCESS);
if (mapping)
return (retcode);
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_ARG);
goto errout;
return (IDMAP_SUCCESS);
if (mapping)
return (retcode);
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_ARG);
goto errout;
return (IDMAP_SUCCESS);
if (mapping)
return (retcode);
return (IDMAP_ERR_ARG);
TIMEOUT);
goto out;
goto out;
case IDMAP_UID:
case IDMAP_GID:
case IDMAP_POSIXID:
case IDMAP_SID:
case IDMAP_NONE:
out:
return (retcode);
return (IDMAP_ERR_ARG);
if (is_user)
if (pid)
if (unixname)
if (direction)
} else if (winname) {
goto out;
if (windomain) {
return (retcode);
return (IDMAP_ERR_ARG);
else if (*is_user == 0)
TIMEOUT);
goto out;
goto out;
if (direction)
if (pid)
if (unixname) {
out:
return (retcode);
int *direction) {
return (IDMAP_ERR_ARG);
if (sidprefix)
if (winname)
if (windomain)
if (rid)
if (direction)
} else if (unixname) {
goto out;
return (IDMAP_ERR_ARG);
TIMEOUT);
goto out;
if (direction)
goto errout;
if (rid)
if (winname) {
goto errout;
if (windomain) {
goto errout;
goto out;
out:
return (retcode);
int len;
return (IDMAP_ERR_ARG);
if (outsize == 0) {
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
len++;
return (IDMAP_ERR_MEMORY);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
len++;
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_MEMORY);
return (IDMAP_SUCCESS);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_MEMORY);
return (IDMAP_SUCCESS);
#define gettext(s) s
return (EINVAL);
return (IDMAP_ERR_INTERNAL);
#define return_cmp(a) \
return (IDMAP_ERR_ ## a);
return (IDMAP_ERR_OTHER);
switch (status) {
case IDMAP_ERR_MEMORY:
case IDMAP_ERR_CACHE:
return (IDMAP_ERR_INTERNAL);
return (status);
int is_user;
return (IDMAP_ERR_ARG);
return (rc);
return (IDMAP_ERR_NOTUSER);
return (rc);
int is_user;
return (IDMAP_ERR_ARG);
return (rc);
return (IDMAP_ERR_NOTGROUP);
return (rc);
static idmap_retcode
int len;
return (IDMAP_ERR_ARG);
return (rc);
return (rc);
return (IDMAP_ERR_NORESULT);
return (rc);