Skip to content

Commit 5787e3c

Browse files
committed
update store
1 parent 8dd470c commit 5787e3c

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

eng/SendToHelix.proj

+5-9
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
<TestRunNamePrefix>$(AGENT_JOBNAME)</TestRunNamePrefix>
1717
<EnableXUnitReporter>true</EnableXUnitReporter>
1818
</PropertyGroup>
19-
20-
<!--<PropertyGroup>
21-
<RunWithCoreWCFService Condition="'$(RunWithCoreWCFService)' == ''">false</RunWithCoreWCFService>
22-
</PropertyGroup>-->
2319

2420
<Target Name="InstallDotNet">
2521
<ItemGroup>
@@ -75,15 +71,15 @@
7571
</PropertyGroup>
7672

7773
<PropertyGroup>
78-
<RunWithCoreWcfService>true</RunWithCoreWcfService>
74+
<RunWithCoreWCFService Condition="'$(RunWithCoreWCFService)' == ''">false</RunWithCoreWCFService>
7975
</PropertyGroup>
80-
81-
<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'false' And '$(TestJob)' != 'Windows'" >
76+
77+
<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'false' AND '$(TestJob)' != 'Windows'" >
8278
<HelixPreCommands>$(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh</HelixPreCommands>
8379
<HelixPreCommands>$(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt</HelixPreCommands>
8480
</PropertyGroup>
8581

86-
<PropertyGroup Condition="'$(TestJob)' == 'Windows'">
82+
<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'true' AND '$(TestJob)' == 'Windows'">
8783
<HelixPreCommands>$(HelixPreCommands);set PATH=%HELIX_CORRELATION_PAYLOAD%\dotnet-cli%3B%PATH%</HelixPreCommands>
8884
<!-- %3B is an escaped ; -->
8985
<HelixPreCommands>$(HelixPreCommands);set DOTNET_ROOT=%HELIX_CORRELATION_PAYLOAD%\dotnet-cli;set DOTNET_CLI_TELEMETRY_OPTOUT=1</HelixPreCommands>
@@ -93,7 +89,7 @@
9389
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net8.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
9490
</PropertyGroup>
9591

96-
<PropertyGroup Condition="'$(TestJob)' != 'Windows'">
92+
<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'true' AND '$(TestJob)' != 'Windows'">
9793
<HelixPreCommands>$(HelixPreCommands);export PATH=$HELIX_CORRELATION_PAYLOAD/dotnet-cli:$PATH</HelixPreCommands>
9894
<HelixPreCommands>$(HelixPreCommands);export DOTNET_ROOT=$HELIX_CORRELATION_PAYLOAD/dotnet-cli;export DOTNET_CLI_TELEMETRY_OPTOUT=1</HelixPreCommands>
9995
<HelixPreCommands>$(HelixPreCommands);export DOTNET_CLI_HOME=$HELIX_WORKITEM_ROOT/.dotnet</HelixPreCommands>

src/System.Private.ServiceModel/tools/CertificateGenerator/CertificateGeneratorLibrary/CertificateManager.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ public static bool AddToStoreIfNeeded(StoreName storeName, StoreLocation storeLo
4949
try
5050
{
5151
store = CertificateHelper.GetX509Store(storeName, storeLocation);
52-
52+
5353
// We assume Bridge is running elevated
54-
store.Open(OpenFlags.ReadWrite);
54+
if (!CertificateHelper.CurrentOperatingSystem.IsMacOS())
55+
{
56+
store.Open(OpenFlags.ReadWrite);
57+
}
5558
existingCert = CertificateFromThumbprint(store, certificate.Thumbprint);
5659
if (existingCert == null)
5760
{

src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestHost.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ public static X509Certificate2 CertificateFromSubject(StoreName name, StoreLocat
214214
try
215215
{
216216
store = CertificateHelper.GetX509Store(name, location);
217-
store.Open(OpenFlags.ReadOnly);
217+
if (!store.IsOpen)
218+
{
219+
store.Open(OpenFlags.ReadOnly);
220+
}
218221
X509Certificate2Collection foundCertificates = store.Certificates.Find(X509FindType.FindBySubjectName, subjectName, validOnly: true);
219222
return foundCertificates.Count == 0 ? null : foundCertificates[0];
220223
}
@@ -234,7 +237,10 @@ public static X509Certificate2 CertificateFromFriendlyName(StoreName name, Store
234237
try
235238
{
236239
store = CertificateHelper.GetX509Store(name, location);
237-
store.Open(OpenFlags.ReadOnly);
240+
if (!store.IsOpen)
241+
{
242+
store.Open(OpenFlags.ReadOnly);
243+
}
238244

239245
X509Certificate2Collection foundCertificates = store.Certificates.Find(X509FindType.FindByIssuerName, "DO_NOT_TRUST_WcfBridgeRootCA", false);
240246
string friendlyNameHash = CertificateGenerator.HashFriendlyNameToString(friendlyName);

0 commit comments

Comments
 (0)