From 2c22e62aa0df9b57900e0941fca1d94e8a799d03 Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Thu, 31 Jan 2019 00:00:00 +0800 Subject: [PATCH] Fix default domain name --- src/Core/WinSWCore/Configuration/DefaultSettings.cs | 2 +- .../WinSWCore/Configuration/IWinSWConfiguration.cs | 2 +- src/Core/WinSWCore/ServiceDescriptor.cs | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Core/WinSWCore/Configuration/DefaultSettings.cs b/src/Core/WinSWCore/Configuration/DefaultSettings.cs index b9d2566..a1443ef 100644 --- a/src/Core/WinSWCore/Configuration/DefaultSettings.cs +++ b/src/Core/WinSWCore/Configuration/DefaultSettings.cs @@ -24,7 +24,7 @@ namespace winsw.Configuration // Installation public bool AllowServiceAcountLogonRight => false; public string? ServiceAccountPassword => null; - public string ServiceAccountUser => "NULL\\NULL"; + public string? ServiceAccountUser => null; public List FailureActions => new List(0); public TimeSpan ResetFailureAfter => TimeSpan.FromDays(1); diff --git a/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs b/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs index 3d9585b..2da55a0 100644 --- a/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs +++ b/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs @@ -20,7 +20,7 @@ namespace winsw.Configuration // Installation bool AllowServiceAcountLogonRight { get; } string? ServiceAccountPassword { get; } - string ServiceAccountUser { get; } + string? ServiceAccountUser { get; } List FailureActions { get; } TimeSpan ResetFailureAfter { get; } diff --git a/src/Core/WinSWCore/ServiceDescriptor.cs b/src/Core/WinSWCore/ServiceDescriptor.cs index 97a68fc..f4b8188 100755 --- a/src/Core/WinSWCore/ServiceDescriptor.cs +++ b/src/Core/WinSWCore/ServiceDescriptor.cs @@ -634,19 +634,17 @@ namespace winsw protected string? AllowServiceLogon => GetServiceAccountPart("allowservicelogon"); - // ReSharper disable once InconsistentNaming - protected string? serviceAccountDomain => GetServiceAccountPart("domain"); + protected string? ServiceAccountDomain => GetServiceAccountPart("domain"); - // ReSharper disable once InconsistentNaming - protected string? serviceAccountName => GetServiceAccountPart("user"); + protected string? ServiceAccountName => GetServiceAccountPart("user"); public string? ServiceAccountPassword => GetServiceAccountPart("password"); - public string ServiceAccountUser => (serviceAccountDomain ?? "NULL") + @"\" + (serviceAccountName ?? "NULL"); + public string? ServiceAccountUser => ServiceAccountName is null ? null : (ServiceAccountDomain ?? ".") + "\\" + ServiceAccountName; public bool HasServiceAccount() { - return !string.IsNullOrEmpty(serviceAccountDomain) && !string.IsNullOrEmpty(serviceAccountName); + return !string.IsNullOrEmpty(ServiceAccountName); } public bool AllowServiceAcountLogonRight