/*
* 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"
/*
* routine to read configuration file
*
*/
#include "nscd_config.h"
#include "nscd_log.h"
#include <locale.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
static int
{
int i;
int inquote;
/* empty */
}
return (i);
inquote = 1;
switch (*qp) {
case '"':
break;
case '\\':
/* escape " */
qp++;
break;
case '\0':
if (inquote == 1) {
*qp = ' ';
i--;
}
break;
}
}
return (i);
}
char *filename,
{
int linecnt;
int fieldcnt;
nscd_cfg_handle_t *h = NULL;
void *data_p;
int i;
union {
int i;
} u;
gettext("open of configuration file \"%s\" failed: %s"),
return (NSCD_CFG_FILE_OPEN_ERROR);
}
linecnt = 0;
msg[0] = '\0';
linecnt++;
0 || *fields[0] == '#') {
/* skip blank or comment lines */
continue;
}
switch (fieldcnt) {
case 2:
break;
case 3:
break;
default:
for (i = 1; i < fieldcnt; i++) {
sizeof (u.data));
sizeof (u.data));
}
gettext("Syntax error: line %d of configuration "
break;
}
if (rc != NSCD_SUCCESS)
break;
if (rc != NSCD_SUCCESS)
break;
pdesc = _nscd_cfg_get_desc(h);
/* convert string to data */
if (rc != NSCD_SUCCESS)
break;
/* do preliminary check based on data type */
if (rc != NSCD_SUCCESS)
break;
h = NULL;
break;
else {
}
}
/* NSCD_CFG_READ_ONLY is not fatal */
if (rc == NSCD_CFG_READ_ONLY)
rc = NSCD_SUCCESS;
if (h != NULL)
}
return (rc);
}
char *filename,
{
char *nsscfg;
int syntax_err;
int linecnt;
nscd_cfg_handle_t *h = NULL;
void *data_p;
union {
int i;
} u;
gettext("open of configuration file \"%s\" failed: %s"),
return (NSCD_CFG_FILE_OPEN_ERROR);
}
linecnt = 0;
msg[0] = '\0';
linecnt++;
syntax_err = 0;
/* skip blank or comment lines */
continue;
/* skip end of line comment */
*ce = '\0';
else
*ce = '\0';
}
c1++;
syntax_err = 1;
else /* blank line */
continue;
} else {
/*
* data name goes before ':',
* skip spaces on both ends
*/
c2--;
c1++;
syntax_err = 1;
else {
/*
* nss config goes after ':',
* skip spaces on both ends
*/
c1++;
c2--;
/* no source specified, it's OK */
continue;
} else {
*dbe = '\0';
}
}
}
if (syntax_err == 1) {
gettext("Syntax error: line %d of configuration "
return (rc);
}
if (rc != NSCD_SUCCESS) {
/* ignore unsupported switch database */
if (rc == NSCD_CFG_UNSUPPORTED_SWITCH_DB) {
rc = NSCD_SUCCESS;
continue;
}
break;
}
pdesc = _nscd_cfg_get_desc(h);
/* convert string to data */
if (rc != NSCD_SUCCESS)
break;
/* do preliminary check based on data type */
if (rc != NSCD_SUCCESS)
break;
h = NULL;
break;
else {
}
}
/* NSCD_CFG_READ_ONLY is not fatal */
if (rc == NSCD_CFG_READ_ONLY)
rc = NSCD_SUCCESS;
if (h != NULL)
}
return (rc);
}