mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
OpenVPN certificate authorization with cn_username in 'email' format
This commit is contained in:
parent
ca832a9cef
commit
71d71e51db
@ -6773,7 +6773,6 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
|
||||
|
||||
p = NewPack();
|
||||
PackAddStr(p, "method", "login");
|
||||
PackAddStr(p, "hubname", hubname);
|
||||
|
||||
if (IsEmptyStr(username))
|
||||
{
|
||||
@ -6782,12 +6781,25 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
|
||||
FreePack(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName);
|
||||
|
||||
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
|
||||
{
|
||||
PackAddStr(p, "username", username);
|
||||
PackAddStr(p, "hubname", hubname);
|
||||
}
|
||||
|
||||
PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT);
|
||||
|
Loading…
Reference in New Issue
Block a user