1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-10 01:34:58 +03:00

v4.13-9522-beta

This commit is contained in:
dnobori
2015-01-30 22:30:34 +09:00
parent 75f9836ce5
commit 06a72040a3
337 changed files with 1411 additions and 493 deletions

View File

@ -518,7 +518,7 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
UCHAR machine_key[SHA1_SIZE];
char machine_key_str[MAX_SIZE];
char machine_name[MAX_SIZE];
BUF *cert_hash;
BUF *cert_hash = NULL;
UINT err = ERR_INTERNAL_ERROR;
UCHAR key_hash[SHA1_SIZE];
char key_hash_str[MAX_SIZE];
@ -528,12 +528,18 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
UINT build = 0;
bool use_https = false;
bool use_vgs = false;
bool no_cert_verify = false;
char add_header_name[64];
char add_header_value[64];
// Validate arguments
if (c == NULL)
{
return ERR_INTERNAL_ERROR;
}
Zero(add_header_name, sizeof(add_header_name));
Zero(add_header_value, sizeof(add_header_value));
Zero(current_azure_ip, sizeof(current_azure_ip));
GetCurrentMachineIpProcessHash(machine_key);
@ -642,8 +648,6 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
cert_hash = StrToBin(DDNS_CERT_HASH);
Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64());
Format(url3, sizeof(url3), url2, key_hash_str[2], key_hash_str[3]);
@ -654,10 +658,23 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
ReplaceStr(url3, sizeof(url3), url3, ".servers", ".open.servers");
Debug("WpcCall: %s\n", url3);
ret = WpcCallEx(url3, &t, DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, "register", req,
NULL, NULL, ((cert_hash != NULL && cert_hash->Size == SHA1_SIZE) ? cert_hash->Buf : NULL), NULL, DDNS_RPC_MAX_RECV_SIZE);
Debug("WpcCall Ret: %u\n", ret);
if (no_cert_verify == false)
{
cert_hash = StrToBin(DDNS_CERT_HASH);
}
ret = NULL;
if (ret == NULL)
{
Debug("WpcCall: %s\n", url3);
ret = WpcCallEx(url3, &t, DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, "register", req,
NULL, NULL, ((cert_hash != NULL && cert_hash->Size == SHA1_SIZE) ? cert_hash->Buf : NULL), NULL, DDNS_RPC_MAX_RECV_SIZE,
add_header_name, add_header_value);
Debug("WpcCall Ret: %u\n", ret);
}
FreeBuf(cert_hash);
@ -806,7 +823,8 @@ UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use
UINT ret = ERR_INTERNAL_ERROR;
URL_DATA data;
BUF *recv;
BUF *cert_hash;
BUF *cert_hash = NULL;
bool no_cert_verify = false;
// Validate arguments
if (dst == NULL || c == NULL)
{
@ -844,12 +862,17 @@ UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use
ReplaceStr(url2, sizeof(url2), url2, "http://", "https://");
}
if (ParseUrl(&data, url2, false, NULL) == false)
{
return ERR_INTERNAL_ERROR;
}
cert_hash = StrToBin(DDNS_CERT_HASH);
if (no_cert_verify == false)
{
cert_hash = StrToBin(DDNS_CERT_HASH);
}
recv = HttpRequest(&data, (ipv6 ? NULL : &c->InternetSetting), DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, &ret, false, NULL, NULL,
NULL, ((cert_hash != NULL && cert_hash->Size == SHA1_SIZE) ? cert_hash->Buf : NULL));
@ -904,6 +927,7 @@ UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use
return ret;
}
// Creating a DDNS client
DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t)
{