From 91b3eef40a5960a948161daf2b204fa808dc0085 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Mon, 2 Jan 2017 14:17:25 -0500 Subject: [PATCH 1/2] Mark status as connected only if openvpn reports CONNECTED,SUCCESS Avoid reporting a connection that completed with errors (state change message = CONNECTED,ERROR) as successful. Signed-off-by: Selva Nair --- openvpn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn.c b/openvpn.c index ec636f5..6671434 100644 --- a/openvpn.c +++ b/openvpn.c @@ -191,7 +191,7 @@ OnStateChange(connection_t *c, char *data) return; *pos = '\0'; - if (strcmp(state, "CONNECTED") == 0) + if (strcmp(state, "CONNECTED") == 0 && strcmp(message, "SUCCESS") == 0) { /* Run Connect Script */ if (c->state == connecting || c->state == resuming) From 9cea37ad806bb935f81cc178229b80526946f506 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Mon, 2 Jan 2017 14:29:19 -0500 Subject: [PATCH 2/2] Suppress warning popups if silent_connection is set Warnings dsabled if silent_connection is true - interactive service is not installed or not running - duplicate configs found and ignored v2: Update description of --silent_connection in README and English resource file (translations not updated). Signed-off-by: Selva Nair --- README.rst | 3 ++- main.c | 2 +- openvpn_config.c | 3 +++ res/openvpn-gui-res-en.rc | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d22b4a0..3ff739a 100644 --- a/README.rst +++ b/README.rst @@ -185,7 +185,8 @@ log_append silent_connection If set to "1", the status window with the OpenVPN log output will - not be showed while connecting. + not be shown while connecting. Warnings such as interactive service + not started or multiple config files with same name are also suppressed. service_only If set to "1", OpenVPN GUI's normal "Connect" and "Disconnect" diff --git a/main.c b/main.c index b3bf2c7..b1eef79 100644 --- a/main.c +++ b/main.c @@ -189,7 +189,7 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, exit(1); } - if (!IsUserAdmin() && strtod(o.ovpn_version, NULL) > 2.3) + if (!IsUserAdmin() && strtod(o.ovpn_version, NULL) > 2.3 && !o.silent_connection) CheckIServiceStatus(TRUE); BuildFileList(); diff --git a/openvpn_config.c b/openvpn_config.c index cccc800..225bd57 100644 --- a/openvpn_config.c +++ b/openvpn_config.c @@ -221,6 +221,9 @@ BuildFileList() { static bool issue_warnings = true; + if (o.silent_connection) + issue_warnings = false; + /* * If no connections are active reset num_configs and rescan * to make a new list. Else we keep all current configs and diff --git a/res/openvpn-gui-res-en.rc b/res/openvpn-gui-res-en.rc index cc35edb..e2ee8ac 100644 --- a/res/openvpn-gui-res-en.rc +++ b/res/openvpn-gui-res-en.rc @@ -355,7 +355,7 @@ BEGIN "--allow_proxy\t\t: 1=Show Proxy Settings menu.\n" \ "--show_balloon\t\t: 0=Never, 1=At initial connect, 2=At every re-connect.\n" \ "--service_only\t\t: 1=Enable Service Only mode.\n" \ - "--silent_connection\t\t: 1=Do not show the status dialog while connecting.\n" \ + "--silent_connection\t\t: 1=Do not show the status dialog while connecting or non-critical warnings at startup.\n" \ "--show_script_window\t: 0=Hide Script execution window, 1=Show it.\n" \ "--passphrase_attempts\t: Number of passphrase attempts to allow.\n" \ "--connectscript_timeout\t: Time to wait for connect script to finish.\n" \