/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is the Netscape security libraries. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1994-2000 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. */ #include "modutil.h" #include "install.h" #include #include "secrng.h" #include "certdb.h" /* for CERT_DB_FILE_VERSION */ #include "nss.h" static void install_error(char *message); static char* PR_fgets(char *buf, int size, PRFileDesc *file); static char *progName; /* This enum must be kept in sync with the commandNames list */ typedef enum { NO_COMMAND, ADD_COMMAND, CHANGEPW_COMMAND, CREATE_COMMAND, DEFAULT_COMMAND, DELETE_COMMAND, DISABLE_COMMAND, ENABLE_COMMAND, FIPS_COMMAND, JAR_COMMAND, LIST_COMMAND, RAW_LIST_COMMAND, RAW_ADD_COMMAND, UNDEFAULT_COMMAND } Command; /* This list must be kept in sync with the Command enum */ static char *commandNames[] = { "(no command)", "-add", "-changepw", "-create", "-default", "-delete", "-disable", "-enable", "-fips", "-jar", "-list", "-rawlist", "-rawadd", "-undefault" }; /* this enum must be kept in sync with the optionStrings list */ typedef enum { ADD_ARG=0, RAW_ADD_ARG, CHANGEPW_ARG, CIPHERS_ARG, CREATE_ARG, DBDIR_ARG, DBPREFIX_ARG, DEFAULT_ARG, DELETE_ARG, DISABLE_ARG, ENABLE_ARG, FIPS_ARG, FORCE_ARG, JAR_ARG, LIBFILE_ARG, LIST_ARG, RAW_LIST_ARG, MECHANISMS_ARG, NEWPWFILE_ARG, PWFILE_ARG, SLOT_ARG, UNDEFAULT_ARG, INSTALLDIR_ARG, TEMPDIR_ARG, SECMOD_ARG, NOCERTDB_ARG, STRING_ARG, NUM_ARGS /* must be last */ } Arg; /* This list must be kept in sync with the Arg enum */ static char *optionStrings[] = { "-add", "-rawadd", "-changepw", "-ciphers", "-create", "-dbdir", "-dbprefix", "-default", "-delete", "-disable", "-enable", "-fips", "-force", "-jar", "-libfile", "-list", "-rawlist", "-mechanisms", "-newpwfile", "-pwfile", "-slot", "-undefault", "-installdir", "-tempdir", "-secmod", "-nocertdb", "-string", }; /* Increment i if doing so would have i still be less than j. If you are able to do this, return 0. Otherwise return 1. */ #define TRY_INC(i,j) ( ((i+1)