Skip to content

Commit

Permalink
Changing where we read the PROXY info from to be up to date with omsa…
Browse files Browse the repository at this point in the history
…gent
  • Loading branch information
John Kordich committed Dec 15, 2015
1 parent 1bd6aa0 commit 7a2efea
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions LCM/dsc/engine/ca/CAInfrastructure/WebPullClient.c
Expand Up @@ -237,23 +237,48 @@ static MI_Result GetSSLOptions(_Outptr_result_maybenull_ MI_Instance **extendedE
Conf_Close(conf);

#if defined(BUILD_OMS)
// TODO: read from OMS's config file to read in the Proxy info
size_t valueLength;
const char* omsProxyFileLocation = "/etc/opt/microsoft/omsagent/conf/proxy.conf";
const char* omsProxyFileLocation = "/etc/opt/microsoft/omsagent/conf/omsadmin.conf";
conf = Conf_Open(omsProxyFileLocation);
if (!conf)
{
return GetCimMIError(MI_RESULT_NOT_FOUND, extendedError, ID_PULL_DSCCONF_NOTOPENABLE);
}

if (File_ExistT(omsProxyFileLocation) != -1)
for (;;)
{
text = InhaleTextFile(omsProxyFileLocation);
valueLength = strlen(text);
if (valueLength > MAX_SSLOPTION_STRING_LENGTH)
{
DSC_free(text);
return GetCimMIError(MI_RESULT_SERVER_LIMITS_EXCEEDED, extendedError, ID_PULL_PROXYTOOLONG);
const char* key;
const char* value;
int r = Conf_Read(conf, &key, &value);
if (r == -1)
{
Conf_Close(conf);
return GetCimMIError1Param(MI_RESULT_NOT_FOUND, extendedError, ID_PULL_DSCCONF_NOTREADABLE, scs(Conf_Error(conf)));
}

if (r == 1)
{
break;
}

if (strcasecmp(key, "PROXY") == 0)
{
size_t valueLength = strlen(value);
if (valueLength > MAX_SSLOPTION_STRING_LENGTH)
{
Conf_Close(conf);
return GetCimMIError(MI_RESULT_SERVER_LIMITS_EXCEEDED, extendedError, ID_PULL_PROXYTOOLONG);
}
memcpy(g_sslOptions.Proxy, value, valueLength);
g_sslOptions.Proxy[valueLength] = '\0';
}
memcpy(g_sslOptions.Proxy, text, valueLength);
g_sslOptions.Proxy[valueLength] = '\0';
DSC_free(text);
else
{
continue;
}
}

Conf_Close(conf);

#endif

return MI_RESULT_OK;
Expand Down

0 comments on commit 7a2efea

Please sign in to comment.