Commit Graph

577 Commits (273322efb066a0b5e04ee160e0eeda6272fe9c00)

Author SHA1 Message Date
Selva Nair 273322efb0 Add a From line at the top of new echo messages
This adds context to the message in the form:
"From: config-name date/time text" displayed as right-aligned
and in italics.

Also remove the show argument to AddMessageBoxText() and move ShowWindow()
to the caller.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair ba05ea0de9 Detect urls in echo message make them clickable
- Left clickng on http or https url will open it on the default browser

Several other URL schemes are detected and formatted as clickable
links, but we only support opening of http/https links.

Note on spaces in URLs: We unescape all %xx occurrences in the echo
message text so that %20 will be converted to space in plain text.
This means embedded spaces in URLs will not work even if written
as %20. An option is to use %2520 which will get conveted to %20
after the unescaping.
A better option is to enclose the URL in <>. If the
text inside <> starts with a valid scheme (http, https etc.),
the entire text including spaces is parsed as the URL.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 482bf586df Persist echo msg history in registry
- Echo msg history saved to registry on disconnect and loaded on
  reconnect.
- Muting of repeated messages now work across GUI restarts.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 82e17b239e Mute echo message if repeated or disabled
- Suppress messages with exactly same content as previously
  displayed within popup_mute_interval (24h by default). This parameter
  may be set on command line as "--popup_mute_interval n" where n is
  in hours.

- Command line option '--disable_popup_messages' disables all echo
  message popups (window and notification).

This patch only handles suppression of repeated messages during
reconnections.
TODO: Persist message history in the registry and use it to mute
repeated messages after disconnects and across restarts of the GUI.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 9c914305d9 Implement SHA1 digest of echo message
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 3f896b002b Implement display of echo message window
- Add a message box that support appending messages with
  a title formatted at a larger font and a text
  displayed in the default font.
- A global instance of the message box is used to
  display messages from all profiles.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Selva Nair 00732e1d9e Parse and display messages received by echo msg commands
Process four new echo commands to construct messages to be
displayed to the user:

      echo msg message-text
      echo msg-n message-text
      echo msg-window message-title
      echo msg-notify message-title

Note: All rules of push and echo processing apply and determine
what is received as echo commands by the GUI. In addition,
'url-encoded' characters (% followed by two hex digits) are
decoded and displayed.

The message is constructed in the GUI by concatenating the text
specified in one or more "echo msg text" or "echo msg-n text"
commands. In case of "echo msg text" text is appended with a new
line. An empty text in this case will
just add a new line.

The message ends and gets displayed when one of the following
are receieved:

    echo msg-window title
    echo msg-notify title

where "title" becomes the title of the message window. In case of
msg-window, a modeless window shows the message, in the latter case
a notification balloon is shown.

Example: when pushed from the server:

    push "echo msg I say let the world go to hell%2C"
    push "echo msg I must have my cup of tea."
    push "echo msg-window Notes from the underground"

will display a modeless window with title
"Notes from the underground" and a two line body
    --
    I say let the world go to hell,
    I must have my cup of tea.
    --

Note that the message itself is not quoted in the above examples
and so it relies on the server's option-parser combining
individual words into a space separated string. Number of words
on a line is limited by the maximum number of parameters allowed
in openvpn commands (16). This limitation may be avoided by quoting
the text that follows so that the option parser sees it as one
parameter.

The comma character is not allowed in pushed strings, so
it has to be sent encoded as %2C as shown above.
Such encoding of arbitrary bytes is suppored. For example,
newlines may be embedded as %0A, though discouraged. Instead
use multiple "echo msg" commands to separate lines by new line.

An example with embedded spaces and multiple lines concatenated
without a new line in between (note use of single quotes):

    push "echo msg-n I swear to you gentlemen%2C that to be"
    push "echo msg-n ' overly conscious is a sickness%2C ' "
    push "echo msg-n a real%2C thorough sickness."
    push "echo msg-notify Quote of the Day"

    will show up as a notification that displays for an
    OS-dependent interval as:

    --
    Quote of the Day

    I swear to you gentlemen, that to be overly conscious
    is a sickness, a real, thorough sickness.
    --

where the location of the line break is automatically determined
by the notification API and is OS version-dependent.

Commands like "echo msg ..." in the config file are also
processed the same way. It gets displayed when the GUI connects
to the management interface and receives all pending echo.
Pushed message(s) get displayed when the client daemon
processes push-reply and passes on echo directives to the
GUI.

