OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 certbegin = cp; | 353 certbegin = cp; |
354 break; | 354 break; |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 if ( certbegin ) { | 358 if ( certbegin ) { |
359 /* find the ending marker */ | 359 /* find the ending marker */ |
360 while ( cl >= NS_CERT_TRAILER_LEN ) { | 360 while ( cl >= NS_CERT_TRAILER_LEN ) { |
361 if ( !PORT_Strncasecmp((char *)cp, NS_CERT_TRAILER, | 361 if ( !PORT_Strncasecmp((char *)cp, NS_CERT_TRAILER, |
362 NS_CERT_TRAILER_LEN) ) { | 362 NS_CERT_TRAILER_LEN) ) { |
363 » » certend = (unsigned char *)cp; | 363 » » certend = cp; |
364 break; | 364 break; |
365 } | 365 } |
366 | 366 |
367 /* skip to next eol */ | 367 /* skip to next eol */ |
368 while ( cl && ( *cp != '\n' )) { | 368 while ( cl && ( *cp != '\n' )) { |
369 cp++; | 369 cp++; |
370 cl--; | 370 cl--; |
371 } | 371 } |
372 | 372 |
373 /* skip all blank lines */ | 373 /* skip all blank lines */ |
374 while ( cl && ( *cp == '\n' || *cp == '\r' )) { | 374 while ( cl && ( *cp == '\n' || *cp == '\r' )) { |
375 cp++; | 375 cp++; |
376 cl--; | 376 cl--; |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 if ( certbegin && certend ) { | 381 if ( certbegin && certend ) { |
382 unsigned int binLen; | 382 unsigned int binLen; |
383 | 383 |
384 *certend = 0; | 384 *certend = 0; |
385 /* convert to binary */ | 385 /* convert to binary */ |
386 » bincert = ATOB_AsciiToData(certbegin, &binLen); | 386 » bincert = ATOB_AsciiToData((char *)certbegin, &binLen); |
387 if (!bincert) { | 387 if (!bincert) { |
388 rv = SECFailure; | 388 rv = SECFailure; |
389 goto loser; | 389 goto loser; |
390 } | 390 } |
391 | 391 |
392 /* now recurse to decode the binary */ | 392 /* now recurse to decode the binary */ |
393 rv = CERT_DecodeCertPackage((char *)bincert, binLen, f, arg); | 393 rv = CERT_DecodeCertPackage((char *)bincert, binLen, f, arg); |
394 | 394 |
395 } else { | 395 } else { |
396 PORT_SetError(SEC_ERROR_BAD_DER); | 396 PORT_SetError(SEC_ERROR_BAD_DER); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 if ( rv == SECSuccess ) { | 447 if ( rv == SECSuccess ) { |
448 cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), | 448 cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), |
449 &collectArgs.cert, NULL, | 449 &collectArgs.cert, NULL, |
450 PR_FALSE, PR_TRUE); | 450 PR_FALSE, PR_TRUE); |
451 } | 451 } |
452 | 452 |
453 PORT_FreeArena(collectArgs.arena, PR_FALSE); | 453 PORT_FreeArena(collectArgs.arena, PR_FALSE); |
454 | 454 |
455 return(cert); | 455 return(cert); |
456 } | 456 } |
OLD | NEW |