sidsys.c revision f48205be61a214698b763ff550ab9e657525104c
f48205be61a214698b763ff550ab9e657525104ccasper * CDDL HEADER START
f48205be61a214698b763ff550ab9e657525104ccasper * The contents of this file are subject to the terms of the
f48205be61a214698b763ff550ab9e657525104ccasper * Common Development and Distribution License (the "License").
f48205be61a214698b763ff550ab9e657525104ccasper * You may not use this file except in compliance with the License.
f48205be61a214698b763ff550ab9e657525104ccasper * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f48205be61a214698b763ff550ab9e657525104ccasper * See the License for the specific language governing permissions
f48205be61a214698b763ff550ab9e657525104ccasper * and limitations under the License.
f48205be61a214698b763ff550ab9e657525104ccasper * When distributing Covered Code, include this CDDL HEADER in each
f48205be61a214698b763ff550ab9e657525104ccasper * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f48205be61a214698b763ff550ab9e657525104ccasper * If applicable, add the following below this CDDL HEADER, with the
f48205be61a214698b763ff550ab9e657525104ccasper * fields enclosed by brackets "[]" replaced with your own identifying
f48205be61a214698b763ff550ab9e657525104ccasper * information: Portions Copyright [yyyy] [name of copyright owner]
f48205be61a214698b763ff550ab9e657525104ccasper * CDDL HEADER END
f48205be61a214698b763ff550ab9e657525104ccasper * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
f48205be61a214698b763ff550ab9e657525104ccasper * Use is subject to license terms.
f48205be61a214698b763ff550ab9e657525104ccasper#pragma ident "%Z%%M% %I% %E% SMI"
f48205be61a214698b763ff550ab9e657525104ccasper * SID system call.
f48205be61a214698b763ff550ab9e657525104ccaspertypedef struct idmap_reg {
f48205be61a214698b763ff550ab9e657525104ccasper kmem_free(p, sizeof (*p));
f48205be61a214698b763ff550ab9e657525104ccasperidmap_do_call(sidmap_call_t *callp, size_t callsz, void **resp, size_t *respsz)
f48205be61a214698b763ff550ab9e657525104ccasper if (p != NULL) {
f48205be61a214698b763ff550ab9e657525104ccasper return (-1);
f48205be61a214698b763ff550ab9e657525104ccasper while ((dres = door_ki_upcall(p->idmap_door, &da)) != 0) {
f48205be61a214698b763ff550ab9e657525104ccasper /* FALLTHROUGH */
f48205be61a214698b763ff550ab9e657525104ccasper if (--p->idmap_ref == 0)
f48205be61a214698b763ff550ab9e657525104ccasper * Current code only attempts to map ids to sids.
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_do_call(&call, sizeof (call), (void **)&resp, &respsz) != 0)
f48205be61a214698b763ff550ab9e657525104ccasper return (-1);
f48205be61a214698b763ff550ab9e657525104ccasper /* Larger SID return value; this usually happens */
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper bcopy(domp->kd_name, callp->sc_val.sc_sid.ds_dom, domp->kd_len);
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_do_call(callp, callsz, (void **)&resp, &respsz) != 0)
f48205be61a214698b763ff550ab9e657525104ccasper /* Should never happen; the original buffer should be large enough */
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_ptr == NULL || idmap_ptr->idmap_door != dh) {
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper int err = door_ki_info(idmap_ptr->idmap_door, &info);
f48205be61a214698b763ff550ab9e657525104ccasper return (r.r_vals);
f48205be61a214698b763ff550ab9e657525104ccasper switch (op) {