nscd_nswcfgst.c revision cb5caa98562cf06753163f558cbcfe30b8f4673a
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <locale.h>
#include <string.h>
#include "nscd_config.h"
#include "nscd_log.h"
#include "nscd_switch.h"
/*
* Configuration data for the nscd switch functions.
*/
/*
* statistics of the nscd switch functions.
*/
/*
* cookie is set up by the verify function for passing to
* the notify function
*/
typedef struct {
struct __nsw_switchconfig_v1 *cfg;
char *cfgstr;
{
if (nscd_switch_cfg == NULL)
return (NSCD_NO_MEMORY);
return (NSCD_SUCCESS);
}
{
sizeof (nscd_cfg_stat_switch_t));
if (nscd_switch_stats == NULL)
return (NSCD_NO_MEMORY);
return (NSCD_SUCCESS);
}
/* ARGSUSED */
void *data,
struct nscd_cfg_param_desc *pdesc,
void *cookie)
{
void *dp;
/*
* group data is received, copy in the
* entire strcture
*/
} else {
*(nscd_cfg_switch_t *)data;
}
} else {
/*
* individual paramater is received: copy in the
* parameter value except for nsw-config-string.
*/
} else {
}
}
/*
* cookie contains data for the switch policy config
*/
if (rc != NSCD_SUCCESS) {
return (rc);
}
}
return (NSCD_SUCCESS);
}
/* ARGSUSED */
void *data,
struct nscd_cfg_param_desc *pdesc,
void **cookie)
{
char *me = "_nscd_cfg_switch_verify";
char *nswcfgstr;
int size;
enum __nsw_parse_err err;
char buf[MAX_NSSWITCH_CONFIG_STRING_SZ];
char msg[NSCD_CFG_MAX_ERR_MSG_LEN];
/*
* global config data has nothing special to verify
*/
return (NSCD_SUCCESS);
/*
* switch policy string is the one to parse and verify
*/
/* get it from the group data */
} else {
/* not group, and not the switch policy string, return */
return (NSCD_SUCCESS);
/* the data itself is the string */
}
/*
* convert the string into struct __nsw_switchconfig_v1
*/
gettext("switch policy string too long (\"%s : %s\" > %d)"),
if (*errorp)
return (NSCD_CFG_SYNTAX_ERROR);
}
gettext("syntax error: switch policy string (%s : %s) rc = %d"),
if (*errorp)
return (NSCD_CFG_SYNTAX_ERROR);
}
/* save the __nsw_switchconfig_v1 for the notify function */
(void) __nsw_freeconfig_v1(switchcfg);
return (NSCD_CFG_SYNTAX_ERROR);
}
return (NSCD_SUCCESS);
}
/* ARGSUSED */
void **stat,
struct nscd_cfg_stat_desc *sdesc,
{
*stat = &NSCD_SW_STATS_G;
} else
/* indicate the statistics are static, i.e., do not free */
return (NSCD_SUCCESS);
}