Skip to content

Commit c14a153

Browse files
author
Lee Fine
committed
1 parent 84b1cbe commit c14a153

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

RemoteFile/RemoteCertificateStore.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,9 @@ internal void Initialize(string sudoImpersonatedUser)
454454
bool treatAsLocal = Server.ToLower().EndsWith(LOCAL_MACHINE_SUFFIX);
455455

456456
if (ServerType == ServerTypeEnum.Linux || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
457-
{
458457
RemoteHandler = treatAsLocal ? new LinuxLocalHandler() as IRemoteHandler : new SSHHandler(Server, ServerId, ServerPassword, ServerType == ServerTypeEnum.Linux, sudoImpersonatedUser) as IRemoteHandler;
459-
}
460458
else
461-
{
462-
RemoteHandler = new WinRMHandler(Server, ServerId, ServerPassword, treatAsLocal);
463-
((WinRMHandler)RemoteHandler).SetIncludeSPN(IncludePortInSPN);
464-
}
459+
RemoteHandler = new WinRMHandler(Server, ServerId, ServerPassword, treatAsLocal, IncludePortInSPN);
465460

466461
logger.MethodExit(LogLevel.Debug);
467462
}

RemoteFile/RemoteHandlers/WinRMHandler.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class WinRMHandler : BaseRemoteHandler
2727
private WSManConnectionInfo connectionInfo { get; set; }
2828
private bool RunLocal { get; set; }
2929

30-
internal WinRMHandler(string server, string serverLogin, string serverPassword, bool treatAsLocal)
30+
internal WinRMHandler(string server, string serverLogin, string serverPassword, bool treatAsLocal, bool includePortInSPN)
3131
{
3232
_logger.MethodEntry(LogLevel.Debug);
3333

@@ -37,6 +37,7 @@ internal WinRMHandler(string server, string serverLogin, string serverPassword,
3737
if (!RunLocal)
3838
{
3939
connectionInfo = new WSManConnectionInfo(new System.Uri($"{Server}/wsman"));
40+
connectionInfo.IncludePortInSPN = includePortInSPN;
4041
if (!string.IsNullOrEmpty(serverLogin))
4142
{
4243
connectionInfo.Credential = new PSCredential(serverLogin, new NetworkCredential(serverLogin, serverPassword).SecurePassword);
@@ -142,11 +143,6 @@ public override string RunCommand(string commandText, object[] parameters, bool
142143
}
143144
}
144145

145-
public void SetIncludeSPN(bool includePortInSPN)
146-
{
147-
connectionInfo.IncludePortInSPN = includePortInSPN;
148-
}
149-
150146
private byte[] RunCommandBinary(string commandText)
151147
{
152148
_logger.MethodEntry(LogLevel.Debug);

0 commit comments

Comments
 (0)