idmap_config.c revision c5c4113dfcabb1eed3d4bdf7609de5170027a794
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Config routines common to idmap(1M) and idmapd(1M)
*/
#include <stdlib.h>
#include <synch.h>
#include <assert.h>
#include <sys/systeminfo.h>
#include <strings.h>
#include <libintl.h>
#include <ctype.h>
#include <errno.h>
#include "idmap_config.h"
#include <stdio.h>
#include <stdarg.h>
#define CONFIG_PG "config"
#define GENERAL_PG "general"
#define IDMAP_CFG_DEBUG 0
/* initial length of the array for policy options/attributes: */
#define DEF_ARRAY_LENGTH 16
static char errmess_buf [1000] =
"Internal error: idmap configuration has not been initialized";
static void
{
/*LINTED: E_SEC_PRINTF_VAR_FMT*/
#if IDMAP_CFG_DEBUG
#endif
}
static void
idmap_error(char *format, ...)
{
}
static void
idmap_scf_error(char *format, ...)
{
const char *scf_message;
char *new_format;
char *sep;
new_format = (char *) malloc(sizeof (char) *
}
char *
idmap_cfg_error() {
return (errmess_buf);
}
/* Check if in the case of failure the original value of *val is preserved */
static int
{
int rc = 0;
/* this is OK: the property is just undefined */
goto destruction;
/* It is still OK when a property doesn't have any value */
goto destruction;
switch (type) {
case SCF_TYPE_BOOLEAN:
break;
case SCF_TYPE_COUNT:
break;
case SCF_TYPE_INTEGER:
break;
default:
type);
rc = -1;
break;
}
return (rc);
}
static char *
int rc = -1;
char buf_size = 127;
int length;
for (;;) {
if (length < 0) {
rc = -1;
goto destruction;
}
buf_size *= 2;
if (!buf) {
gettext("Not enough memory"));
rc = -1;
goto destruction;
}
} else {
rc = 0;
break;
}
}
if (rc < 0) {
if (buf)
}
return (buf);
}
static int
{
int rc = 0;
/* this is OK: the property is just undefined */
goto destruction;
rc = -1;
goto destruction;
}
rc = -1;
name);
}
if (rc < 0) {
if (*val)
}
return (rc);
}
int
{
int rc = 0;
return (-1);
}
return (-1);
}
if (rc != 0)
return (-1);
if (rc != 0)
return (-1);
/*
* TBD:
* If there is no mapping_domain in idmap's smf config then
* set it to the joined domain.
* Till domain join is implemented, temporarily set it to
* the system domain for testing purposes.
*/
char test[1];
if (dname_size > 0) {
(char *)malloc(dname_size * sizeof (char));
}
if (dname_size <= 0) {
gettext("Error obtaining the default domain"));
}
}
if (rc != 0)
return (-1);
if (rc != 0)
return (-1);
if (rc != 0)
return (-1);
return (rc);
}
idmap_cfg_init() {
/*
* The following initializes 'cfg'.
*/
/* First the smf repository handles: */
if (!cfg) {
return (NULL);
}
goto error;
}
goto error;
}
goto error;
}
NULL, /* scope */
NULL, /* prop */
goto error;
}
goto error;
}
return (cfg);
(void) idmap_cfg_fini(cfg);
return (NULL);
}
/* ARGSUSED */
static void
if (pgcfg->mapping_domain)
if (pgcfg->machine_sid)
if (pgcfg->global_catalog)
if (pgcfg->domain_controller)
}
int
{
return (0);
}