mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-07-10 01:34:58 +03:00
v4.22-9634-beta
This commit is contained in:
@ -686,6 +686,11 @@ void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e)
|
||||
ui = Endian32(5);
|
||||
Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(UINT)));
|
||||
|
||||
if (IsEmptyStr(e->CalledStationStr) == false)
|
||||
{
|
||||
Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, e->CalledStationStr, StrLen(e->CalledStationStr)));
|
||||
}
|
||||
|
||||
Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, e->ClientIpStr, StrLen(e->ClientIpStr)));
|
||||
|
||||
Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, e->ClientIpStr, StrLen(e->ClientIpStr)));
|
||||
@ -1237,7 +1242,7 @@ bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r)
|
||||
}
|
||||
|
||||
// New EAP client
|
||||
EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username)
|
||||
EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname)
|
||||
{
|
||||
EAP_CLIENT *e;
|
||||
if (server_ip == NULL)
|
||||
@ -1266,6 +1271,7 @@ EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, U
|
||||
e->GiveupTimeout = giveup_timeout;
|
||||
StrCpy(e->SharedSecret, sizeof(e->SharedSecret), shared_secret);
|
||||
|
||||
StrCpy(e->CalledStationStr, sizeof(e->CalledStationStr), hubname);
|
||||
StrCpy(e->ClientIpStr, sizeof(e->ClientIpStr), client_ip_str);
|
||||
StrCpy(e->Username, sizeof(e->Username), username);
|
||||
e->LastRecvEapId = 0;
|
||||
@ -1702,8 +1708,8 @@ LABEL_ERROR:
|
||||
////////// Classical implementation
|
||||
|
||||
// Attempts Radius authentication (with specifying retry interval and multiple server)
|
||||
bool RadiusLogin(CONNECTION *c, char *hubname, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20,
|
||||
RADIUS_LOGIN_OPTION *opt)
|
||||
bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20,
|
||||
RADIUS_LOGIN_OPTION *opt, char *hubname)
|
||||
{
|
||||
UCHAR random[MD5_SIZE];
|
||||
UCHAR id;
|
||||
@ -1835,7 +1841,7 @@ bool RadiusLogin(CONNECTION *c, char *hubname, char *server, UINT port, UCHAR *s
|
||||
BUF *user_password = (is_mschap ? NULL : RadiusCreateUserPassword(encrypted_password->Buf, encrypted_password->Size));
|
||||
BUF *nas_id;
|
||||
|
||||
if (IsEmptyStr(opt->NasId) == true)
|
||||
if (IsEmptyStr(opt->NasId))
|
||||
{
|
||||
nas_id = RadiusCreateNasId(CEDAR_SERVER_STR);
|
||||
}
|
||||
@ -1890,8 +1896,11 @@ bool RadiusLogin(CONNECTION *c, char *hubname, char *server, UINT port, UCHAR *s
|
||||
ui = Endian32(1);
|
||||
RadiusAddValue(p, 65, 0, 0, &ui, sizeof(ui));
|
||||
|
||||
// Called-Station-Id
|
||||
RadiusAddValue(p, 30, 0, 0, hubname, StrLen(hubname));
|
||||
// Called-Station-ID - VPN Hub Name
|
||||
if (IsEmptyStr(hubname) == false)
|
||||
{
|
||||
RadiusAddValue(p, 30, 0, 0, hubname, StrLen(hubname));
|
||||
}
|
||||
|
||||
// Calling-Station-Id
|
||||
RadiusAddValue(p, 31, 0, 0, client_ip_str, StrLen(client_ip_str));
|
||||
@ -1943,8 +1952,11 @@ bool RadiusLogin(CONNECTION *c, char *hubname, char *server, UINT port, UCHAR *s
|
||||
ui = Endian32(1);
|
||||
RadiusAddValue(p, 65, 0, 0, &ui, sizeof(ui));
|
||||
|
||||
// Called-Station-Id
|
||||
RadiusAddValue(p, 30, 0, 0, hubname, StrLen(hubname));
|
||||
// Called-Station-ID - VPN Hub Name
|
||||
if (IsEmptyStr(hubname) == false)
|
||||
{
|
||||
RadiusAddValue(p, 30, 0, 0, hubname, StrLen(hubname));
|
||||
}
|
||||
|
||||
// Calling-Station-Id
|
||||
RadiusAddValue(p, 31, 0, 0, client_ip_str, StrLen(client_ip_str));
|
||||
|
Reference in New Issue
Block a user