TODO: The actual window that displays the messages is
implemented in the next commit.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-07 23:29:02 -05:00
Mohammad Javidi 2aa61fee24
Add Persian language (#374)
* Copy *-en.rc file and rename to *-fa.rc for translate
* Translate line : 1->290 and 472->484 to Persian
* Add Persian(Farsi) language resources
2021-01-04 11:31:44 -05:00
Selva Nair 70b07c82d9 Show a mark against profiles that are in connecting state
Currently we show a check mark on connected profiles with no
indication on profiles that may be in the connecting state.

Change this by adding a mark against connecting/reconnecting
profiles. The yellow connecting state icon is used to generate
this mark although a custom designed check mark may look better.

In case of nested configs, the parent menus are marked with a tick
mark and only the profile is marked with the connecting icon.

No change in behaviour for profiles that are connected or
disconnected.

Trac #1241

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2021-01-02 12:35:48 -05:00
Selva Nair bcdda39660 Open all active status windows on left-double-click
Currently we pop up the status window on double click only
if one connection is active though there is no strong reason to
limit this behaviour. In fact, when multiple connections are
stuck in the connecting state, its very useful to have a quick
way to examine their progress instead of having to drill down
the menu. Especially so when nested menu is in use.

A random variation of up to 100 pixel is added to the initial
position of the status window to avoid all windows falling on
top of each other.

To prevent an explosion of new windows in the very unlikely event
of numerous active connections, restrict the maximum windows
shown to 10.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-12-30 13:07:34 -05:00
Samuli Seppänen 3820c1368d Bump version to 11.21.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2020-12-09 13:26:57 +02:00
Selva Nair 0232c6943e README updates
- Where output of scripts go
- Registry key for controlling config menu display

v2: formatting fix

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-12-04 18:29:37 -05:00
Frank Fesevur 5885c906db Only change to reconnecting when already connected 2020-12-04 11:24:31 -05:00
Frank Fesevur a9128787eb Add logging to RunDisconnectScript() 2020-11-08 07:53:26 -05:00
Frank Fesevur 836b05be31 Add logging to RunPreconnectScript() 2020-11-08 07:53:26 -05:00
Frank Fesevur c9becbf1ec Add logging to RunConnectScript() 2020-11-08 07:53:26 -05:00
Samuli Seppänen 3fb55cba60 Bump version to 11.20.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2020-09-30 12:47:37 +03:00
Samuli Seppänen ed784b6c4f Bump version to 11.19.0.0
Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
2020-09-21 11:45:13 +03:00
Lev Stipakov 1715746477 Introduce "Always use interactive service" option
We didn't use interactive service when gui was running
under admin because of some privilege escalation vulnerability in Vista.

Apparently this issue doesn't exist on Win7 and newer versions so
it is safe to use iservice on those systems.

Introduce "Always use interactive service" option,
which is "on" by default. This should enable users,
who by various reasons run gui as admin, use Wintun.

When gui is running as admin and interactive service
cannot be started or not installed, warn that wintun will not work.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-09-18 00:03:03 -04:00
Wouter eef34b3b4d Support per-monitor DPI scaling 2020-09-11 11:15:14 -04:00
Wouter bf47b62c36 Use IFileOpenDialog instead of SHBrowseForFolder 2020-09-11 11:15:14 -04:00
Selva Nair af7fc7d223 Increase the depth of directories scanned for config files
Some users want to use more deeply nested folders than currently
supported. Increase the max depth to 20 which should be plenty for
all.

See also issue: # 364

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-09-08 22:30:25 +02:00
Erwin Bronkhorst 21ebb22dab Add missing Dutch translations, align with en resource file 2020-09-07 11:17:59 -04:00
Selva Nair 7d3f57e948 Increase the buffer size for help message
The help message is truncated in some languages with
recent increases in textual information in the
usage string. Eg., see "openvpn-gui --help" with
Dutch selected as the language where the text
is about 2300 characters while the buffer is only 2048.

The window still fits on typical screen sizes, so
just increase the buffer size to 3000.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-09-07 08:00:15 +02:00
Selva Nair 2195a81a81 Copy missing resource strings to all language files
- All missing strings are copied from the English version
  which is the default.
- Description of "--command cmd" is also copied from the
  English version where missing.
- Some whitespace changes for consistent formatting of all files

  No user-visible changes except for the --help output
  which will now include a description of the "--command cmd"
  option in English when a translation is not available.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-09-04 14:20:23 -04:00
Bohdan Hamulets 4bcee1eed1 Update openvpn-gui-res-ua.rc
Corrected initial pull request https://github.com/OpenVPN/openvpn-gui/pull/361 pull with correct Ukrainian grammar (I am a native speaker, and it's not just my thought on it, but a collaboration of other team members, the main contributor being Bohdan Kobilnyk)
2020-09-03 16:46:22 -04:00
Samuli Seppänen a921662717 Bump version to 11.17.0.0
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2020-09-01 10:27:34 +03:00
Selva Nair af440ad2d2 Change the startup option text to "Launch on User Logon"
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-08-23 14:50:15 +02:00
Selva Nair a4c824058f Update copyright year
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-08-23 14:50:15 +02:00
Samuli Seppänen 6626cf4d85 Bump version to 11.16.0.0
Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
2020-08-14 08:40:46 +03:00
Nicolaj-ITS b3f55135fb Update openvpn-gui-res-dk.rc
Updated some translations

Edits during merge:
Add changes suggested  by Deantwo's review
 - Vis Popup --> Vis Notifikation
 - ... --> ellipsis

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-08-12 15:27:43 -04:00
Selva Nair a950e14755 Do not do escape processing on static-challenge password and response
Strings passed to the management interface should escape characters
such as " and \ that have special meaning for the parser.
But, static-challenge password and response are base64 encoded
before passing to the management interface and get literally
transported to the server in that form. Escape processing of
these strings could result in altering the password and/or response.

Reported by: macskas https://github.com/OpenVPN/openvpn-gui/issues/351

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-06-22 13:02:48 -04:00
Selva Nair 5dc320e53a Fix text truncation in the settings menu for italian translations
See also Trac #1265 https://community.openvpn.net/openvpn/ticket/1265

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2020-05-26 16:55:21 -04:00
chaosflaws ede10529ea
Update English and German language files (#285)
* Update English and German language files
2020-05-22 08:29:14 -04:00
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