// WinMain int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR CmdLine32, int CmdShow) { char CmdLine[MAX_PATH]; UINT wp; wp = 0; while (TRUE) { CmdLine[wp++] = *CmdLine32; if (*CmdLine32 == 0) { break; } CmdLine32++; } if (strlen(CmdLine) == 0 || strlen(CmdLine) >= 5 || IsSafeStr(CmdLine) == FALSE) { Print("Please execute VPN Client Connection Manager."); } else { InstallMain(CmdLine); } return 0; }
// Add an interface bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet) { L3IF *f; bool ret = false; // Validate arguments if (s == NULL || hubname == NULL || IsSafeStr(hubname) == false || ip == 0 || ip == 0xffffffff) { return false; } Lock(s->lock); { if (LIST_NUM(s->TableList) >= GetServerCapsInt(s->Cedar->Server, "i_max_l3_if")) { // Too many } else { if (s->Active == false) { // Examine whether the interface is already in the same Virtual HUB if (L3SearchIf(s, hubname) == NULL) { // Add f = ZeroMalloc(sizeof(L3IF)); f->Switch = s; StrCpy(f->HubName, sizeof(f->HubName), hubname); f->IpAddress = ip; f->SubnetMask = subnet; Insert(s->IfList, f); ret = true; } } } } Unlock(s->lock); return ret; }
// Check the name is valid for account name bool IsUserName(char *name) { char tmp[MAX_SIZE]; // Validate arguments if (name == NULL) { return false; } StrCpy(tmp, sizeof(tmp), name); name = tmp; Trim(name); if (StrLen(name) == 0) { return false; } if (StrCmpi(name, "*") == 0) { return true; } if (IsSafeStr(name) == false) { return false; } if (StrCmpi(name, LINK_USER_NAME) == 0) { return false; } if (StartWith(name, L3_USERNAME)) { return false; } if (StrCmpi(name, LINK_USER_NAME_PRINT) == 0) { return false; } if (StrCmpi(name, SNAT_USER_NAME) == 0) { return false; } if (StrCmpi(name, SNAT_USER_NAME_PRINT) == 0) { return false; } if (StrCmpi(name, BRIDGE_USER_NAME) == 0) { return false; } if (StrCmpi(name, BRIDGE_USER_NAME_PRINT) == 0) { return false; } if (StrCmpi(name, ADMINISTRATOR_USERNAME) == 0) { return false; } return true; }