security/nss/cmd/modutil/error.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef MODUTIL_ERROR_H
michael@0 6 #define MODUTIL_ERROR_H
michael@0 7
michael@0 8 /*
michael@0 9 * The values of these enumerated constants are immutable and must not be
michael@0 10 * changed.
michael@0 11 */
michael@0 12 typedef enum {
michael@0 13 NO_ERR=0,
michael@0 14 INVALID_USAGE_ERR,
michael@0 15 UNEXPECTED_ARG_ERR,
michael@0 16 UNKNOWN_OPTION_ERR,
michael@0 17 MULTIPLE_COMMAND_ERR,
michael@0 18 OPTION_NEEDS_ARG_ERR,
michael@0 19 DUPLICATE_OPTION_ERR,
michael@0 20 MISSING_PARAM_ERR,
michael@0 21 INVALID_FIPS_ARG,
michael@0 22 NO_COMMAND_ERR,
michael@0 23 NO_DBDIR_ERR,
michael@0 24 FIPS_SWITCH_FAILED_ERR,
michael@0 25 FIPS_ALREADY_ON_ERR,
michael@0 26 FIPS_ALREADY_OFF_ERR,
michael@0 27 FILE_ALREADY_EXISTS_ERR,
michael@0 28 FILE_DOESNT_EXIST_ERR,
michael@0 29 FILE_NOT_READABLE_ERR,
michael@0 30 FILE_NOT_WRITEABLE_ERR,
michael@0 31 DIR_DOESNT_EXIST_ERR,
michael@0 32 DIR_NOT_READABLE_ERR,
michael@0 33 DIR_NOT_WRITEABLE_ERR,
michael@0 34 INVALID_CONSTANT_ERR,
michael@0 35 ADD_MODULE_FAILED_ERR,
michael@0 36 UNUSED_ERR, /* reserved for future use */
michael@0 37 OUT_OF_MEM_ERR,
michael@0 38 DELETE_INTERNAL_ERR,
michael@0 39 DELETE_FAILED_ERR,
michael@0 40 NO_LIST_LOCK_ERR,
michael@0 41 NO_MODULE_LIST_ERR,
michael@0 42 NO_SUCH_MODULE_ERR,
michael@0 43 MOD_INFO_ERR,
michael@0 44 SLOT_INFO_ERR,
michael@0 45 TOKEN_INFO_ERR,
michael@0 46 NO_SUCH_TOKEN_ERR,
michael@0 47 CHANGEPW_FAILED_ERR,
michael@0 48 BAD_PW_ERR,
michael@0 49 DB_ACCESS_ERR,
michael@0 50 AUTHENTICATION_FAILED_ERR,
michael@0 51 NO_SUCH_SLOT_ERR,
michael@0 52 ENABLE_FAILED_ERR,
michael@0 53 UPDATE_MOD_FAILED_ERR,
michael@0 54 DEFAULT_FAILED_ERR,
michael@0 55 UNDEFAULT_FAILED_ERR,
michael@0 56 STDIN_READ_ERR,
michael@0 57 UNSPECIFIED_ERR,
michael@0 58 NOCERTDB_MISUSE_ERR,
michael@0 59 NSS_INITIALIZE_FAILED_ERR,
michael@0 60
michael@0 61 LAST_ERR /* must be last */
michael@0 62 } Error;
michael@0 63 #define SUCCESS NO_ERR
michael@0 64
michael@0 65 /* !!! Should move this into its own .c and un-static it. */
michael@0 66 static char *errStrings[] = {
michael@0 67 "Operation completed successfully.\n",
michael@0 68 "ERROR: Invalid command line.\n",
michael@0 69 "ERROR: Not expecting argument \"%s\".\n",
michael@0 70 "ERROR: Unknown option: %s.\n",
michael@0 71 "ERROR: %s: multiple commands are not allowed on the command line.\n",
michael@0 72 "ERROR: %s: option needs an argument.\n",
michael@0 73 "ERROR: %s: option cannot be given more than once.\n",
michael@0 74 "ERROR: Command \"%s\" requires parameter \"%s\".\n",
michael@0 75 "ERROR: Argument to -fips must be \"true\" or \"false\".\n",
michael@0 76 "ERROR: No command was specified.\n",
michael@0 77 "ERROR: Cannot determine database directory: use the -dbdir option.\n",
michael@0 78 "ERROR: Unable to switch FIPS modes.\n",
michael@0 79 "FIPS mode already enabled.\n",
michael@0 80 "FIPS mode already disabled.\n",
michael@0 81 "ERROR: File \"%s\" already exists.\n",
michael@0 82 "ERROR: File \"%s\" does not exist.\n",
michael@0 83 "ERROR: File \"%s\" is not readable.\n",
michael@0 84 "ERROR: File \"%s\" is not writeable.\n",
michael@0 85 "ERROR: Directory \"%s\" does not exist.\n",
michael@0 86 "ERROR: Directory \"%s\" is not readable.\n",
michael@0 87 "ERROR: Directory \"%s\" is not writeable.\n",
michael@0 88 "\"%s\" is not a recognized value.\n",
michael@0 89 "ERROR: Failed to add module \"%s\". Probable cause : \"%s\".\n",
michael@0 90 "Unused error string",
michael@0 91 "ERROR: Out of memory.\n",
michael@0 92 "ERROR: Cannot delete internal module.\n",
michael@0 93 "ERROR: Failed to delete module \"%s\".\n",
michael@0 94 "ERROR: Unable to obtain lock on module list.\n",
michael@0 95 "ERROR: Unable to obtain module list.\n",
michael@0 96 "ERROR: Module \"%s\" not found in database.\n",
michael@0 97 "ERROR: Unable to get information about module \"%s\".\n",
michael@0 98 "ERROR: Unable to get information about slot \"%s\".\n",
michael@0 99 "ERROR: Unable to get information about token \"%s\".\n",
michael@0 100 "ERROR: Token \"%s\" not found.\n",
michael@0 101 "ERROR: Unable to change password on token \"%s\".\n",
michael@0 102 "ERROR: Incorrect password.\n",
michael@0 103 "ERROR: Unable to access database \"%s\".\n",
michael@0 104 "ERROR: Unable to authenticate to token \"%s\".\n",
michael@0 105 "ERROR: Slot \"%s\" not found.\n",
michael@0 106 "ERROR: Failed to %s slot \"%s\".\n",
michael@0 107 "ERROR: Failed to update module \"%s\".\n",
michael@0 108 "ERROR: Failed to change defaults.\n",
michael@0 109 "ERROR: Failed to change default.\n",
michael@0 110 "ERROR: Unable to read from standard input.\n",
michael@0 111 "ERROR: Unknown error occurred.\n",
michael@0 112 "ERROR: -nocertdb option can only be used with the -jar command.\n"
michael@0 113 "ERROR: NSS_Initialize() failed.\n"
michael@0 114 };
michael@0 115
michael@0 116 typedef enum {
michael@0 117 FIPS_ENABLED_MSG=0,
michael@0 118 FIPS_DISABLED_MSG,
michael@0 119 USING_DBDIR_MSG,
michael@0 120 CREATING_DB_MSG,
michael@0 121 ADD_MODULE_SUCCESS_MSG,
michael@0 122 DELETE_SUCCESS_MSG,
michael@0 123 CHANGEPW_SUCCESS_MSG,
michael@0 124 BAD_PW_MSG,
michael@0 125 PW_MATCH_MSG,
michael@0 126 DONE_MSG,
michael@0 127 ENABLE_SUCCESS_MSG,
michael@0 128 DEFAULT_SUCCESS_MSG,
michael@0 129 UNDEFAULT_SUCCESS_MSG,
michael@0 130 BROWSER_RUNNING_MSG,
michael@0 131 ABORTING_MSG,
michael@0 132
michael@0 133 LAST_MSG /* must be last */
michael@0 134 } Message;
michael@0 135
michael@0 136 static char *msgStrings[] = {
michael@0 137 "FIPS mode enabled.\n",
michael@0 138 "FIPS mode disabled.\n",
michael@0 139 "Using database directory %s...\n",
michael@0 140 "Creating \"%s\"...",
michael@0 141 "Module \"%s\" added to database.\n",
michael@0 142 "Module \"%s\" deleted from database.\n",
michael@0 143 "Token \"%s\" password changed successfully.\n",
michael@0 144 "Incorrect password, try again...\n",
michael@0 145 "Passwords do not match, try again...\n",
michael@0 146 "done.\n",
michael@0 147 "Slot \"%s\" %s.\n",
michael@0 148 "Successfully changed defaults.\n",
michael@0 149 "Successfully changed defaults.\n",
michael@0 150 "\nWARNING: Performing this operation while the browser is running could cause"
michael@0 151 "\ncorruption of your security databases. If the browser is currently running,"
michael@0 152 "\nyou should exit browser before continuing this operation. Type "
michael@0 153 "\n'q <enter>' to abort, or <enter> to continue: ",
michael@0 154 "\nAborting...\n"
michael@0 155 };
michael@0 156
michael@0 157 #endif /* MODUTIL_ERROR_H */

mercurial