Commit Graph

693 Commits (170a9b9e760e62f996f7c8c51eae9c69efbed519)

Author SHA1 Message Date
Samuli Seppänen a9f8b98106 Bump version to 11.15.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2020-04-16 16:27:16 +03:00
ikreb7 849d4641eb fix typo 2020-03-24 16:57:34 -04:00
Selva Nair b696a7c16d Optionally allow overwrite when importing a config
- Prompt the user for permission if import may overwrite
  an existing config.

- Also raise an error if the import file source matches the
  global or local config directory. Reimporting a config on to
  itself is not supported. This also  avoids ERROR_SHARING_VIOLATION
  in CopyFile() when source and destination are the same.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-02-27 12:36:17 -05:00
Selva Nair dd7234534b Fix ReadRegValue when data read from a registry key is of zero length
Also if install_path read from registry is an empty string, illegal
memory access may result. Fix by using the default value in this
case as well.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-02-27 11:20:50 -05:00
Selva Nair 2b10316787 Re-queue reading from service only after previous message is handled
The current code re-issues the next read request in the I/O
completion routine before the previous message is fully handled.
This could potentially lead to lost messages as the message buffer
is reused.

Fix by re-queuing the next read from OnService() after duplicating
the previous message.

The length check of the read message is omitted as it is implicitly
checked when scanning the message. Makes the logic simpler.

Reported by Lev Stipakov <lstipakov@gmail.com>

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-02-27 11:20:27 -05:00
Selva Nair 9ad57eb415 Add '--command rescan' to rescan config folders
Add an new command 'rescan' that may be sent to a running
instance of the GUI to force it rescan the config folders.

Use case: with an instance of the is GUI running, one can
manually copy a config file to the config folder and start
it using "openvpn-gui --command rescan" followed by
"openvpn-gui --command connect foo"

v2: The calls to rebuild config file list and recreate
menus is refactored into a function.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-01-12 16:32:51 -05:00
Lev Stipakov 1f6d3d9040 msvc: preliminary support
This adds msvc project files and tiny code changes,
required to build this project with msvc.

Microsoft resource compiler, unlike mingw's windres,
doesn't fully support macros and multi-line strings,
so I had to create a separate resource file for msvc.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-11-26 10:04:45 -05:00
Lev Stipakov 4ca344819f main.c: remove unneeded header
We don't use any of PBT_* macros.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-11-26 10:04:45 -05:00
Selva Nair 307bb34fa9 Do not add CRLF to base64 encoded output
By default CryptBinaryToString used for base64 encoding
adds CRLF every 76 characters or so. As LF is used as
the message delimiter by the management interface, this breaks
handling of static challenge.

Fix by setting CRYPT_STRING_NOCRLF in the flags. With this
change, the trailing '\r\n' removal is no longer required.

Fixes Issue 317: https://github.com/OpenVPN/openvpn-gui/issues/317

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-11-25 12:39:25 -05:00
Samuli Seppänen 74eb72d478 Bump version to 11.14.0.0
Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
2019-10-30 14:38:23 +02:00
Lev Stipakov 1c8c7f1f62 res/openvpn-gui-res-fi.rc: add missing IDS_MENU_RECONNECT translation
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-09-23 14:25:41 +02:00
e2e8 4d8e7a785d remove g++ from required cygwin packages 2019-09-09 12:17:45 -04:00
e2e8 68aa1df4c7 set focus to challenge when password already filled 2019-09-09 12:17:45 -04:00
Selva Nair 5ab2a48ba0 Promptly close pipe handles passed to child
Parent keeping the handle to write end of child's stdout will
cause ERROR_BROKEN_PIPE not signalled if/when the child exits.

Also add a wrapper for CloseHandle()

Fixes the GUI process hanging in read from child
if the latter unexpectedly dies due to some error.
Trac #1203

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-07-01 08:32:18 +02:00
Samuli Seppänen 72649a3ad7 Bump version to 11.13.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2019-04-19 18:28:39 +03:00
Gert Doering 3c01d8eab3
Merge pull request #298 from selvanair/default-sublang
Fallback to default sublanguage when loading resources
2019-03-29 20:03:28 +01:00
Gert Doering 250ad91f94
Merge pull request #299 from naftalmm/patch-1
Update openvpn-gui-res-ru.rc
2019-03-29 09:08:27 +01:00
naftalmm ee18f8fb1d
Update openvpn-gui-res-ru.rc 2019-03-29 01:01:44 +03:00
Selva Nair 87c5e16723 Fallback to default sublanguage when loading resources
When a resource is not found in user's preferred language, first
try the primary language with SUBLANG set to default before
falling back to English.

