idmap_kapi.c revision 0b10de9fc92843e871f48de87f623808c5913a71
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Use is subject to license terms.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Windows to Solaris Identity Mapping kernel API
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * This module provides an API to map Windows SIDs to
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Solaris UID and GIDs.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#pragma ident "%Z%%M% %I% %E% SMI"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#endif /* DEBUG */
#include "idmap_prot.h"
#include "kidmap_priv.h"
typedef struct idmap_get_res {
int *is_user;
const char **sid_prefix;
struct idmap_get_handle {
int mapping_num;
int mapping_size;
static int idmap_stopped = 0;
struct idmap_reg {
int idmap_invalid;
int idmap_invalidated;
int idmap_ref;
if (idmap_ptr == p)
kmem_free(p, sizeof (*p));
if (idmap_stopped) {
return (EAGAIN);
return (EINVAL);
return (EINVAL);
int status = 0;
#ifdef DEBUG
if (status != 0)
return (status);
kidmap_start(void)
idmap_stopped = 0;
kidmap_stop(void)
return (EBUSY);
const char *new_sid_prefix;
return (IDMAP_ERR_ARG);
== IDMAP_SUCCESS)
return (IDMAP_SUCCESS);
return (status);
const char *new_sid_prefix;
return (IDMAP_ERR_ARG);
== IDMAP_SUCCESS) {
return (IDMAP_SUCCESS);
return (status);
int *is_user)
const char *new_sid_prefix;
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
*is_user = 0;
*is_user);
return (status);
return (IDMAP_ERR_ARG);
== IDMAP_SUCCESS) {
return (IDMAP_SUCCESS);
*rid = 0;
*rid = 0;
return (status);
return (IDMAP_ERR_ARG);
== IDMAP_SUCCESS) {
return (IDMAP_SUCCESS);
*rid = 0;
*rid = 0;
return (status);
kidmap_get_create(void)
return (handle);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_SUCCESS);
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
return (IDMAP_SUCCESS);
int status;
const char *sid_prefix;
int is_user;
return (IDMAP_ERR_ARG);
return (IDMAP_SUCCESS);
case IDMAP_UID:
case IDMAP_GID:
case IDMAP_SID:
return (status);
int status = 0;
int retry = 0;
#ifdef DEBUG
goto exit;
#ifdef DEBUG
goto exit;
retry++;
if (inbuf_ptr) {
if (outbuf_ptr) {
#ifdef DEBUG
goto exit;
goto retry;
goto exit;
goto exit;
#ifdef DEBUG
exit:
if (inbuf_ptr)
if (outbuf_ptr)
return (status);