config_parsing.c revision 004388ebfdfe2ed7dfd2d153a876dfcc22d2c006
/*
* 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 <stdio.h>
#include <errno.h>
#include <strings.h>
#include <locale.h>
#include <stdlib.h>
#include "cryptoutil.h"
static int uef_interpret(char *, uentry_t **);
static int parse_policylist(char *, uentry_t *);
/*
* Retrieve the user-level provider info from the pkcs11.conf file.
* If successful, the result is returned from the ppliblist argument.
* This function returns SUCCESS if successfully done; otherwise it returns
* FAILURE.
*/
int
{
return (FAILURE);
}
continue; /* ignore comment lines */
}
len--;
}
break;
}
/* append pent into ppliblist */
break;
}
} else {
}
}
}
return (rc);
}
/*
* This routine converts a char string into a uentry_t structure
* The input string "buf" should be one of the following:
* library_name
* library_name:NO_RANDOM
* library_name:disabledlist=m1,m2,...,mk
* library_name:disabledlist=m1,m2,...,mk;NO_RANDOM
* library_name:enabledlist=
* library_name:enabledlist=;NO_RANDOM
* library_name:enabledlist=m1,m2,...,mk
* library_name:enabledlist=m1,m2,...,mk;NO_RANDOM
* metaslot:status=enabled;enabledlist=m1,m2,....;slot=<slot-description>;\
* token=<token-label>
*
* Note:
* The mechanisms m1,..mk are in hex form. For example, "0x00000210"
* for CKM_MD5.
*
* For the metaslot entry, "enabledlist", "slot", "auto_key_migrate"
* or "token" is optional
*/
static int
{
char *token1;
char *token2;
char *lasts;
int rc;
/* buf is NULL */
return (FAILURE);
};
return (FAILURE);
}
/*
* in case metaslot_auto_key_migrate is not specified, it should
* be default to true
*/
return (rc);
}
}
return (SUCCESS);
}
/*
* This routine parses the policy list and stored the result in the argument
* pent.
*
* Arg buf: input only, its format should be one of the following:
* enabledlist=
* enabledlist=m1,m2,...,mk
* disabledlist=m1,m2,...,mk
* NO_RANDOM
* metaslot_status=enabled|disabled
* metaslot_token=<token-label>
* metaslot_slot=<slot-description.
*
*
* return: SUCCESS or FAILURE
*/
static int
{
char *next_token;
char *value;
char *lasts;
int count = 0;
return (FAILURE);
}
return (rc);
sizeof (METASLOT_TOKEN) - 1) == 0) {
value++; /* get rid of = */
return (SUCCESS);
} else {
return (FAILURE);
}
sizeof (METASLOT_SLOT) - 1) == 0) {
value++; /* get rid of = */
return (SUCCESS);
} else {
return (FAILURE);
}
sizeof (METASLOT_STATUS) - 1) == 0) {
value++; /* get rid of = */
} else {
return (FAILURE);
}
return (SUCCESS);
} else {
return (FAILURE);
}
sizeof (METASLOT_AUTO_KEY_MIGRATE) - 1) == 0) {
value++; /* get rid of = */
} else {
return (FAILURE);
}
return (SUCCESS);
} else {
return (FAILURE);
}
} else {
return (FAILURE);
}
value++; /* get rid of = */
}
if (pent->flag_enabledlist) {
return (SUCCESS);
} else {
return (FAILURE);
}
}
while (next_token) {
break;
}
} else {
}
count++;
}
} else {
}
return (rc);
}
/*
* Create one item of type umechlist_t with the mechanism name. A NULL is
* returned when the input name is NULL or the heap memory is insufficient.
*/
create_umech(char *name)
{
return (NULL);
}
}
return (pmech);
}
void
{
}
}
void
{
return;
} else {
}
}
void
{
}
}