idmap_config.c revision 651c0131ccc65381cbda174bee44a4fd7a518d6b
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * CDDL HEADER START
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * The contents of this file are subject to the terms of the
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * Common Development and Distribution License (the "License").
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * You may not use this file except in compliance with the License.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * See the License for the specific language governing permissions
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * and limitations under the License.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * When distributing Covered Code, include this CDDL HEADER in each
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * If applicable, add the following below this CDDL HEADER, with the
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * fields enclosed by brackets "[]" replaced with your own identifying
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * information: Portions Copyright [yyyy] [name of copyright owner]
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * CDDL HEADER END
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn * Use is subject to license terms.
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami#pragma ident "%Z%%M% %I% %E% SMI"
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami * Config routines common to idmap(1M) and idmapd(1M)
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn/* initial length of the array for policy options/attributes: */
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn/* Check if in the case of failure the original value of *val is preserved */
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnget_val_int(idmap_cfg_t *cfg, char *name, void *val, scf_type_t type)
37774979c2601819ef2cdb4ae1469d9111ccf52bgjelinek scf_property_t *scf_prop = scf_property_create(cfg->handles.main);
ff17c8bf86c3e567734be83f90267edee20f580fgjelinek scf_value_t *value = scf_value_create(cfg->handles.main);
c5cd6260c3d6c06a9359df595ad9dddbfd00a80e if (0 > scf_pg_get_property(cfg->handles.config_pg, name, scf_prop))
ff17c8bf86c3e567734be83f90267edee20f580fgjelinek /* this is OK: the property is just undefined */
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn /* It is still OK when a property doesn't have any value */
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn switch (type) {
case SCF_TYPE_INTEGER:
return (rc);
int length;
if (length < 0) {
goto destruction;
if (!buf) {
goto destruction;
rc = 0;
if (rc < 0) {
if (buf)
return (buf);
int rc = 0;
goto destruction;
goto destruction;
if (rc < 0) {
if (*val)
return (rc);
int rc = 0;
if (rc != 0)
if (rc != 0)
if (dname_size > 0) {
if (dname_size <= 0) {
if (rc != 0)
if (rc != 0)
if (rc != 0)
return (rc);
idmap_cfg_init() {
if (!cfg) {
return (NULL);
goto error;
goto error;
goto error;
goto error;
goto error;
return (cfg);
return (NULL);