xmlsec r997 - in trunk: . src/mscrypto win32



Author: aleksey
Date: Fri May 23 16:33:05 2008
New Revision: 997
URL: http://svn.gnome.org/viewvc/xmlsec?rev=997&view=rev

Log:
fix MS certificates refcounting

Modified:
   trunk/ChangeLog
   trunk/src/mscrypto/app.c
   trunk/win32/mycfg.bat

Modified: trunk/src/mscrypto/app.c
==============================================================================
--- trunk/src/mscrypto/app.c	(original)
+++ trunk/src/mscrypto/app.c	Fri May 23 16:33:05 2008
@@ -648,7 +648,18 @@
 
 	/* Find the certificate that has the private key */
 	if((TRUE == CertGetCertificateContextProperty(pCert, CERT_KEY_SPEC_PROP_ID, &dwData, &dwDataLen)) && (dwData > 0)) {
-	    keyData = xmlSecMSCryptoCertAdopt(pCert, xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+	    tmpcert = CertDuplicateCertificateContext(pCert);
+	    if(tmpcert == NULL) {
+		xmlSecError(XMLSEC_ERRORS_HERE,
+			    NULL,
+			    "CertDuplicateCertificateContext",
+			    XMLSEC_ERRORS_R_CRYPTO_FAILED,
+			    "data=%s",
+			    xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+		goto done;
+	    }
+
+	    keyData = xmlSecMSCryptoCertAdopt(tmpcert, xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
 	    if(keyData == NULL) {
 		xmlSecError(XMLSEC_ERRORS_HERE,
 			    NULL,
@@ -657,6 +668,7 @@
 			    XMLSEC_ERRORS_NO_MESSAGE);
 		goto done;
 	    }
+        tmpcert = NULL;
 	
 	    tmpcert = CertDuplicateCertificateContext(pCert);
 	    if(tmpcert == NULL) {

Modified: trunk/win32/mycfg.bat
==============================================================================
Binary files. No diff available.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]