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:
authorDaiyuu Nobori <da.git@softether.co.jp>2014-02-16 20:05:37 +0400
committerDaiyuu Nobori <da.git@softether.co.jp>2014-02-16 20:05:37 +0400
commitbad6a4c22baf11b855e2afbf3e9960ef7d013a50 (patch)
tree93cf962130f0b875496d7b631445583d204f2e2b
parent4abd47fd9a7a5fcc11310fa391d33155d1b5937c (diff)
parent9a574f5300cadc7bf9aec0aa0092c595ac35f532 (diff)
Merge pull request #23 from el1n/autoconnect
Client Manager supporting /hostname and /password
-rw-r--r--src/Cedar/CM.c59
-rw-r--r--src/Cedar/CMInner.h1
2 files changed, 50 insertions, 10 deletions
diff --git a/src/Cedar/CM.c b/src/Cedar/CM.c
index cef8113a..7d8194fb 100644
--- a/src/Cedar/CM.c
+++ b/src/Cedar/CM.c
@@ -11743,7 +11743,7 @@ RETRY:
// Attempt to connect
if ((cm->Client = CcConnectRpc(
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)
{
@@ -11799,9 +11799,54 @@ RETRY:
void MainCM()
{
// If there is /remote in the argument, show the screen of the remote connection
- char *cmdline = GetCommandLineStr();
+ TOKEN_LIST *cmdline = GetCommandLineToken();
- if (StrCmpi(cmdline, "/remote") == 0)
+ UINT i = 0;
+ bool isRemote = false;
+
+ 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
+ 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)
@@ -11819,13 +11864,7 @@ void MainCM()
}
}
- if (StrCmpi(cmdline, "/startup") == 0)
- {
- // Startup mode
- cm->StartupMode = true;
- }
-
- Free(cmdline);
+ FreeToken(cmdline);
if (IsZero(cm->ShortcutKey, SHA1_SIZE) == false)
{
diff --git a/src/Cedar/CMInner.h b/src/Cedar/CMInner.h
index 21472e38..82d9365c 100644
--- a/src/Cedar/CMInner.h
+++ b/src/Cedar/CMInner.h
@@ -136,6 +136,7 @@ typedef struct CM
HWND hStatusBar;
REMOTE_CLIENT *Client;
char *server_name;
+ char *password;
wchar_t *import_file_name;
bool HideStatusBar;
bool HideTrayIcon;