1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/cmd/modutil/error.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,157 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef MODUTIL_ERROR_H 1.9 +#define MODUTIL_ERROR_H 1.10 + 1.11 +/* 1.12 + * The values of these enumerated constants are immutable and must not be 1.13 + * changed. 1.14 + */ 1.15 +typedef enum { 1.16 + NO_ERR=0, 1.17 + INVALID_USAGE_ERR, 1.18 + UNEXPECTED_ARG_ERR, 1.19 + UNKNOWN_OPTION_ERR, 1.20 + MULTIPLE_COMMAND_ERR, 1.21 + OPTION_NEEDS_ARG_ERR, 1.22 + DUPLICATE_OPTION_ERR, 1.23 + MISSING_PARAM_ERR, 1.24 + INVALID_FIPS_ARG, 1.25 + NO_COMMAND_ERR, 1.26 + NO_DBDIR_ERR, 1.27 + FIPS_SWITCH_FAILED_ERR, 1.28 + FIPS_ALREADY_ON_ERR, 1.29 + FIPS_ALREADY_OFF_ERR, 1.30 + FILE_ALREADY_EXISTS_ERR, 1.31 + FILE_DOESNT_EXIST_ERR, 1.32 + FILE_NOT_READABLE_ERR, 1.33 + FILE_NOT_WRITEABLE_ERR, 1.34 + DIR_DOESNT_EXIST_ERR, 1.35 + DIR_NOT_READABLE_ERR, 1.36 + DIR_NOT_WRITEABLE_ERR, 1.37 + INVALID_CONSTANT_ERR, 1.38 + ADD_MODULE_FAILED_ERR, 1.39 + UNUSED_ERR, /* reserved for future use */ 1.40 + OUT_OF_MEM_ERR, 1.41 + DELETE_INTERNAL_ERR, 1.42 + DELETE_FAILED_ERR, 1.43 + NO_LIST_LOCK_ERR, 1.44 + NO_MODULE_LIST_ERR, 1.45 + NO_SUCH_MODULE_ERR, 1.46 + MOD_INFO_ERR, 1.47 + SLOT_INFO_ERR, 1.48 + TOKEN_INFO_ERR, 1.49 + NO_SUCH_TOKEN_ERR, 1.50 + CHANGEPW_FAILED_ERR, 1.51 + BAD_PW_ERR, 1.52 + DB_ACCESS_ERR, 1.53 + AUTHENTICATION_FAILED_ERR, 1.54 + NO_SUCH_SLOT_ERR, 1.55 + ENABLE_FAILED_ERR, 1.56 + UPDATE_MOD_FAILED_ERR, 1.57 + DEFAULT_FAILED_ERR, 1.58 + UNDEFAULT_FAILED_ERR, 1.59 + STDIN_READ_ERR, 1.60 + UNSPECIFIED_ERR, 1.61 + NOCERTDB_MISUSE_ERR, 1.62 + NSS_INITIALIZE_FAILED_ERR, 1.63 + 1.64 + LAST_ERR /* must be last */ 1.65 +} Error; 1.66 +#define SUCCESS NO_ERR 1.67 + 1.68 +/* !!! Should move this into its own .c and un-static it. */ 1.69 +static char *errStrings[] = { 1.70 + "Operation completed successfully.\n", 1.71 + "ERROR: Invalid command line.\n", 1.72 + "ERROR: Not expecting argument \"%s\".\n", 1.73 + "ERROR: Unknown option: %s.\n", 1.74 + "ERROR: %s: multiple commands are not allowed on the command line.\n", 1.75 + "ERROR: %s: option needs an argument.\n", 1.76 + "ERROR: %s: option cannot be given more than once.\n", 1.77 + "ERROR: Command \"%s\" requires parameter \"%s\".\n", 1.78 + "ERROR: Argument to -fips must be \"true\" or \"false\".\n", 1.79 + "ERROR: No command was specified.\n", 1.80 + "ERROR: Cannot determine database directory: use the -dbdir option.\n", 1.81 + "ERROR: Unable to switch FIPS modes.\n", 1.82 + "FIPS mode already enabled.\n", 1.83 + "FIPS mode already disabled.\n", 1.84 + "ERROR: File \"%s\" already exists.\n", 1.85 + "ERROR: File \"%s\" does not exist.\n", 1.86 + "ERROR: File \"%s\" is not readable.\n", 1.87 + "ERROR: File \"%s\" is not writeable.\n", 1.88 + "ERROR: Directory \"%s\" does not exist.\n", 1.89 + "ERROR: Directory \"%s\" is not readable.\n", 1.90 + "ERROR: Directory \"%s\" is not writeable.\n", 1.91 + "\"%s\" is not a recognized value.\n", 1.92 + "ERROR: Failed to add module \"%s\". Probable cause : \"%s\".\n", 1.93 + "Unused error string", 1.94 + "ERROR: Out of memory.\n", 1.95 + "ERROR: Cannot delete internal module.\n", 1.96 + "ERROR: Failed to delete module \"%s\".\n", 1.97 + "ERROR: Unable to obtain lock on module list.\n", 1.98 + "ERROR: Unable to obtain module list.\n", 1.99 + "ERROR: Module \"%s\" not found in database.\n", 1.100 + "ERROR: Unable to get information about module \"%s\".\n", 1.101 + "ERROR: Unable to get information about slot \"%s\".\n", 1.102 + "ERROR: Unable to get information about token \"%s\".\n", 1.103 + "ERROR: Token \"%s\" not found.\n", 1.104 + "ERROR: Unable to change password on token \"%s\".\n", 1.105 + "ERROR: Incorrect password.\n", 1.106 + "ERROR: Unable to access database \"%s\".\n", 1.107 + "ERROR: Unable to authenticate to token \"%s\".\n", 1.108 + "ERROR: Slot \"%s\" not found.\n", 1.109 + "ERROR: Failed to %s slot \"%s\".\n", 1.110 + "ERROR: Failed to update module \"%s\".\n", 1.111 + "ERROR: Failed to change defaults.\n", 1.112 + "ERROR: Failed to change default.\n", 1.113 + "ERROR: Unable to read from standard input.\n", 1.114 + "ERROR: Unknown error occurred.\n", 1.115 + "ERROR: -nocertdb option can only be used with the -jar command.\n" 1.116 + "ERROR: NSS_Initialize() failed.\n" 1.117 +}; 1.118 + 1.119 +typedef enum { 1.120 + FIPS_ENABLED_MSG=0, 1.121 + FIPS_DISABLED_MSG, 1.122 + USING_DBDIR_MSG, 1.123 + CREATING_DB_MSG, 1.124 + ADD_MODULE_SUCCESS_MSG, 1.125 + DELETE_SUCCESS_MSG, 1.126 + CHANGEPW_SUCCESS_MSG, 1.127 + BAD_PW_MSG, 1.128 + PW_MATCH_MSG, 1.129 + DONE_MSG, 1.130 + ENABLE_SUCCESS_MSG, 1.131 + DEFAULT_SUCCESS_MSG, 1.132 + UNDEFAULT_SUCCESS_MSG, 1.133 + BROWSER_RUNNING_MSG, 1.134 + ABORTING_MSG, 1.135 + 1.136 + LAST_MSG /* must be last */ 1.137 +} Message; 1.138 + 1.139 +static char *msgStrings[] = { 1.140 + "FIPS mode enabled.\n", 1.141 + "FIPS mode disabled.\n", 1.142 + "Using database directory %s...\n", 1.143 + "Creating \"%s\"...", 1.144 + "Module \"%s\" added to database.\n", 1.145 + "Module \"%s\" deleted from database.\n", 1.146 + "Token \"%s\" password changed successfully.\n", 1.147 + "Incorrect password, try again...\n", 1.148 + "Passwords do not match, try again...\n", 1.149 + "done.\n", 1.150 + "Slot \"%s\" %s.\n", 1.151 + "Successfully changed defaults.\n", 1.152 + "Successfully changed defaults.\n", 1.153 +"\nWARNING: Performing this operation while the browser is running could cause" 1.154 +"\ncorruption of your security databases. If the browser is currently running," 1.155 +"\nyou should exit browser before continuing this operation. Type " 1.156 +"\n'q <enter>' to abort, or <enter> to continue: ", 1.157 + "\nAborting...\n" 1.158 +}; 1.159 + 1.160 +#endif /* MODUTIL_ERROR_H */