mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Merge pull request #1980 from Alexey-I/master
OpenVPN certificate authorization with cn_username in 'email' format
This commit is contained in:
commit
465df16505
@ -6773,7 +6773,6 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
|
|||||||
|
|
||||||
p = NewPack();
|
p = NewPack();
|
||||||
PackAddStr(p, "method", "login");
|
PackAddStr(p, "method", "login");
|
||||||
PackAddStr(p, "hubname", hubname);
|
|
||||||
|
|
||||||
if (IsEmptyStr(username))
|
if (IsEmptyStr(username))
|
||||||
{
|
{
|
||||||
@ -6782,12 +6781,26 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
|
|||||||
FreePack(p);
|
FreePack(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName);
|
UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName);
|
||||||
PackAddStr(p, "username", cn_username);
|
|
||||||
|
if (strchr(cn_username, '@') != NULL)
|
||||||
|
|
||||||
|
{
|
||||||
|
PackAddStr(p, "username", strtok(cn_username, "@"));
|
||||||
|
PackAddStr(p, "hubname", strtok(NULL, ""));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PackAddStr(p, "username", cn_username);
|
||||||
|
PackAddStr(p, "hubname", hubname);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PackAddStr(p, "username", username);
|
PackAddStr(p, "username", username);
|
||||||
|
PackAddStr(p, "hubname", hubname);
|
||||||
}
|
}
|
||||||
|
|
||||||
PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT);
|
PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT);
|
||||||
|
Loading…
Reference in New Issue
Block a user