if (ipConfigType != CONNECTION_IP_CONFIG_TYPE_FIXED)
{
- if (netAccountInfo.GetDnsAddressScheme() == NET_ADDRESS_SCHEME_STATIC)
- {
- if (netAccountInfo.GetPrimaryDnsAddress() != null)
- {
- pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetPrimaryDnsAddress()->ToString());
- SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-
- ret = connection_profile_set_dns_address(profileHandle, 1, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr);
- delete[] pDnsAddr;
- SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM,
- "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret);
- }
-
- if (netAccountInfo.GetSecondaryDnsAddress() != null)
- {
- pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetSecondaryDnsAddress()->ToString());
- SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-
- ret = connection_profile_set_dns_address(profileHandle, 2, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr);
- delete[] pDnsAddr;
- SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM,
- "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret);
- }
- }
-
if (netAccountInfo.GetLocalAddressScheme() == NET_ADDRESS_SCHEME_STATIC)
{
ret = connection_profile_set_ip_config_type(profileHandle, CONNECTION_ADDRESS_FAMILY_IPV4, CONNECTION_IP_CONFIG_TYPE_STATIC);
}
}
+ if (netAccountInfo.GetDnsAddressScheme() == NET_ADDRESS_SCHEME_STATIC)
+ {
+ if (netAccountInfo.GetPrimaryDnsAddress() != null)
+ {
+ pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetPrimaryDnsAddress()->ToString());
+ SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ ret = connection_profile_set_dns_address(profileHandle, 1, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr);
+ delete[] pDnsAddr;
+ pDnsAddr = null;
+ SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM,
+ "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret);
+ }
+
+ if (netAccountInfo.GetSecondaryDnsAddress() != null)
+ {
+ pDnsAddr = _StringConverter::CopyToCharArrayN(netAccountInfo.GetSecondaryDnsAddress()->ToString());
+ SysTryCatch(NID_NET, pDnsAddr != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ ret = connection_profile_set_dns_address(profileHandle, 2, CONNECTION_ADDRESS_FAMILY_IPV4, pDnsAddr);
+ delete[] pDnsAddr;
+ SysTryCatch(NID_NET, ret == CONNECTION_ERROR_NONE, r = E_SYSTEM, E_SYSTEM,
+ "[%s] A system error has been occurred. The return value from connection_profile_set_dns_address() is %d", GetErrorMessage(E_SYSTEM), ret);
+ }
+ }
+
if (netAccountInfo.GetProxyAddress() != null)
{
proxyAddr = netAccountInfo.GetProxyAddress()->GetNetEndPoint();