CA-343280: Removed metadata entry.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2020-10-27 16:08:29 +00:00
parent 6286f96cb1
commit 8d004401fb
5 changed files with 5 additions and 39 deletions

View File

@ -43,7 +43,7 @@ namespace CFUValidator.Updates
private readonly string _url;
public AlternativeUrlDownloadUpdatesXmlSourceAction(string url)
: base(true, true, true, "CFU", "1")
: base(true, true, true, "CFU")
{
_url = url ?? throw new ArgumentNullException(nameof(url));
}

View File

@ -41,7 +41,7 @@ namespace CFUValidator.Updates
private readonly string _location;
public ReadFromFileUpdatesXmlSource(string location)
: base(true, true, true, "CFU", "1")
: base(true, true, true, "CFU")
{
_location = location ?? throw new ArgumentNullException(nameof(location));
}

View File

@ -127,7 +127,6 @@ namespace XenAdmin.Core
OsVersion = Environment.OSVersion.ToString(),
OsCulture = CultureInfo.CurrentUICulture.EnglishName,
IpAddress = GetLocalIPAddress(),
Uuid = Updates.GetUniqueIdHash(),
Uptime = isForXenCenter ? (DateTime.Now - Process.GetCurrentProcess().StartTime).ToString() : string.Empty
},
Settings = new XenCenterSettings

View File

@ -34,7 +34,6 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using XenAdmin.Actions;
using XenAdmin.Alerts;
@ -117,38 +116,9 @@ namespace XenAdmin.Core
bool checkForServerVersion = false, bool checkForPatches = false)
{
string userAgent = string.Format("{0}/{1}.{2} ({3}-bit)", BrandManager.BRAND_CONSOLE, BrandManager.XENCENTER_VERSION, Program.Version.Revision.ToString(), IntPtr.Size * 8);
string userAgentId = GetUniqueIdHash();
return new DownloadUpdatesXmlAction(checkForXenCenter, checkForServerVersion, checkForPatches,
userAgent, userAgentId);
}
internal static string GetUniqueIdHash()
{
string uniqueIdHash = "nil";
try
{
var managementObj = new System.Management.ManagementObject("Win32_OperatingSystem=@");
string serialNumber = (string)managementObj["SerialNumber"];
if (!string.IsNullOrWhiteSpace(serialNumber))
{
var serialBytes = Encoding.ASCII.GetBytes(serialNumber);
using (var md = new System.Security.Cryptography.MD5CryptoServiceProvider()) // MD5 to keep it short enough as this hash is not used for security in any way
{
var hash = md.ComputeHash(serialBytes);
uniqueIdHash = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
}
}
}
catch (Exception ex)
{
log.Error(ex);
}
return uniqueIdHash;
userAgent);
}
/// <summary>

View File

@ -72,18 +72,16 @@ namespace XenAdmin.Actions
private readonly bool _checkForServerVersion;
private readonly bool _checkForPatches;
private readonly string _userAgent;
private readonly string _userAgentId;
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches, string userAgent, string userAgentId)
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches, string userAgent)
: base(null, "_get_updates", "_get_updates", true)
{
Debug.Assert(!string.IsNullOrWhiteSpace(userAgent) && !string.IsNullOrWhiteSpace(userAgentId));
Debug.Assert(!string.IsNullOrWhiteSpace(userAgent));
_checkForXenCenter = checkForXenCenter;
_checkForServerVersion = checkForServerVersion;
_checkForPatches = checkForPatches;
_userAgent = userAgent;
_userAgentId = userAgentId;
}
protected override void Run()
@ -335,7 +333,6 @@ namespace XenAdmin.Actions
{
webClient.Proxy = proxy;
webClient.Headers.Add("User-Agent", _userAgent);
webClient.Headers.Add("X-User-Agent-Id", _userAgentId);
using (var stream = new MemoryStream(webClient.DownloadData(uri)))
xdoc.Load(stream);