| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 /* | 4 /* |
| 5 * The following code handles the storage of PKCS 11 modules used by the | 5 * The following code handles the storage of PKCS 11 modules used by the |
| 6 * NSS. This file is written to abstract away how the modules are | 6 * NSS. This file is written to abstract away how the modules are |
| 7 * stored so we can deside that later. | 7 * stored so we can deside that later. |
| 8 */ | 8 */ |
| 9 #include "pkcs11i.h" | 9 #include "pkcs11i.h" |
| 10 #include "sdb.h" | 10 #include "sdb.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 parsed->pwRequired = NSSUTIL_ArgHasFlag("flags","passwordRequired",tmp); | 35 parsed->pwRequired = NSSUTIL_ArgHasFlag("flags","passwordRequired",tmp); |
| 36 parsed->optimizeSpace = NSSUTIL_ArgHasFlag("flags","optimizeSpace",tmp); | 36 parsed->optimizeSpace = NSSUTIL_ArgHasFlag("flags","optimizeSpace",tmp); |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 | 39 |
| 40 static CK_RV | 40 static CK_RV |
| 41 sftk_parseTokenParameters(char *param, sftk_token_parameters *parsed) | 41 sftk_parseTokenParameters(char *param, sftk_token_parameters *parsed) |
| 42 { | 42 { |
| 43 int next; | 43 int next; |
| 44 char *tmp = NULL; | 44 char *tmp = NULL; |
| 45 char *index; | 45 const char *index; |
| 46 index = NSSUTIL_ArgStrip(param); | 46 index = NSSUTIL_ArgStrip(param); |
| 47 | 47 |
| 48 while (*index) { | 48 while (*index) { |
| 49 NSSUTIL_HANDLE_STRING_ARG(index,parsed->configdir,"configDir=",;) | 49 NSSUTIL_HANDLE_STRING_ARG(index,parsed->configdir,"configDir=",;) |
| 50 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updatedir,"updateDir=",;) | 50 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updatedir,"updateDir=",;) |
| 51 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updCertPrefix, | 51 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updCertPrefix, |
| 52 "updateCertPrefix=",;) | 52 "updateCertPrefix=",;) |
| 53 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updKeyPrefix, | 53 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updKeyPrefix, |
| 54 "updateKeyPrefix=",;) | 54 "updateKeyPrefix=",;) |
| 55 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updateID,"updateID=",;) | 55 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updateID,"updateID=",;) |
| 56 NSSUTIL_HANDLE_STRING_ARG(index,parsed->certPrefix,"certPrefix=",;) | 56 NSSUTIL_HANDLE_STRING_ARG(index,parsed->certPrefix,"certPrefix=",;) |
| 57 NSSUTIL_HANDLE_STRING_ARG(index,parsed->keyPrefix,"keyPrefix=",;) | 57 NSSUTIL_HANDLE_STRING_ARG(index,parsed->keyPrefix,"keyPrefix=",;) |
| 58 NSSUTIL_HANDLE_STRING_ARG(index,parsed->tokdes,"tokenDescription=",;) | 58 NSSUTIL_HANDLE_STRING_ARG(index,parsed->tokdes,"tokenDescription=",;) |
| 59 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updtokdes, | 59 NSSUTIL_HANDLE_STRING_ARG(index,parsed->updtokdes, |
| 60 "updateTokenDescription=",;) | 60 "updateTokenDescription=",;) |
| 61 NSSUTIL_HANDLE_STRING_ARG(index,parsed->slotdes,"slotDescription=",;) | 61 NSSUTIL_HANDLE_STRING_ARG(index,parsed->slotdes,"slotDescription=",;) |
| 62 NSSUTIL_HANDLE_STRING_ARG(index,tmp,"minPWLen=", | 62 NSSUTIL_HANDLE_STRING_ARG(index,tmp,"minPWLen=", |
| 63 if(tmp) { parsed->minPW=atoi(tmp); PORT_Free(tmp); tmp = NULL; }) | 63 if(tmp) { parsed->minPW=atoi(tmp); PORT_Free(tmp); tmp = NULL; }) |
| 64 NSSUTIL_HANDLE_STRING_ARG(index,tmp,"flags=", | 64 NSSUTIL_HANDLE_STRING_ARG(index,tmp,"flags=", |
| 65 if(tmp) { sftk_parseTokenFlags(param,parsed); PORT_Free(tmp); | 65 if(tmp) { sftk_parseTokenFlags(param,parsed); PORT_Free(tmp); |
| 66 tmp = NULL; }) | 66 tmp = NULL; }) |
| 67 NSSUTIL_HANDLE_FINAL_ARG(index) | 67 NSSUTIL_HANDLE_FINAL_ARG(index) |
| 68 } | 68 } |
| 69 return CKR_OK; | 69 return CKR_OK; |
| 70 } | 70 } |
| 71 | 71 |
| 72 static void | 72 static void |
| 73 sftk_parseTokens(char *tokenParams, sftk_parameters *parsed) | 73 sftk_parseTokens(char *tokenParams, sftk_parameters *parsed) |
| 74 { | 74 { |
| 75 char *tokenIndex; | 75 const char *tokenIndex; |
| 76 sftk_token_parameters *tokens = NULL; | 76 sftk_token_parameters *tokens = NULL; |
| 77 int i=0,count = 0,next; | 77 int i=0,count = 0,next; |
| 78 | 78 |
| 79 if ((tokenParams == NULL) || (*tokenParams == 0)) return; | 79 if ((tokenParams == NULL) || (*tokenParams == 0)) return; |
| 80 | 80 |
| 81 /* first count the number of slots */ | 81 /* first count the number of slots */ |
| 82 for (tokenIndex = NSSUTIL_ArgStrip(tokenParams); *tokenIndex; | 82 for (tokenIndex = NSSUTIL_ArgStrip(tokenParams); *tokenIndex; |
| 83 tokenIndex = NSSUTIL_ArgStrip(NSSUTIL_ArgSkipParameter(tokenIndex))) { | 83 tokenIndex = NSSUTIL_ArgStrip(NSSUTIL_ArgSkipParameter(tokenIndex))) { |
| 84 count++; | 84 count++; |
| 85 } | 85 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 parsed->token_count = i; | 113 parsed->token_count = i; |
| 114 parsed->tokens = tokens; | 114 parsed->tokens = tokens; |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 CK_RV | 118 CK_RV |
| 119 sftk_parseParameters(char *param, sftk_parameters *parsed, PRBool isFIPS) | 119 sftk_parseParameters(char *param, sftk_parameters *parsed, PRBool isFIPS) |
| 120 { | 120 { |
| 121 int next; | 121 int next; |
| 122 char *tmp = NULL; | 122 char *tmp = NULL; |
| 123 char *index; | 123 const char *index; |
| 124 char *certPrefix = NULL, *keyPrefix = NULL; | 124 char *certPrefix = NULL, *keyPrefix = NULL; |
| 125 char *tokdes = NULL, *ptokdes = NULL, *pupdtokdes = NULL; | 125 char *tokdes = NULL, *ptokdes = NULL, *pupdtokdes = NULL; |
| 126 char *slotdes = NULL, *pslotdes = NULL; | 126 char *slotdes = NULL, *pslotdes = NULL; |
| 127 char *fslotdes = NULL, *ftokdes = NULL; | 127 char *fslotdes = NULL, *ftokdes = NULL; |
| 128 char *minPW = NULL; | 128 char *minPW = NULL; |
| 129 index = NSSUTIL_ArgStrip(param); | 129 index = NSSUTIL_ArgStrip(param); |
| 130 | 130 |
| 131 PORT_Memset(parsed, 0, sizeof(sftk_parameters)); | 131 PORT_Memset(parsed, 0, sizeof(sftk_parameters)); |
| 132 | 132 |
| 133 while (*index) { | 133 while (*index) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 FREE_CLEAR(params->configdir); | 240 FREE_CLEAR(params->configdir); |
| 241 FREE_CLEAR(params->secmodName); | 241 FREE_CLEAR(params->secmodName); |
| 242 FREE_CLEAR(params->man); | 242 FREE_CLEAR(params->man); |
| 243 FREE_CLEAR(params->libdes); | 243 FREE_CLEAR(params->libdes); |
| 244 FREE_CLEAR(params->tokens); | 244 FREE_CLEAR(params->tokens); |
| 245 FREE_CLEAR(params->updatedir); | 245 FREE_CLEAR(params->updatedir); |
| 246 FREE_CLEAR(params->updateID); | 246 FREE_CLEAR(params->updateID); |
| 247 } | 247 } |
| 248 | 248 |
| OLD | NEW |