From 96f9b9c6acc956eeb08fed8f236cb194deeae645 Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Wed, 15 Jul 2015 12:21:07 +0100 Subject: [PATCH] CP-12679: Upload the report from the Server Status Report wizard - make pre product key (used for authentication) configurable via registry entries Signed-off-by: Mihaela Stoica --- XenAdmin/Core/Registry.cs | 12 ++++++++++++ XenAdmin/Dialogs/CallHome/CallHomeSettingsDialog.cs | 2 +- .../BugToolWizardFiles/BugToolPageDestination.cs | 3 ++- .../Actions/CallHome/CallHomeAuthenticationAction.cs | 6 ++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/XenAdmin/Core/Registry.cs b/XenAdmin/Core/Registry.cs index 42b6775e2..b5adcc1c5 100644 --- a/XenAdmin/Core/Registry.cs +++ b/XenAdmin/Core/Registry.cs @@ -314,6 +314,16 @@ namespace XenAdmin.Core get { return ReadKey(CALL_HOME_UPLOAD_GRANT_TOKEN_DOMAIN_NAME); } } + public static string CallHomeUploadDomainName + { + get { return ReadKey(CALL_HOME_UPLOAD_DOMAIN_NAME); } + } + + public static string CallHomeProductKey + { + get { return ReadKey(CALL_HOME_PRODUCT_KEY); } + } + private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED"; private const string SSL_CERTIFICATES_ALL = "ALL"; private const string SSL_CERTIFICATES_KEY = "ForceSSLCertificates"; @@ -332,6 +342,8 @@ namespace XenAdmin.Core private const string CALL_HOME_IDENTITY_TOKEN_DOMAIN_NAME = "CallHomeIdentityTokenDomainName"; private const string CALL_HOME_UPLOAD_TOKEN_DOMAIN_NAME = "CallHomeUploadTokenDomainName"; private const string CALL_HOME_UPLOAD_GRANT_TOKEN_DOMAIN_NAME = "CallHomeUploadGrantTokenDomainName"; + private const string CALL_HOME_UPLOAD_DOMAIN_NAME = "CallHomeUploadDomainName"; + private const string CALL_HOME_PRODUCT_KEY = "CallHomeProductKey"; } public enum SSLCertificateTypes { None, Changed, All } diff --git a/XenAdmin/Dialogs/CallHome/CallHomeSettingsDialog.cs b/XenAdmin/Dialogs/CallHome/CallHomeSettingsDialog.cs index f9acdaccb..3221cd44b 100644 --- a/XenAdmin/Dialogs/CallHome/CallHomeSettingsDialog.cs +++ b/XenAdmin/Dialogs/CallHome/CallHomeSettingsDialog.cs @@ -267,7 +267,7 @@ namespace XenAdmin.Dialogs.CallHome var action = new CallHomeAuthenticationAction(pool, textBoxMyCitrixUsername.Text.Trim(), textBoxMyCitrixPassword.Text.Trim(), Registry.CallHomeIdentityTokenDomainName, Registry.CallHomeUploadGrantTokenDomainName, Registry.CallHomeUploadTokenDomainName, - true, 0, false); + Registry.CallHomeProductKey, true, 0, false); try { diff --git a/XenAdmin/Wizards/BugToolWizardFiles/BugToolPageDestination.cs b/XenAdmin/Wizards/BugToolWizardFiles/BugToolPageDestination.cs index 0eaaef877..831d85559 100644 --- a/XenAdmin/Wizards/BugToolWizardFiles/BugToolPageDestination.cs +++ b/XenAdmin/Wizards/BugToolWizardFiles/BugToolPageDestination.cs @@ -183,7 +183,8 @@ namespace XenAdmin.Wizards.BugToolWizardFiles return false; var action = new CallHomeAuthenticationAction(null, usernameTextBox.Text.Trim(), passwordTextBox.Text.Trim(), - Registry.CallHomeIdentityTokenDomainName, Registry.CallHomeUploadGrantTokenDomainName, Registry.CallHomeUploadTokenDomainName, + Registry.CallHomeIdentityTokenDomainName, Registry.CallHomeUploadGrantTokenDomainName, + Registry.CallHomeUploadTokenDomainName, Registry.CallHomeProductKey, false, TokenExpiration, false); try diff --git a/XenModel/Actions/CallHome/CallHomeAuthenticationAction.cs b/XenModel/Actions/CallHome/CallHomeAuthenticationAction.cs index 7344161d4..e9fba8a99 100644 --- a/XenModel/Actions/CallHome/CallHomeAuthenticationAction.cs +++ b/XenModel/Actions/CallHome/CallHomeAuthenticationAction.cs @@ -61,7 +61,7 @@ namespace XenAdmin.Actions private readonly string uploadGrantTokenDomainName = "http://cis-daily.citrite.com"; private readonly string uploadTokenDomainName = "http://cis-daily.citrite.com"; - private const string productKey = "eb1b224c461038baf1f08dfba6b8d4b4413f96c7"; + private readonly string productKey = "eb1b224c461038baf1f08dfba6b8d4b4413f96c7"; private readonly string XenServerUsername; private readonly string XenServerPassword; @@ -84,7 +84,7 @@ namespace XenAdmin.Actions } public CallHomeAuthenticationAction(Pool pool, string username, string password, - string identityTokenDomainName, string uploadGrantTokenDomainName, string uploadTokenDomainName, bool saveTokenAsSecret, long tokenExpiration, bool suppressHistory) + string identityTokenDomainName, string uploadGrantTokenDomainName, string uploadTokenDomainName, string productKey, bool saveTokenAsSecret, long tokenExpiration, bool suppressHistory) : this(pool, username, password, saveTokenAsSecret, tokenExpiration, suppressHistory) { if (!string.IsNullOrEmpty(identityTokenDomainName)) @@ -93,6 +93,8 @@ namespace XenAdmin.Actions this.uploadGrantTokenDomainName = uploadGrantTokenDomainName; if (!string.IsNullOrEmpty(identityTokenDomainName)) this.uploadTokenDomainName = uploadTokenDomainName; + if (!string.IsNullOrEmpty(productKey)) + this.productKey = productKey; } protected override void Run()