/*
* 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
*
*/
#include <stdio.h>
#include <strings.h>
#include <ctype.h>
#include <libgen.h>
#include <libintl.h>
#include <locale.h>
#include <kmfapiP.h>
#include "util.h"
/*
* The verbcmd construct allows genericizing information about a verb so
* that it is easier to manipulate. Makes parsing code easier to read,
* fix, and extend with new verbs.
*/
typedef struct verbcmd_s {
char *verb;
int (*action)(int, char *[]);
char *synopsis;
} verbcmd;
static int kc_help();
{ "list", kc_list,
"list [dbfile=dbfile] [policy=policyname]\n"
"\tlist plugin" },
"policy=policyname" },
{ "create", kc_create,
"create [dbfile=dbfile] policy=policyname\n"
"\t\t[ignore-date=true|false]\n"
"\t\t[ignore-unknown-eku=true|false]\n"
"\t\t[ignore-trust-anchor=true|false]\n"
"\t\t[validity-adjusttime=adjusttime]\n"
"\t\t[ta-name=trust anchor subject DN]\n"
"\t\t[ta-serial=trust anchor serial number]\n"
"\t\t[ocsp-responder=URL]\n"
"\t\t[ocsp-proxy=URL]\n"
"\t\t[ocsp-use-cert-responder=true|false]\n"
"\t\t[ocsp-response-lifetime=timelimit]\n"
"\t\t[ocsp-ignore-response-sign=true|false]\n"
"\t\t[ocsp-responder-cert-name=Issuer DN]\n"
"\t\t[ocsp-responder-cert-serial=serial number]\n"
"\t\t[crl-basefilename=basefilename]\n"
"\t\t[crl-directory=directory]\n"
"\t\t[crl-get-crl-uri=true|false]\n"
"\t\t[crl-proxy=URL]\n"
"\t\t[crl-ignore-crl-sign=true|false]\n"
"\t\t[crl-ignore-crl-date=true|false]\n"
"\t\t[keyusage=digitalSignature|nonRepudiation\n\t"
"\t\t|keyEncipherment | dataEncipherment |\n\t"
"\t\tkeyAgreement |keyCertSign |\n\t"
"\t\tcRLSign | encipherOnly | decipherOnly],[...]\n"
"\t\t[ekunames=serverAuth | clientAuth |\n\t"
"\t\tcodeSigning | emailProtection |\n\t"
"\t\tipsecEndSystem | ipsecTunnel |\n\t"
"\t\tipsecUser | timeStamping |\n\t"
"\t\tOCSPSigning],[...]\n"
"\t\t[ekuoids=OID,OID,OID...]\n"
"\t\t[mapper-name=name of mapper library]\n"
"\t\t[mapper-directory=dir where mapper library resides]\n"
"\t\t[mapper-path=full pathname of mapper library]\n"
"\t\t[mapper-options=mapper options]\n"},
{ "modify", kc_modify,
"modify [dbfile=dbfile] policy=policyname\n"
"\t\t[ignore-date=true|false]\n"
"\t\t[ignore-unknown-eku=true|false]\n"
"\t\t[ignore-trust-anchor=true|false]\n"
"\t\t[validity-adjusttime=adjusttime]\n"
"\t\t[ta-name=trust anchor subject DN | search]\n"
"\t\t[ta-serial=trust anchor serial number]\n"
"\t\t[ocsp-responder=URL]\n"
"\t\t[ocsp-proxy=URL]\n"
"\t\t[ocsp-use-cert-responder=true|false]\n"
"\t\t[ocsp-response-lifetime=timelimit]\n"
"\t\t[ocsp-ignore-response-sign=true|false]\n"
"\t\t[ocsp-responder-cert-name=Issuer DN]\n"
"\t\t[ocsp-responder-cert-serial=serial number]\n"
"\t\t[ocsp-none=true|false]\n"
"\t\t[crl-basefilename=basefilename]\n"
"\t\t[crl-directory=directory]\n"
"\t\t[crl-get-crl-uri=true|false]\n"
"\t\t[crl-proxy=URL]\n"
"\t\t[crl-ignore-crl-sign=true|false]\n"
"\t\t[crl-ignore-crl-date=true|false]\n"
"\t\t[crl-none=true|false]\n"
"\t\t[keyusage=digitalSignature|nonRepudiation\n\t"
"\t\t|keyEncipherment | dataEncipherment |\n\t"
"\t\tkeyAgreement |keyCertSign |\n\t"
"\t\tcRLSign | encipherOnly | decipherOnly],[...]\n"
"\t\t[keyusage-none=true|false]\n"
"\t\t[ekunames=serverAuth | clientAuth |\n\t"
"\t\tcodeSigning | emailProtection |\n\t"
"\t\tipsecEndSystem | ipsecTunnel |\n\t"
"\t\tipsecUser | timeStamping |\n\t"
"\t\tOCSPSigning],[...]\n"
"\t\t[ekuoids=OID,OID,OID...]\n"
"\t\t[eku-none=true|false]\n\n"
"\t\t[mapper-name=name of mapper library]\n"
"\t\t[mapper-directory=dir where mapper library resides]\n"
"\t\t[mapper-path=full pathname of mapper library]\n"
"\t\t[mapper-options=mapper options]\n"
"\tmodify plugin keystore=keystorename option=optionstring\n"},
"infile=inputdbfile\n" },
"outfile=newdbfile\n" },
"modulepath=path [option=optionstring]\n"},
};
static char *prog;
static void
usage(void)
{
int i;
/* Display this block only in command-line mode. */
/* Display only those verbs that match the current tool mode. */
for (i = 0; i < num_cmds; i++) {
}
}
static int
kc_help()
{
usage();
return (0);
}
int
{
int found;
int i;
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D. */
#endif
(void) textdomain(TEXT_DOMAIN);
if (argc == 0) {
usage();
exit(1);
}
switch (argv[0][1]) {
case '?':
return (kc_help());
default:
usage();
exit(1);
}
}
found = -1;
for (i = 0; i < num_cmds; i++) {
found = i;
break;
}
}
if (found < 0) {
argv[0]);
exit(1);
}
switch (ret) {
case KC_OK:
break;
case KC_ERR_USAGE:
break;
case KC_ERR_LOADDB:
gettext("Error loading database\n"));
break;
case KC_ERR_FIND_POLICY:
break;
case KC_ERR_DELETE_POLICY:
"from database.\n"));
break;
case KC_ERR_ADD_POLICY:
break;
case KC_ERR_VERIFY_POLICY:
break;
case KC_ERR_INCOMPLETE_POLICY:
break;
case KC_ERR_MEMORY:
break;
case KC_ERR_ACCESS:
break;
case KC_ERR_INSTALL:
break;
case KC_ERR_UNINSTALL:
break;
default:
break;
}
return (ret);
}