mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
/hostname and /password
This commit is contained in:
parent
6f031a61fb
commit
9a574f5300
@ -11743,7 +11743,7 @@ RETRY:
|
|||||||
// Attempt to connect
|
// Attempt to connect
|
||||||
if ((cm->Client = CcConnectRpc(
|
if ((cm->Client = CcConnectRpc(
|
||||||
cm->server_name == NULL ? "localhost" : cm->server_name,
|
cm->server_name == NULL ? "localhost" : cm->server_name,
|
||||||
"", &bad_pass, &no_remote, cm->StartupMode == false ? 0 : 60000)) == NULL)
|
cm->password == NULL ? "" : cm->password, &bad_pass, &no_remote, cm->StartupMode == false ? 0 : 60000)) == NULL)
|
||||||
{
|
{
|
||||||
if (no_remote)
|
if (no_remote)
|
||||||
{
|
{
|
||||||
@ -11801,40 +11801,69 @@ void MainCM()
|
|||||||
// If there is /remote in the argument, show the screen of the remote connection
|
// If there is /remote in the argument, show the screen of the remote connection
|
||||||
TOKEN_LIST *cmdline = GetCommandLineToken();
|
TOKEN_LIST *cmdline = GetCommandLineToken();
|
||||||
|
|
||||||
if (cmdline->NumTokens >= 1)
|
UINT i = 0;
|
||||||
{
|
bool isRemote = false;
|
||||||
if (StrCmpi(cmdline->Token[0], "/remote") == 0)
|
|
||||||
{
|
|
||||||
if (cmdline->NumTokens >= 2)
|
|
||||||
{
|
|
||||||
cm->server_name = CopyStr(cmdline->Token[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *hostname = RemoteDlg(NULL, CM_REG_KEY, ICO_VPN, _UU("CM_TITLE"), _UU("CM_REMOTE_TITLE"), NULL);
|
|
||||||
if (hostname == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (cm->server_name != NULL)
|
|
||||||
{
|
|
||||||
Free(cm->server_name);
|
|
||||||
}
|
|
||||||
cm->server_name = NULL;
|
|
||||||
if (StrCmpi(hostname, "localhost") != 0 && StrCmpi(hostname, "127.0.0.1") != 0 )
|
|
||||||
{
|
|
||||||
cm->server_name = hostname;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrCmpi(cmdline->Token[0], "/startup") == 0)
|
if (cm->server_name != NULL)
|
||||||
|
{
|
||||||
|
Free(cm->server_name);
|
||||||
|
}
|
||||||
|
cm->server_name = NULL;
|
||||||
|
|
||||||
|
if (cm->password != NULL)
|
||||||
|
{
|
||||||
|
Free(cm->password);
|
||||||
|
}
|
||||||
|
cm->password = NULL;
|
||||||
|
|
||||||
|
for(i = 0; i < cmdline->NumTokens; ++i)
|
||||||
|
{
|
||||||
|
if (StrCmpi(cmdline->Token[i], "/remote") == 0)
|
||||||
|
{
|
||||||
|
isRemote = true;
|
||||||
|
}
|
||||||
|
else if (StrCmpi(cmdline->Token[i], "/hostname") == 0 && i + 1 < cmdline->NumTokens)
|
||||||
|
{
|
||||||
|
isRemote = true;
|
||||||
|
if (cm->server_name != NULL)
|
||||||
|
{
|
||||||
|
Free(cm->server_name);
|
||||||
|
}
|
||||||
|
cm->server_name = CopyStr(cmdline->Token[++i]);
|
||||||
|
}
|
||||||
|
else if (StrCmpi(cmdline->Token[i], "/password") == 0 && i + 1 < cmdline->NumTokens)
|
||||||
|
{
|
||||||
|
if (cm->password != NULL)
|
||||||
|
{
|
||||||
|
Free(cm->password);
|
||||||
|
}
|
||||||
|
cm->password = CopyStr(cmdline->Token[++i]);
|
||||||
|
}
|
||||||
|
else if (StrCmpi(cmdline->Token[i], "/startup") == 0)
|
||||||
{
|
{
|
||||||
// Startup mode
|
// Startup mode
|
||||||
cm->StartupMode = true;
|
cm->StartupMode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isRemote && cm->server_name == NULL)
|
||||||
|
{
|
||||||
|
char *hostname = RemoteDlg(NULL, CM_REG_KEY, ICO_VPN, _UU("CM_TITLE"), _UU("CM_REMOTE_TITLE"), NULL);
|
||||||
|
if (hostname == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cm->server_name != NULL)
|
||||||
|
{
|
||||||
|
Free(cm->server_name);
|
||||||
|
}
|
||||||
|
cm->server_name = NULL;
|
||||||
|
if (StrCmpi(hostname, "localhost") != 0 && StrCmpi(hostname, "127.0.0.1") != 0 )
|
||||||
|
{
|
||||||
|
cm->server_name = hostname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FreeToken(cmdline);
|
FreeToken(cmdline);
|
||||||
|
|
||||||
if (IsZero(cm->ShortcutKey, SHA1_SIZE) == false)
|
if (IsZero(cm->ShortcutKey, SHA1_SIZE) == false)
|
||||||
|
@ -136,6 +136,7 @@ typedef struct CM
|
|||||||
HWND hStatusBar;
|
HWND hStatusBar;
|
||||||
REMOTE_CLIENT *Client;
|
REMOTE_CLIENT *Client;
|
||||||
char *server_name;
|
char *server_name;
|
||||||
|
char *password;
|
||||||
wchar_t *import_file_name;
|
wchar_t *import_file_name;
|
||||||
bool HideStatusBar;
|
bool HideStatusBar;
|
||||||
bool HideTrayIcon;
|
bool HideTrayIcon;
|
||||||
|
Loading…
Reference in New Issue
Block a user