See: https://github.com/OpenVPN/openvpn-gui/issues/216

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-03-26 18:05:31 -04:00
Selva Nair f66a052a05 Delete extra arg to swprintf() in format_bytecount()
Found by cppcheck

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-03-18 10:58:59 -04:00
Selva Nair 6ad90b92a1 Add missing va_end() in MsgToEventLog()
Found by cppcheck

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-03-18 10:58:59 -04:00
Ilya Shipitsin ad1640d56d env_set.c: remove redundant check
found by cppcheck

[env_set.c:332] -> [env_set.c:333]: (warning) Either the condition '!msg' is redundant or there is possible null pointer dereference: msg.
2019-03-17 13:54:36 -04:00
Ilya Shipitsin bfcf3b4679 main.c: resolve possible null pointer dereference
found by cppcheck

[main.c:457] -> [main.c:457]: (warning) Either the condition 'copy_data->dwData==(WM_APP+15)&&c->hwndStatus&&c' is redundant or there is possible null pointer dereference: c.
2019-03-17 13:54:36 -04:00
Ilya Shipitsin fc3d96bd73 travis-ci: switch to xenial, disable cppcheck
cppcheck on xenial "finds" some false errors,
disable it for a while
2019-03-17 13:54:36 -04:00
Ilya Shipitsin 13d54119e1 App Veyor: skip travis-ci builds 2019-03-17 13:54:36 -04:00
Samuli Seppänen 8a93336c97 Bump version to 11.12.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2019-02-20 14:29:12 +02:00
Luca Badin 955045b3ef Updated Italian localization
Signed-off-by: Luca Badin <lucabad97@gmail.com>
2019-02-13 16:36:05 -05:00
Gert Doering 82c5af474a
Merge pull request #289 from Joungkyun/master
update korean resource file
2019-02-11 18:58:05 +01:00
Selva Nair 7bfb950852 Bug fix config-group data structure
As config group is reallocated when full, do not store the pointer to the
parent group. Instead use the id of the group which is invariant across
reallocs. Similarly in connection array store the id of the group
instead of a pointer.

Also

- Do not call ActivateConfigGroups() -- when connections are active:
  in this case we want preserve config data structures during rescan.

Signed-off-by: Selva Nair <selva.nair@gmail.com>

fixup
2019-02-11 11:51:23 -05:00
Selva Nair f55eeb1da8 Eliminate MAX_CONFIGS limit using a dynamic array
The number of configs is now unlimited. But there is a limit
of 2^16 menu items which permits only about 2^12 configs to be
displayed in the menu. A warning is shown if the number of
configs exceeds this value.

For a responsive menu keep the number of configs under ~1000.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-02-11 11:51:23 -05:00
Selva Nair a9898d3819 Add a registry key for choosing config menu view
Add a new registry key (DWORD): config_menu_vew
   possible values:  0 (auto), 1 (flat), 2 (nested).

Default value is 0 which renders nested menu if the number of
configs is > 50, else displays the current flat view. To force
the flat menu view set it to 1. A value of 2 forces the nested
view even if there are only a few configs.

A new command line option "--config_menu_view n" does the same.
Command line options take precedence over any value set in the
registry.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-02-11 11:51:23 -05:00
Selva Nair 2d64cb5603 Provide support for a hierarchical config menu listing
- Shows all configs in a subdirectory grouped into a
  submenu entry. This hopefully provided a better UX when
  there are more than a few 10's of config files.

- Enabled only if number of configs is > 50 or if the
  option config_menu_view is set to 2.
  To force the current flat listing, set config_menu_view = 1.

TODO: Make config_menu_view user configurable.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-02-11 11:51:23 -05:00
Selva Nair 567efd1f45 In config menu squash directories containing a single config
- Single configs all by itself in a directory are shown as a
  member of the parent directory. This allows keeping every
  config in its own directory without causing an additional
  level of nesting. Eg., import always put each config in
  its own directory.

  Improves the menu navigation.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-02-11 11:51:23 -05:00
Selva Nair 398a771840 Group configs based on the directory structure to support a nested view
- Group all configs in a subdirectory with directory name
  as the label.

- If any connection is active, newly found configs are
  added to the root group to keep the logic simple.

- Directory hierarchy is scanned up to a depth of 4: i.e.,
  config_dir and global_config_dir and its subdirectories
  up to 3 levels down.

Only support for scanning configs and attaching group labels
is added here. Rendering the nested menu is the subject of
a later commit.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-02-11 11:51:23 -05:00
Selva Nair 0702acf70c Remove the limit on number of config subdirectories
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-02-11 11:51:23 -05:00
JoungKyun Kim e5855f9eaa synchronized the korean resource files with the english version 2019-02-12 00:08:21 +09:00
Selva Nair 4cb55f1e58 Ignore pushed --route-method when interactive service is in use
When using interactive service, route addition should use the
service. The user may not have privileges to set routes
otherwise.  We already override any --route-method set in the
config file as openvpn.exe is started with --msg-channel as the
last option which sets route-method to ROUTE_METHOD_SERVICE.

