uninstall.c revision 431deaa01ac039d796fdfaf86b909a75e7d9ac48
/*
* 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"
#include <stdio.h>
#include <strings.h>
#include <ctype.h>
#include <libgen.h>
#include <libintl.h>
#include <errno.h>
#include <kmfapiP.h>
#include <cryptoutil.h>
#include "util.h"
static int err; /* To store errno which may be overwritten by gettext() */
int
{
int opt;
extern int optind_av;
extern char *optarg_av;
char *keystore_name = NULL;
char tmpfile_name[MAXPATHLEN];
char buffer[MAXPATHLEN];
char buffer2[MAXPATHLEN];
switch (opt) {
case 'k':
if (keystore_name != NULL)
rv = KC_ERR_USAGE;
else {
if (keystore_name == NULL) {
"Error keystore input.\n"));
}
}
break;
default:
gettext("Error input option.\n"));
rv = KC_ERR_USAGE;
break;
}
goto out;
}
/* No additional args allowed. */
if (argc) {
gettext("Error input option\n"));
rv = KC_ERR_USAGE;
goto out;
}
if (keystore_name == NULL) {
gettext("Error input option\n"));
rv = KC_ERR_USAGE;
goto out;
}
gettext("Can not uninstall the built-in keystore %s\n"),
goto out;
}
rv = KC_ERR_USAGE;
goto out;
}
gettext("failed to update the configuration - %s\n"),
rv = KC_ERR_ACCESS;
goto out;
}
gettext("failed to lock the configuration - %s\n"),
goto out;
}
/*
*/
gettext("failed to create a temporary file - %s\n"),
goto out;
}
gettext("failed to open a temporary file - %s\n"),
goto out;
}
/*
* Loop thru the config file. If the plugin to be uninstalled is in
* a package, then just comment it off.
*/
buffer[0] != '\t') {
in_package = B_TRUE;
} else if (buffer[0] != '#') {
char *name;
int len;
/*
* make a copy of the original buffer to
* buffer2. Also get rid of the trailing
* '\n' from buffer2.
*/
/* get rid of trailing '\n' */
len--;
}
NULL) {
goto out;
}
}
}
if (found) {
/*
* If found and not in_package, then don't write
* this line to the result file.
*/
if (in_package) {
goto out;
}
}
} else {
goto out;
}
}
}
out:
(void) unlink(tmpfile_name);
"failed to update the configuration - %s"),
return (KC_ERR_UNINSTALL);
}
if (chmod(_PATH_KMF_CONF,
"failed to update the configuration - %s\n"),
return (KC_ERR_UNINSTALL);
}
}
return (rv);
}