Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cedar/Account.c')
-rw-r--r--src/Cedar/Account.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Cedar/Account.c b/src/Cedar/Account.c
index 192048df..7d3a17cd 100644
--- a/src/Cedar/Account.c
+++ b/src/Cedar/Account.c
@@ -1439,3 +1439,50 @@ int CompareUserName(void *p1, void *p2)
return StrCmpi(u1->Name, u2->Name);
}
+// Get the MAC address from the user's note string
+bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note)
+{
+ bool ret = false;
+ UINT i;
+
+ Zero(mac, 6);
+ if (mac == NULL || note == NULL)
+ {
+ return false;
+ }
+
+ i = UniSearchStrEx(note, USER_MAC_STR_PREFIX, 0, false);
+ if (i != INFINITE)
+ {
+ wchar_t *macstr_start = &note[i + UniStrLen(USER_MAC_STR_PREFIX)];
+ wchar_t macstr2[MAX_SIZE];
+ UNI_TOKEN_LIST *tokens;
+
+ UniStrCpy(macstr2, sizeof(macstr2), macstr_start);
+
+ UniTrim(macstr2);
+
+ tokens = UniParseToken(macstr2, L" ,/()[].");
+ if (tokens != NULL)
+ {
+ if (tokens->NumTokens >= 1)
+ {
+ wchar_t *macstr = tokens->Token[0];
+
+ if (UniIsEmptyStr(macstr) == false)
+ {
+ char macstr_a[MAX_SIZE];
+
+ UniToStr(macstr_a, sizeof(macstr_a), macstr);
+
+ ret = StrToMac(mac, macstr_a);
+ }
+ }
+
+ UniFreeToken(tokens);
+ }
+ }
+
+ return ret;
+}
+