| 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 21 matching lines...) Expand all Loading... |
| 32 * decision by deleting the provisions above and replace them with the notice | 32 * decision by deleting the provisions above and replace them with the notice |
| 33 * and other provisions required by the GPL or the LGPL. If you do not delete | 33 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 34 * the provisions above, a recipient may use your version of this file under | 34 * the provisions above, a recipient may use your version of this file under |
| 35 * the terms of any one of the MPL, the GPL or the LGPL. | 35 * the terms of any one of the MPL, the GPL or the LGPL. |
| 36 * | 36 * |
| 37 * ***** END LICENSE BLOCK ***** */ | 37 * ***** END LICENSE BLOCK ***** */ |
| 38 | 38 |
| 39 /* | 39 /* |
| 40 * Certificate handling code | 40 * Certificate handling code |
| 41 * | 41 * |
| 42 * $Id: certdb.c,v 1.101 2009/05/18 21:33:25 nelson%bolyard.com Exp $ | 42 * $Id: certdb.c,v 1.102 2010/02/10 02:00:57 wtc%google.com Exp $ |
| 43 */ | 43 */ |
| 44 | 44 |
| 45 #include "nssilock.h" | 45 #include "nssilock.h" |
| 46 #include "prmon.h" | 46 #include "prmon.h" |
| 47 #include "prtime.h" | 47 #include "prtime.h" |
| 48 #include "cert.h" | 48 #include "cert.h" |
| 49 #include "certi.h" | 49 #include "certi.h" |
| 50 #include "secder.h" | 50 #include "secder.h" |
| 51 #include "secoid.h" | 51 #include "secoid.h" |
| 52 #include "secasn1.h" | 52 #include "secasn1.h" |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 | 1546 |
| 1547 do { | 1547 do { |
| 1548 switch (current->type) { | 1548 switch (current->type) { |
| 1549 case certDNSName: | 1549 case certDNSName: |
| 1550 if (!isIPaddr) { | 1550 if (!isIPaddr) { |
| 1551 /* DNS name current->name.other.data is not null terminated. | 1551 /* DNS name current->name.other.data is not null terminated. |
| 1552 ** so must copy it. | 1552 ** so must copy it. |
| 1553 */ | 1553 */ |
| 1554 int cnLen = current->name.other.len; | 1554 int cnLen = current->name.other.len; |
| 1555 rv = CERT_RFC1485_EscapeAndQuote(cn, cnBufLen, | 1555 rv = CERT_RFC1485_EscapeAndQuote(cn, cnBufLen, |
| 1556 » » » » » current->name.other.data, cnLen); | 1556 » » » » » (char *)current->name.other.data, |
| 1557 » » » » » cnLen); |
| 1557 if (rv != SECSuccess && PORT_GetError() == SEC_ERROR_OUTPUT_LEN)
{ | 1558 if (rv != SECSuccess && PORT_GetError() == SEC_ERROR_OUTPUT_LEN)
{ |
| 1558 cnBufLen = cnLen * 3 + 3; /* big enough for worst case */ | 1559 cnBufLen = cnLen * 3 + 3; /* big enough for worst case */ |
| 1559 cn = (char *)PORT_ArenaAlloc(arena, cnBufLen); | 1560 cn = (char *)PORT_ArenaAlloc(arena, cnBufLen); |
| 1560 if (!cn) | 1561 if (!cn) |
| 1561 goto fail; | 1562 goto fail; |
| 1562 rv = CERT_RFC1485_EscapeAndQuote(cn, cnBufLen, | 1563 rv = CERT_RFC1485_EscapeAndQuote(cn, cnBufLen, |
| 1563 » » » » » current->name.other.data, cnLen); | 1564 » » » » » (char *)current->name.other.data, |
| 1565 » » » » » cnLen); |
| 1564 } | 1566 } |
| 1565 if (rv == SECSuccess) | 1567 if (rv == SECSuccess) |
| 1566 rv = cert_TestHostName(cn ,hn); | 1568 rv = cert_TestHostName(cn ,hn); |
| 1567 if (rv == SECSuccess) | 1569 if (rv == SECSuccess) |
| 1568 goto finish; | 1570 goto finish; |
| 1569 } | 1571 } |
| 1570 DNSextCount++; | 1572 DNSextCount++; |
| 1571 break; | 1573 break; |
| 1572 case certIPAddress: | 1574 case certIPAddress: |
| 1573 if (isIPaddr) { | 1575 if (isIPaddr) { |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3235 CERTCertificate *cert = NULL; | 3237 CERTCertificate *cert = NULL; |
| 3236 SECItem *derCert; | 3238 SECItem *derCert; |
| 3237 | 3239 |
| 3238 derCert = cert_FindDERCertBySubjectKeyID(subjKeyID); | 3240 derCert = cert_FindDERCertBySubjectKeyID(subjKeyID); |
| 3239 if (derCert) { | 3241 if (derCert) { |
| 3240 cert = CERT_FindCertByDERCert(handle, derCert); | 3242 cert = CERT_FindCertByDERCert(handle, derCert); |
| 3241 SECITEM_FreeItem(derCert, PR_TRUE); | 3243 SECITEM_FreeItem(derCert, PR_TRUE); |
| 3242 } | 3244 } |
| 3243 return cert; | 3245 return cert; |
| 3244 } | 3246 } |
| OLD | NEW |