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 decide that later. | 7 * stored so we can decide that later. |
8 */ | 8 */ |
9 #include "secport.h" | 9 #include "secport.h" |
10 #include "prprf.h" | 10 #include "prprf.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 /************************************************************************ | 421 /************************************************************************ |
422 * These functions are used in contructing strings. | 422 * These functions are used in contructing strings. |
423 * NOTE: they will always return a string, but sometimes it will return | 423 * NOTE: they will always return a string, but sometimes it will return |
424 * a specific NULL string. These strings must be freed with util_freePair. | 424 * a specific NULL string. These strings must be freed with util_freePair. |
425 */ | 425 */ |
426 | 426 |
427 /* string to return on error... */ | 427 /* string to return on error... */ |
428 static char *nssutil_nullString = ""; | 428 static char *nssutil_nullString = ""; |
429 | 429 |
430 static char * | 430 static char * |
431 nssutil_formatValue(PRArenaPool *arena, char *value, char quote) | 431 nssutil_formatValue(PLArenaPool *arena, char *value, char quote) |
432 { | 432 { |
433 char *vp,*vp2,*retval; | 433 char *vp,*vp2,*retval; |
434 int size = 0, escapes = 0; | 434 int size = 0, escapes = 0; |
435 | 435 |
436 for (vp=value; *vp ;vp++) { | 436 for (vp=value; *vp ;vp++) { |
437 if ((*vp == quote) || (*vp == NSSUTIL_ARG_ESCAPE)) escapes++; | 437 if ((*vp == quote) || (*vp == NSSUTIL_ARG_ESCAPE)) escapes++; |
438 size++; | 438 size++; |
439 } | 439 } |
440 if (arena) { | 440 if (arena) { |
441 retval = PORT_ArenaZAlloc(arena,size+escapes+1); | 441 retval = PORT_ArenaZAlloc(arena,size+escapes+1); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 slotInfo->defaultFlags |= PK11_OWN_PW_DEFAULTS; | 613 slotInfo->defaultFlags |= PK11_OWN_PW_DEFAULTS; |
614 } | 614 } |
615 slotInfo->hasRootCerts = NSSUTIL_ArgHasFlag("rootFlags", "hasRootCerts", | 615 slotInfo->hasRootCerts = NSSUTIL_ArgHasFlag("rootFlags", "hasRootCerts", |
616 params); | 616 params); |
617 slotInfo->hasRootTrust = NSSUTIL_ArgHasFlag("rootFlags", "hasRootTrust", | 617 slotInfo->hasRootTrust = NSSUTIL_ArgHasFlag("rootFlags", "hasRootTrust", |
618 params); | 618 params); |
619 } | 619 } |
620 | 620 |
621 /* parse all the slot specific parameters. */ | 621 /* parse all the slot specific parameters. */ |
622 struct NSSUTILPreSlotInfoStr * | 622 struct NSSUTILPreSlotInfoStr * |
623 NSSUTIL_ArgParseSlotInfo(PRArenaPool *arena, char *slotParams, int *retCount) | 623 NSSUTIL_ArgParseSlotInfo(PLArenaPool *arena, char *slotParams, int *retCount) |
624 { | 624 { |
625 char *slotIndex; | 625 char *slotIndex; |
626 struct NSSUTILPreSlotInfoStr *slotInfo = NULL; | 626 struct NSSUTILPreSlotInfoStr *slotInfo = NULL; |
627 int i=0,count = 0,next; | 627 int i=0,count = 0,next; |
628 | 628 |
629 *retCount = 0; | 629 *retCount = 0; |
630 if ((slotParams == NULL) || (*slotParams == 0)) return NULL; | 630 if ((slotParams == NULL) || (*slotParams == 0)) return NULL; |
631 | 631 |
632 /* first count the number of slots */ | 632 /* first count the number of slots */ |
633 for (slotIndex = NSSUTIL_ArgStrip(slotParams); *slotIndex; | 633 for (slotIndex = NSSUTIL_ArgStrip(slotParams); *slotIndex; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 value = PR_smprintf("%s" NSSUTIL_PATH_SEPARATOR "%s", | 1108 value = PR_smprintf("%s" NSSUTIL_PATH_SEPARATOR "%s", |
1109 lconfigdir,secmodName); | 1109 lconfigdir,secmodName); |
1110 } else { | 1110 } else { |
1111 value = PR_smprintf("%s",secmodName); | 1111 value = PR_smprintf("%s",secmodName); |
1112 } | 1112 } |
1113 if (configdir) PORT_Free(configdir); | 1113 if (configdir) PORT_Free(configdir); |
1114 return value; | 1114 return value; |
1115 } | 1115 } |
1116 | 1116 |
1117 | 1117 |
OLD | NEW |