sidsys.c revision f48205be61a214698b763ff550ab9e657525104c
f48205be61a214698b763ff550ab9e657525104ccasper/*
f48205be61a214698b763ff550ab9e657525104ccasper * CDDL HEADER START
f48205be61a214698b763ff550ab9e657525104ccasper *
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 *
f48205be61a214698b763ff550ab9e657525104ccasper * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f48205be61a214698b763ff550ab9e657525104ccasper * or http://www.opensolaris.org/os/licensing.
f48205be61a214698b763ff550ab9e657525104ccasper * See the License for the specific language governing permissions
f48205be61a214698b763ff550ab9e657525104ccasper * and limitations under the License.
f48205be61a214698b763ff550ab9e657525104ccasper *
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 *
f48205be61a214698b763ff550ab9e657525104ccasper * CDDL HEADER END
f48205be61a214698b763ff550ab9e657525104ccasper */
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper/*
f48205be61a214698b763ff550ab9e657525104ccasper * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
f48205be61a214698b763ff550ab9e657525104ccasper * Use is subject to license terms.
f48205be61a214698b763ff550ab9e657525104ccasper */
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper#pragma ident "%Z%%M% %I% %E% SMI"
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper/*
f48205be61a214698b763ff550ab9e657525104ccasper * SID system call.
f48205be61a214698b763ff550ab9e657525104ccasper */
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper#include <sys/sid.h>
f48205be61a214698b763ff550ab9e657525104ccasper#include <sys/cred.h>
f48205be61a214698b763ff550ab9e657525104ccasper#include <sys/errno.h>
f48205be61a214698b763ff550ab9e657525104ccasper#include <sys/systm.h>
f48205be61a214698b763ff550ab9e657525104ccasper#include <sys/policy.h>
f48205be61a214698b763ff550ab9e657525104ccasper#include <sys/door.h>
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic kmutex_t idmap_mutex;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccaspertypedef struct idmap_reg {
f48205be61a214698b763ff550ab9e657525104ccasper door_handle_t idmap_door;
f48205be61a214698b763ff550ab9e657525104ccasper int idmap_flags;
f48205be61a214698b763ff550ab9e657525104ccasper int idmap_ref;
f48205be61a214698b763ff550ab9e657525104ccasper} idmap_reg_t;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic idmap_reg_t *idmap_ptr;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic int idmap_unreg_dh(door_handle_t);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic void
f48205be61a214698b763ff550ab9e657525104ccasperidmap_freeone(idmap_reg_t *p)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper ASSERT(p->idmap_ref == 0);
f48205be61a214698b763ff550ab9e657525104ccasper ASSERT(MUTEX_HELD(&idmap_mutex));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper door_ki_rele(p->idmap_door);
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_ptr == p)
f48205be61a214698b763ff550ab9e657525104ccasper idmap_ptr = NULL;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper kmem_free(p, sizeof (*p));
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic int
f48205be61a214698b763ff550ab9e657525104ccasperidmap_do_call(sidmap_call_t *callp, size_t callsz, void **resp, size_t *respsz)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper door_arg_t da;
f48205be61a214698b763ff550ab9e657525104ccasper idmap_reg_t *p;
f48205be61a214698b763ff550ab9e657525104ccasper int ret;
f48205be61a214698b763ff550ab9e657525104ccasper int dres;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper mutex_enter(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper p = idmap_ptr;
f48205be61a214698b763ff550ab9e657525104ccasper if (p != NULL) {
f48205be61a214698b763ff550ab9e657525104ccasper p->idmap_ref++;
f48205be61a214698b763ff550ab9e657525104ccasper } else {
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (-1);
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper da.data_ptr = (char *)callp;
f48205be61a214698b763ff550ab9e657525104ccasper da.data_size = callsz;
f48205be61a214698b763ff550ab9e657525104ccasper da.desc_ptr = NULL;
f48205be61a214698b763ff550ab9e657525104ccasper da.desc_num = 0;
f48205be61a214698b763ff550ab9e657525104ccasper da.rbuf = *resp;
f48205be61a214698b763ff550ab9e657525104ccasper da.rsize = *respsz;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper while ((dres = door_ki_upcall(p->idmap_door, &da)) != 0) {
f48205be61a214698b763ff550ab9e657525104ccasper switch (dres) {
f48205be61a214698b763ff550ab9e657525104ccasper case EINTR:
f48205be61a214698b763ff550ab9e657525104ccasper case EAGAIN:
f48205be61a214698b763ff550ab9e657525104ccasper delay(1);
f48205be61a214698b763ff550ab9e657525104ccasper continue;
f48205be61a214698b763ff550ab9e657525104ccasper case EINVAL:
f48205be61a214698b763ff550ab9e657525104ccasper case EBADF:
f48205be61a214698b763ff550ab9e657525104ccasper (void) idmap_unreg_dh(p->idmap_door);
f48205be61a214698b763ff550ab9e657525104ccasper /* FALLTHROUGH */
f48205be61a214698b763ff550ab9e657525104ccasper default:
f48205be61a214698b763ff550ab9e657525104ccasper ret = -1;
f48205be61a214698b763ff550ab9e657525104ccasper goto out;
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper *resp = da.rbuf;
f48205be61a214698b763ff550ab9e657525104ccasper *respsz = da.rsize;
f48205be61a214698b763ff550ab9e657525104ccasper ret = 0;
f48205be61a214698b763ff550ab9e657525104ccasperout:
f48205be61a214698b763ff550ab9e657525104ccasper mutex_enter(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper if (--p->idmap_ref == 0)
f48205be61a214698b763ff550ab9e657525104ccasper idmap_freeone(p);
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (ret);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper/*
f48205be61a214698b763ff550ab9e657525104ccasper * Current code only attempts to map ids to sids.
f48205be61a214698b763ff550ab9e657525104ccasper */
f48205be61a214698b763ff550ab9e657525104ccasperint
f48205be61a214698b763ff550ab9e657525104ccasperidmap_call_byid(uid_t id, ksid_t *ksid)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper sidmap_call_t call;
f48205be61a214698b763ff550ab9e657525104ccasper domsid_t res, *resp = &res;
f48205be61a214698b763ff550ab9e657525104ccasper size_t respsz = sizeof (res);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper call.sc_type = SIDSYS_ID2SID;
f48205be61a214698b763ff550ab9e657525104ccasper call.sc_val.sc_id = id;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_do_call(&call, sizeof (call), (void **)&resp, &respsz) != 0)
f48205be61a214698b763ff550ab9e657525104ccasper return (-1);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper ksid->ks_domain = ksid_lookupdomain(resp->ds_dom);
f48205be61a214698b763ff550ab9e657525104ccasper ksid->ks_rid = resp->ds_rid;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper /* Larger SID return value; this usually happens */
f48205be61a214698b763ff550ab9e657525104ccasper if (resp != &res)
f48205be61a214698b763ff550ab9e657525104ccasper kmem_free(resp, respsz);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperuid_t
f48205be61a214698b763ff550ab9e657525104ccasperidmap_call_bysid(ksid_t *ksid)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper ksiddomain_t *domp = ksid->ks_domain;
f48205be61a214698b763ff550ab9e657525104ccasper sidmap_call_t *callp;
f48205be61a214698b763ff550ab9e657525104ccasper uid_t res = (uid_t)-1;
f48205be61a214698b763ff550ab9e657525104ccasper uid_t *resp = &res;
f48205be61a214698b763ff550ab9e657525104ccasper size_t callsz;
f48205be61a214698b763ff550ab9e657525104ccasper size_t respsz = sizeof (res);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper callsz = sizeof (sidmap_call_t) + domp->kd_len;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper callp = kmem_alloc(callsz, KM_SLEEP);
f48205be61a214698b763ff550ab9e657525104ccasper callp->sc_type = SIDSYS_SID2ID;
f48205be61a214698b763ff550ab9e657525104ccasper bcopy(domp->kd_name, callp->sc_val.sc_sid.ds_dom, domp->kd_len);
f48205be61a214698b763ff550ab9e657525104ccasper callp->sc_val.sc_sid.ds_rid = ksid->ks_rid;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_do_call(callp, callsz, (void **)&resp, &respsz) != 0)
f48205be61a214698b763ff550ab9e657525104ccasper goto out;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper /* Should never happen; the original buffer should be large enough */
f48205be61a214698b763ff550ab9e657525104ccasper if (resp != &res) {
f48205be61a214698b763ff550ab9e657525104ccasper kmem_free(resp, respsz);
f48205be61a214698b763ff550ab9e657525104ccasper goto out;
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (respsz != sizeof (uid_t))
f48205be61a214698b763ff550ab9e657525104ccasper res = (uid_t)-1;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperout:
f48205be61a214698b763ff550ab9e657525104ccasper kmem_free(callp, callsz);
f48205be61a214698b763ff550ab9e657525104ccasper return (res);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic int
f48205be61a214698b763ff550ab9e657525104ccasperidmap_reg(int did)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper door_handle_t dh;
f48205be61a214698b763ff550ab9e657525104ccasper idmap_reg_t *idmp;
f48205be61a214698b763ff550ab9e657525104ccasper int err;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if ((err = secpolicy_idmap(CRED())) != 0)
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(err));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper dh = door_ki_lookup(did);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (dh == NULL)
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(EBADF));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper idmp = kmem_alloc(sizeof (*idmp), KM_SLEEP);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper idmp->idmap_door = dh;
f48205be61a214698b763ff550ab9e657525104ccasper mutex_enter(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_ptr != NULL) {
f48205be61a214698b763ff550ab9e657525104ccasper if (--idmap_ptr->idmap_ref == 0)
f48205be61a214698b763ff550ab9e657525104ccasper idmap_freeone(idmap_ptr);
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper idmp->idmap_flags = 0;
f48205be61a214698b763ff550ab9e657525104ccasper idmp->idmap_ref = 1;
f48205be61a214698b763ff550ab9e657525104ccasper idmap_ptr = idmp;
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic int
f48205be61a214698b763ff550ab9e657525104ccasperidmap_unreg_dh(door_handle_t dh)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper mutex_enter(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_ptr == NULL || idmap_ptr->idmap_door != dh) {
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (EINVAL);
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_ptr->idmap_flags != 0) {
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (EAGAIN);
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper idmap_ptr->idmap_flags = 1;
f48205be61a214698b763ff550ab9e657525104ccasper if (--idmap_ptr->idmap_ref == 0)
f48205be61a214698b763ff550ab9e657525104ccasper idmap_freeone(idmap_ptr);
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic int
f48205be61a214698b763ff550ab9e657525104ccasperidmap_unreg(int did)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper door_handle_t dh = door_ki_lookup(did);
f48205be61a214698b763ff550ab9e657525104ccasper int res;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (dh == NULL)
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(EINVAL));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper res = idmap_unreg_dh(dh);
f48205be61a214698b763ff550ab9e657525104ccasper door_ki_rele(dh);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (res != 0)
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(res));
f48205be61a214698b763ff550ab9e657525104ccasper return (0);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic boolean_t
f48205be61a214698b763ff550ab9e657525104ccasperits_my_door(void)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper mutex_enter(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper if (idmap_ptr != NULL) {
f48205be61a214698b763ff550ab9e657525104ccasper struct door_info info;
f48205be61a214698b763ff550ab9e657525104ccasper int err = door_ki_info(idmap_ptr->idmap_door, &info);
f48205be61a214698b763ff550ab9e657525104ccasper if (err == 0 && info.di_target == curproc->p_pid) {
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (B_TRUE);
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper mutex_exit(&idmap_mutex);
f48205be61a214698b763ff550ab9e657525104ccasper return (B_FALSE);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperstatic uint64_t
f48205be61a214698b763ff550ab9e657525104ccasperallocids(int flag, int nuids, int ngids)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper rval_t r;
f48205be61a214698b763ff550ab9e657525104ccasper uid_t su = 0;
f48205be61a214698b763ff550ab9e657525104ccasper gid_t sg = 0;
f48205be61a214698b763ff550ab9e657525104ccasper int err;
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (!its_my_door())
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(EPERM));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (nuids < 0 || ngids < 0)
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(EINVAL));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (flag != 0 || nuids > 0)
f48205be61a214698b763ff550ab9e657525104ccasper err = eph_uid_alloc(flag, &su, nuids);
f48205be61a214698b763ff550ab9e657525104ccasper if (err == 0 && (flag != 0 || ngids > 0))
f48205be61a214698b763ff550ab9e657525104ccasper err = eph_gid_alloc(flag, &sg, ngids);
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper if (err != 0)
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(EOVERFLOW));
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasper r.r_val1 = su;
f48205be61a214698b763ff550ab9e657525104ccasper r.r_val2 = sg;
f48205be61a214698b763ff550ab9e657525104ccasper return (r.r_vals);
f48205be61a214698b763ff550ab9e657525104ccasper}
f48205be61a214698b763ff550ab9e657525104ccasper
f48205be61a214698b763ff550ab9e657525104ccasperuint64_t
f48205be61a214698b763ff550ab9e657525104ccaspersidsys(int op, int flag, int nuids, int ngids)
f48205be61a214698b763ff550ab9e657525104ccasper{
f48205be61a214698b763ff550ab9e657525104ccasper switch (op) {
f48205be61a214698b763ff550ab9e657525104ccasper case SIDSYS_ALLOC_IDS:
f48205be61a214698b763ff550ab9e657525104ccasper return (allocids(flag, nuids, ngids));
f48205be61a214698b763ff550ab9e657525104ccasper case SIDSYS_IDMAP_REG:
f48205be61a214698b763ff550ab9e657525104ccasper return (idmap_reg(flag));
f48205be61a214698b763ff550ab9e657525104ccasper case SIDSYS_IDMAP_UNREG:
f48205be61a214698b763ff550ab9e657525104ccasper return (idmap_unreg(flag));
f48205be61a214698b763ff550ab9e657525104ccasper default:
f48205be61a214698b763ff550ab9e657525104ccasper return (set_errno(EINVAL));
f48205be61a214698b763ff550ab9e657525104ccasper }
f48205be61a214698b763ff550ab9e657525104ccasper}