listcert.c revision 5c51f1241dbbdf2656d0e10011981411ed0c9673
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <locale.h>
#include <libinst.h>
#include <pkglib.h>
#include <pkgerr.h>
#include <keystore.h>
#include "pkgadm.h"
#include "pkgadm_msgs.h"
/*
* Name: listcert
* Desc: Lists one or more certificates from the keystore
* Syntax: listcert [-a app] [-f format] [-k keystore] \
* [-n name] [-o outfile] [-P passarg] [-R altroot]
*/
int
{
int i;
char *keystore_base = NULL;
char *homedir;
char *format_str = NULL;
char *outfile_str = NULL;
int ret = 1;
switch (i) {
case 'a':
break;
case 'f':
format_str = optarg;
break;
case 'k':
break;
case 'n':
break;
case 'o':
break;
case 'P':
break;
case 'R':
break;
case ':':
/* fallthrough intentional */
case '?':
default:
goto cleanup;
}
}
/* should be no arguments left */
goto cleanup;
}
/* figure out format */
if (format_str == NULL) {
} else {
} else {
goto cleanup;
}
}
/* open output file */
if (outfile_str == NULL) {
outfile_str = "stdout";
} else {
goto cleanup;
}
}
/* set up proper keystore */
goto cleanup;
}
goto cleanup;
}
}
if (keystore_base == NULL) {
/*
* If we have an alternate
* root, then we have no choice but to use
* root's keystore on that alternate root,
* since there is no way to resolve a
* user's home dir given an alternate root
*/
MAXPATHLEN) >= MAXPATHLEN) {
goto cleanup;
}
} else {
/*
* not superuser, but no home dir, so
* use superuser's keystore
*/
MAXPATHLEN) >= MAXPATHLEN) {
goto cleanup;
}
} else {
MAXPATHLEN) >= MAXPATHLEN) {
homedir);
goto cleanup;
}
MAXPATHLEN) >= MAXPATHLEN) {
goto cleanup;
}
}
}
} else {
MAXPATHLEN) >= MAXPATHLEN) {
goto cleanup;
}
}
err = pkgerr_new();
/* now load the key store */
&keystore) != 0) {
goto cleanup;
}
/* list the certs */
goto cleanup;
}
/* now close it out */
goto cleanup;
}
/* everything worked */
ret = 0;
/* fallthrough intentional */
return (ret);
}