This patch extends that to pushed --route-method

Also change _T("") to L"" in the edited lines to be explicit about
wide and narrow strings. We no longer support non-unicode builds.

No change when interactive service is not used.

Ref: issue #281

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-11-22 12:56:54 -05:00
Selva Nair 89509747f1 Remove service-only checkbox from settings menu
- This checkbox is inactive and does nothing.

  The service-only  usage can be still activated using the command
  line option --service_only  or by editing the registry, but its
  not a recommended use case for GUI version 11.0 and above.

See also issue: #264

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-06-16 16:32:27 -04:00
Selva Nair b53c8a758e Fix display of assigned IPs when IPv4 address is absent
- In tray info do not skip the address when v4 ip is absent

- When combining two strings do not add the separator (comma)
  if either is empty.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-06-16 16:29:52 -04:00
Selva Nair 3ba0615140 Clear c->ip and c->ipv6 buffers before reset
Trac: #1064
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-06-16 16:29:52 -04:00
speadup 0f3ed6c653 add Chinese (Simplified) localization 2018-05-25 21:51:52 -04:00
Andres Ofner 30097d43cb Add shortcuts (mnemonics) to GUI elements 2018-05-02 02:06:39 -04:00
Selva Nair 343643657f Log --command option errors to the event log
This supplements the non-zero exit-code.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-04-24 09:03:16 +03:00
Selva Nair 1cb07f92f3 Fix detection of running instance
When openvpn is run with --help option it pops up a help
message and exits when that window is closed. Such instances
cannot accept any commands and should not be treated as a
running instance.

Fix by
(i) When run with --help, promptly release the semaphore used
to restrict to a single running instance.

(ii) Wait for a short interval (200 msec) before timing out of
locking the semaphore. This helps avoid race conditions.

While at it also make sure the semaphore is released and closed
on exit.

Fixes issue: #237

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-04-24 09:03:16 +03:00
Selva Nair c51fd4450d Support for 'setenv name var' using echo
- Implement connection specific env variables. These are merged
  with the process environment strings and passed to scripts.

- To set an env variable, use 'echo setenv name value' in the config
  or push from the server. This will set "OPENVPN_name=value" in
  the connections's env set. Note that "name" is mangled as
  "OPENVPN_name" to avoid servers overwriting sensitive variables
  such as PATH. Names are set in the order received and same name
  overwrites any previously set value.

- Environment variable names are allowed to contain only alpha numeric
  characters and underscore as in openvpn.exe. But, unlike openvpn.exe,
  invalid names are ignored, not sanitized.

v2 changes (Dec 16, 2017):

- If value is missing, the directive is interpreted as a delete command
  and the env var with matching name in the connection's env set is removed.

- Windows needs env block to be ordered:
  While merging connection specific env vars with process env block, order
  the entries 'alphabetically' (locale independent, case insensitive
  unicode ordinal order). In case of duplicates, the value in connection
  env set replaces the one in process env.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-04-23 22:05:05 +03:00
Ilya Shipitsin 9ceb2d25e5 travis-ci: switch to openssl-1.1.0 by default 2018-04-23 22:03:31 +03:00
Selva Nair 2f5084d47e Set a fall back for editor if file association fails
- When registry keys were simplified, the log viewer and editor
  entries were removed in favour of file associations that the
  user can independently control.

  Yet, there are times when an associated application fails to start
  or no associations are present etc., and its useful to have a fall
  back editor setting to open config and log files.
  This patch sets that default as "notepad.exe"

- Also remove the unused profile_dir[] in registry.c
  and have add a default for Windows directory

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-04-23 15:49:10 +03:00
Erwin Bronkhorst 52b1647a57 Add Dutch translations for recently added resources 2018-04-23 15:46:26 +03:00
Selva Nair 14615356e5 Do not clear saved passwords on verification failure
After a failure the auth-pass dialog is shown with the password
field prefilled but highlighted. This allows the user to easily
overwrite the password or resubmit the old password if the
failure was temporary.

After a private key passphrase failure, the dialog is not
prefilled with saved password as this failure happens locally
and in such cases the password is very likely wrong.

If the user aborts the dialog by pressing cancel, the saved
password will get used during the next connection attempt.

Wrong username or password warning text is changed to: "Wrong
credentials".

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2018-04-23 15:41:03 +03:00
Ilya Shipitsin 4a4a6ab52f remove unused resource
after https://github.com/OpenVPN/openvpn-gui/pull/188 that string
is not used anymore
2018-04-23 15:39:47 +03:00