Add DNS command line option

This commit is contained in:
Mudit Vats
2020-06-26 14:20:39 -07:00
parent c1987ceb38
commit 857c6e3a87
3 changed files with 82 additions and 19 deletions

View File

@@ -297,7 +297,7 @@ std::string getDNSInfo()
}
string getActivateInfo(string profile)
string getActivateInfo(string profile, string dnssuffixcmd)
{
utility::string_t tmp;
@@ -356,7 +356,17 @@ string getActivateInfo(string profile)
// Get DNS Info
tmp = utility::conversions::convertstring("");
string dnsSuffix = getDNSInfo();
string dnsSuffix = "";
if (dnssuffixcmd.length() > 0)
{
// use what's passed in
dnsSuffix = dnssuffixcmd;
}
else
{
// get it from AMT or OS
dnsSuffix = getDNSInfo();
}
if (dnsSuffix.length())
{
@@ -401,7 +411,7 @@ string decodeBase64(string str)
return decodedString;
}
string createActivationRequest(string profile)
string createActivationRequest(string profile, string dnssuffixcmd)
{
// Activation parameters
json::value request;
@@ -426,7 +436,7 @@ string createActivationRequest(string profile)
request[U("message")] = json::value::string(tmp);
// payload
string activationInfo = getActivateInfo(profile);
string activationInfo = getActivateInfo(profile, dnssuffixcmd);
utility::string_t payload = utility::conversions::to_string_t(activationInfo);
request[U("payload")] = json::value::string(payload);