Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1131)

Side by Side Diff: nss/lib/util/utilmod.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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. For the rest of NSS, only one kind of database handle exists: 6 * NSS. For the rest of NSS, only one kind of database handle exists:
7 * 7 *
8 * SFTKDBHandle 8 * SFTKDBHandle
9 * 9 *
10 * There is one SFTKDBHandle for each key database and one for each cert 10 * There is one SFTKDBHandle for each key database and one for each cert
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 * nss="NSS parameters" 68 * nss="NSS parameters"
69 * other="parameters for other libraries and applications" 69 * other="parameters for other libraries and applications"
70 * 70 *
71 * library=libmynextpk11.so 71 * library=libmynextpk11.so
72 * name="My other PKCS#11 module" 72 * name="My other PKCS#11 module"
73 */ 73 */
74 74
75 75
76 /* 76 /*
77 * Smart string cat functions. Automatically manage the memory. 77 * Smart string cat functions. Automatically manage the memory.
78 * The first parameter is the source string. If it's null, we 78 * The first parameter is the destination string. If it's null, we
79 * allocate memory for it. If it's not, we reallocate memory 79 * allocate memory for it. If it's not, we reallocate memory
80 * so the the concanenated string fits. 80 * so the the concanenated string fits.
81 */ 81 */
82 static char * 82 static char *
83 nssutil_DupnCat(char *baseString, const char *str, int str_len) 83 nssutil_DupnCat(char *baseString, const char *str, int str_len)
84 { 84 {
85 int len = (baseString ? PORT_Strlen(baseString) : 0) + 1; 85 int baseStringLen = baseString ? PORT_Strlen(baseString) : 0;
86 int len = baseStringLen + 1;
86 char *newString; 87 char *newString;
87 88
88 len += str_len; 89 len += str_len;
89 newString = (char *) PORT_Realloc(baseString,len); 90 newString = (char *) PORT_Realloc(baseString,len);
90 if (newString == NULL) { 91 if (newString == NULL) {
91 PORT_Free(baseString); 92 PORT_Free(baseString);
92 return NULL; 93 return NULL;
93 } 94 }
94 if (baseString == NULL) *newString = 0; 95 PORT_Memcpy(&newString[baseStringLen], str, str_len);
95 return PORT_Strncat(newString,str, str_len); 96 newString[len - 1] = 0;
97 return newString;
96 } 98 }
97 99
98 /* Same as nssutil_DupnCat except it concatenates the full string, not a 100 /* Same as nssutil_DupnCat except it concatenates the full string, not a
99 * partial one */ 101 * partial one */
100 static char * 102 static char *
101 nssutil_DupCat(char *baseString, const char *str) 103 nssutil_DupCat(char *baseString, const char *str)
102 { 104 {
103 return nssutil_DupnCat(baseString, str, PORT_Strlen(str)); 105 return nssutil_DupnCat(baseString, str, PORT_Strlen(str));
104 } 106 }
105 107
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 /* SHDB_FIXME implement */ 475 /* SHDB_FIXME implement */
474 os_stat_type stat_existing; 476 os_stat_type stat_existing;
475 os_open_permissions_type file_mode; 477 os_open_permissions_type file_mode;
476 FILE *fd = NULL; 478 FILE *fd = NULL;
477 FILE *fd2 = NULL; 479 FILE *fd2 = NULL;
478 char line[MAX_LINE_LENGTH]; 480 char line[MAX_LINE_LENGTH];
479 char *dbname2 = NULL; 481 char *dbname2 = NULL;
480 char *block = NULL; 482 char *block = NULL;
481 char *name = NULL; 483 char *name = NULL;
482 char *lib = NULL; 484 char *lib = NULL;
483 int name_len, lib_len; 485 int name_len = 0, lib_len = 0;
484 PRBool skip = PR_FALSE; 486 PRBool skip = PR_FALSE;
485 PRBool found = PR_FALSE; 487 PRBool found = PR_FALSE;
486 488
487 if (dbname == NULL) { 489 if (dbname == NULL) {
488 PORT_SetError(SEC_ERROR_INVALID_ARGS); 490 PORT_SetError(SEC_ERROR_INVALID_ARGS);
489 return SECFailure; 491 return SECFailure;
490 } 492 }
491 493
492 if (!rw) { 494 if (!rw) {
493 PORT_SetError(SEC_ERROR_READ_ONLY); 495 PORT_SetError(SEC_ERROR_READ_ONLY);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 secmod, (char **)args, rw) 729 secmod, (char **)args, rw)
728 == SECSuccess) ? &success: NULL; 730 == SECSuccess) ? &success: NULL;
729 break; 731 break;
730 } 732 }
731 done: 733 done:
732 if (secmod) PR_smprintf_free(secmod); 734 if (secmod) PR_smprintf_free(secmod);
733 if (appName) PORT_Free(appName); 735 if (appName) PORT_Free(appName);
734 if (filename) PORT_Free(filename); 736 if (filename) PORT_Free(filename);
735 return rvstr; 737 return rvstr;
736 } 738 }
OLDNEW
« nss/lib/util/pkcs11n.h ('K') | « nss/lib/util/secport.c ('k') | nss/lib/util/utilpars.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698