1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Cedar: various fixes

This commit is contained in:
dnobori 2019-11-21 23:26:36 +01:00 committed by Davide Beatrici
parent a676a0a6fd
commit 76ae935172
8 changed files with 22 additions and 10 deletions

View File

@ -9696,6 +9696,15 @@ UINT StSetFarmSetting(ADMIN *a, RPC_FARM *t)
return ERR_NOT_SUPPORTED; return ERR_NOT_SUPPORTED;
} }
if (IsZero(t->MemberPassword, sizeof(t->MemberPassword)))
{
if (IsEmptyStr(t->MemberPasswordPlaintext) == false)
{
// For JSON-RPC
HashAdminPassword(t->MemberPassword, t->MemberPasswordPlaintext);
}
}
ALog(a, NULL, "LA_SET_FARM_SETTING"); ALog(a, NULL, "LA_SET_FARM_SETTING");
IncrementServerConfigRevision(a->Server); IncrementServerConfigRevision(a->Server);

View File

@ -1160,6 +1160,8 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
s->TotalSendSizeReal += b->Size; s->TotalSendSizeReal += b->Size;
c->CurrentSendQueueSize -= b->Size; c->CurrentSendQueueSize -= b->Size;
Free(new_buf);
} }
FreeBlock(b); FreeBlock(b);

View File

@ -5913,7 +5913,7 @@ void IntoTrafficLimiter(TRAFFIC_LIMITER *tr, PKT *p)
} }
// Value increase // Value increase
tr->Value += p->PacketSize * (UINT64)8; tr->Value += (UINT64)p->PacketSize * (UINT64)8;
} }
// The bandwidth reduction by traffic limiter // The bandwidth reduction by traffic limiter

View File

@ -2181,7 +2181,7 @@ void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UI
break; break;
default: // Without switching default: // Without switching
snprintf(str, size, "%s"); StrCpy(str, size, "");
break; break;
} }

View File

@ -2688,7 +2688,7 @@ IPSECSA *NewIPsecSa(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, bool initiat
// Set the expiration time // Set the expiration time
if (setting->LifeSeconds != 0) if (setting->LifeSeconds != 0)
{ {
UINT64 span = setting->LifeSeconds * (UINT64)1000 + (UINT64)IKE_SOFT_EXPIRES_MARGIN; const UINT64 span = (UINT64)((UINT64)setting->LifeSeconds * (UINT64)1000) + (UINT64)IKE_SOFT_EXPIRES_MARGIN;
sa->ExpiresHardTick = ike->Now + span; sa->ExpiresHardTick = ike->Now + span;
sa->ExpiresSoftTick = ike->Now + span; sa->ExpiresSoftTick = ike->Now + span;
//sa->ExpiresSoftTick = ike->Now + (UINT64)5000; //sa->ExpiresSoftTick = ike->Now + (UINT64)5000;
@ -3740,7 +3740,7 @@ bool IkeIsVendorIdExists(IKE_PACKET *p, char *str)
IKE_PACKET_PAYLOAD *payload = IkeGetPayload(p->PayloadList, IKE_PAYLOAD_VENDOR_ID, i); IKE_PACKET_PAYLOAD *payload = IkeGetPayload(p->PayloadList, IKE_PAYLOAD_VENDOR_ID, i);
if (payload == NULL) if (payload == NULL)
{ {
return false; break;
} }
if (CompareBuf(payload->Payload.VendorId.Data, buf)) if (CompareBuf(payload->Payload.VendorId.Data, buf))

View File

@ -1215,7 +1215,7 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
t = 1; t = 1;
} }
p->DhcpRenewInterval = t * (UINT64)1000; p->DhcpRenewInterval = (UINT64)t * (UINT64)1000;
p->DhcpNextRenewTime = Tick64() + p->DhcpRenewInterval; p->DhcpNextRenewTime = Tick64() + p->DhcpRenewInterval;
if (true) if (true)

View File

@ -221,7 +221,7 @@ bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size)
EAP_PEAP *send_peap_message; EAP_PEAP *send_peap_message;
UINT sz; UINT sz;
sz = ReadBuf(buf, tmp, 200); sz = ReadBuf(buf, tmp, sizeof(tmp));
if (sz == 0) if (sz == 0)
{ {
@ -1856,10 +1856,11 @@ bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT sec
RadiusAddValue(p, RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(ui)); RadiusAddValue(p, RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(ui));
// MS-RAS-Vendor // MS-RAS-Vendor
RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_VERSION, ms_ras_version, StrLen(ms_ras_version)); ui = Endian32(RADIUS_VENDOR_MICROSOFT);
RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_VENDOR, &ui, sizeof(ui));
// MS-RAS-Version // MS-RAS-Version
RadiusAddValue(p, 26, 311, 18, ms_ras_version, StrLen(ms_ras_version)); RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_VERSION, ms_ras_version, StrLen(ms_ras_version));
// NAS-Port-Type // NAS-Port-Type
ui = Endian32(5); ui = Endian32(5);

View File

@ -103,7 +103,7 @@ void SessionMain(SESSION *s)
s->LastCommTime = Tick64(); s->LastCommTime = Tick64();
if (s->ServerMode == false) if (s->ServerMode == false)
{ {
s->NextConnectionTime = Tick64() + s->ClientOption->AdditionalConnectionInterval * (UINT64)1000; s->NextConnectionTime = Tick64() + (UINT64)((UINT64)s->ClientOption->AdditionalConnectionInterval * (UINT64)1000);
} }
s->NumConnectionsEstablished++; s->NumConnectionsEstablished++;
@ -900,7 +900,7 @@ void ClientAdditionalConnectChance(SESSION *s)
(s->NextConnectionTime <= now)) (s->NextConnectionTime <= now))
{ {
// Start the work to put an additional connection // Start the work to put an additional connection
s->NextConnectionTime = now + s->ClientOption->AdditionalConnectionInterval * (UINT64)1000U; s->NextConnectionTime = now + ((UINT64)s->ClientOption->AdditionalConnectionInterval * (UINT64)1000);
SessionAdditionalConnect(s); SessionAdditionalConnect(s);
} }
else else