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

Merge pull request #204 from LegDog/master

Adding Radius AVP Called-Station-Id
This commit is contained in:
Daiyuu Nobori
2016-11-27 17:53:45 +09:00
committed by GitHub
6 changed files with 84 additions and 6 deletions

View File

@ -6069,8 +6069,9 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
SOCK *s;
UINT num = 0, max = 19;
SERVER *server;
char hostname[64];
char *vpn_http_target = HTTP_VPN_TARGET2;
bool check_hostname = false;
bool check_hostname = true;
// Validate arguments
if (c == NULL)
{
@ -6078,7 +6079,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
}
strcpy(hostname, "");
server = c->Cedar->Server;
s = c->FirstSock;
@ -6108,7 +6109,6 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
if (check_hostname && (StrCmpi(h->Version, "HTTP/1.1") == 0 || StrCmpi(h->Version, "HTTP/1.2") == 0))
{
HTTP_VALUE *v;
char hostname[64];
Zero(hostname, sizeof(hostname));
@ -6343,6 +6343,12 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
}
}
if ((b == false) && (StartWith(h->Target, "/wiki")))
{
HttpSendRedirect(s, h->Target, hostname);
b = true;
}
if (b == false)
{
// Not Found

View File

@ -1702,7 +1702,7 @@ LABEL_ERROR:
////////// Classical implementation
// Attempts Radius authentication (with specifying retry interval and multiple server)
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,
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)
{
UCHAR random[MD5_SIZE];
@ -1881,6 +1881,9 @@ bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT sec
ui = Endian32(1);
RadiusAddValue(p, 65, 0, 0, &ui, sizeof(ui));
// Called-Station-Id
RadiusAddValue(p, 30, 0, 0, hubname, StrLen(hubname));
// Calling-Station-Id
RadiusAddValue(p, 31, 0, 0, client_ip_str, StrLen(client_ip_str));
@ -1931,6 +1934,9 @@ bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT sec
ui = Endian32(1);
RadiusAddValue(p, 65, 0, 0, &ui, sizeof(ui));
// Called-Station-Id
RadiusAddValue(p, 30, 0, 0, hubname, StrLen(hubname));
// Calling-Station-Id
RadiusAddValue(p, 31, 0, 0, client_ip_str, StrLen(client_ip_str));

View File

@ -374,7 +374,7 @@ struct RADIUS_LOGIN_OPTION
};
// Function prototype
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,
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);
BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size);
BUF *RadiusCreateUserName(wchar_t *username);

View File

@ -265,7 +265,7 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
if (UniIsEmptyStr(suffix_filter_w) || UniEndWith(name, suffix_filter_w))
{
// Attempt to login
b = RadiusLogin(c, radius_server_addr, radius_server_port,
b = RadiusLogin(c, hub->Name, radius_server_addr, radius_server_port,
radius_secret, StrLen(radius_secret),
name, password, interval, mschap_v2_server_response_20, opt);