[WINTRUST_WINETEST]
authorChristoph von Wittich <christoph_vw@reactos.org>
Thu, 4 Mar 2010 20:46:06 +0000 (20:46 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Thu, 4 Mar 2010 20:46:06 +0000 (20:46 +0000)
sync wintrust_winetest to wine 1.1.39

svn path=/trunk/; revision=45840

rostests/winetests/wintrust/crypt.c
rostests/winetests/wintrust/softpub.c

index 3e77814..a2e096a 100644 (file)
@@ -515,6 +515,8 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
     ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
     ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError());
     }
     ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
     ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError());
     }
+    if (hcatinfo != NULL)
+        pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
 
     SetLastError(0xdeadbeef);
     hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1);
 
     SetLastError(0xdeadbeef);
     hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1);
index 3e4347d..e01a26c 100644 (file)
@@ -179,8 +179,12 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
             ok(data.pasSigners[0].pasCertChain != NULL,
              "Expected pasCertChain to be allocated\n");
             if (data.pasSigners[0].pasCertChain)
             ok(data.pasSigners[0].pasCertChain != NULL,
              "Expected pasCertChain to be allocated\n");
             if (data.pasSigners[0].pasCertChain)
+            {
                 ok(data.pasSigners[0].pasCertChain[0].pCert == cert,
                  "Unexpected cert\n");
                 ok(data.pasSigners[0].pasCertChain[0].pCert == cert,
                  "Unexpected cert\n");
+                CertFreeCertificateContext(
+                 data.pasSigners[0].pasCertChain[0].pCert);
+            }
             CertFreeCertificateContext(cert);
         }
         else
             CertFreeCertificateContext(cert);
         }
         else
@@ -266,6 +270,8 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
         PROVDATA_SIP provDataSIP = { 0 };
         static const GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,
          0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
         PROVDATA_SIP provDataSIP = { 0 };
         static const GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,
          0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
+        static GUID bogusGuid = { 0xdeadbeef, 0xbaad, 0xf00d, { 0x00,0x00,0x00,
+         0x00,0x00,0x00,0x00,0x00 } };
 
         ret = funcs->pfnObjectTrust(&data);
         ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret);
 
         ret = funcs->pfnObjectTrust(&data);
         ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret);
@@ -317,6 +323,30 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
             ok(provDataSIP.psSipSubjectInfo != NULL,
              "Expected a subject info\n");
         }
             ok(provDataSIP.psSipSubjectInfo != NULL,
              "Expected a subject info\n");
         }
+        /* Specifying the GUID results in that GUID being the subject GUID */
+        fileInfo.pgKnownSubject = &bogusGuid;
+        ret = funcs->pfnObjectTrust(&data);
+        ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret);
+        ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
+         TRUST_E_NOSIGNATURE ||
+         data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
+         TRUST_E_SUBJECT_FORM_UNKNOWN ||
+         data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
+         TRUST_E_PROVIDER_UNKNOWN,
+         "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08x\n",
+         data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
+        if (data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
+         TRUST_E_NOSIGNATURE)
+        {
+            ok(!memcmp(&provDataSIP.gSubject, &bogusGuid, sizeof(bogusGuid)),
+             "unexpected subject GUID\n");
+        }
+        /* Specifying a bogus GUID pointer crashes */
+        if (0)
+        {
+            fileInfo.pgKnownSubject = (GUID *)0xdeadbeef;
+            ret = funcs->pfnObjectTrust(&data);
+        }
         funcs->pfnFree(data.padwTrustStepErrors);
     }
 }
         funcs->pfnFree(data.padwTrustStepErrors);
     }
 }
@@ -407,6 +437,9 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
              (CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST),
              "Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08x\n",
              data.pasSigners[0].pasCertChain[0].dwConfidence);
              (CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST),
              "Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08x\n",
              data.pasSigners[0].pasCertChain[0].dwConfidence);
+            CertFreeCertificateContext(
+             data.pasSigners[0].pasCertChain[0].pCert);
+            CertFreeCertificateChain(data.pasSigners[0].pChainContext);
             CertFreeCertificateContext(cert);
         }
     }
             CertFreeCertificateContext(cert);
         }
     }