Commit Graph

12 Commits (32f2c807ee1a2c73c4129763a3bdf61c83a8b8f3)

Author SHA1 Message Date
Frank Lichtenheld 2cb3c6e417 Reformat source code with uncrustify
Closes: #445

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2023-07-14 11:12:16 +02:00
Selva Nair 2b1e5867f0 Replace Sleep by a Wait function that pumps messages
- The wait function optionally calls IsDialogMessage() if a dialog
  handle is specified. For other customizations the caller can
  install a WH_MSGFILTER hook. The hook will get called with
  nCode = MSGF_OVPN_WAIT and lParam = &msg.

- Use this in place of Sleep in main.c, scripts.c and PLAP dll.

Fixes #576

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2023-02-26 19:59:38 -08:00
Selva Nair aaeb8d2700 Fix memory leak in PLAP
When LogonUI unloads and reloads the PLAP dll, or when the provider
is released and re-created, memory allocated for config list and
groups leak.

- Fix by freeing config list and groups in DeleteUI

We do not call this before exiting WinMain in the GUI code,
as its hard to do it safely -- have to ensure all status
threads have terminated. Anyway, freeing is only cosmetic in this case.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2023-02-23 08:02:40 -08:00
Selva Nair 9417991168 Use a list instead of array for connections list
Currently we use an array of connection pointers which needs
to be reallocated when space runs out. But, that happens from
the main thread while the status thread may be referring to those
pointers. Its very hard to fence against possible invalid memory
access. Instead, use a list so that connection pointer never
changes once created.

The connection list is no longer recreated from scratch even when
no connections are active. This means configs added while GUI is
running will always appear at the bottom of the root group listing
until the GUI is restarted.

TODO: This behaviour could be improved by scanning through the groups to
graft new configs at the right branch in the config-group tree.

v2: removed unused references to SetMenuStatusById()

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2023-01-19 14:08:15 -08:00
Selva Nair fa0f55e5a3 Localization of strings in PLAP dialog
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-12-08 18:17:19 -08:00
Selva Nair 3427aeb88f Enable localization of openvpn daemon state names
These strings are displayed in the PLAP progress window.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-12-08 18:17:19 -08:00
Selva Nair 1663417b63 RTL alignment in PLAP task dialog
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-12-03 18:03:40 -05:00
Selva Nair 577d982b51 PLAP: try to start automatic service if not running
Connection profiles shown on the login screen using PLAP
requires automatic service that starts openvpn.exe
processes for these profiles.

This commit adds an attempt to start the service from
PLAP dll. The service is started only if any PLAP enabled
profiles are found.

As starting the service can spawn up OpenVPN.exe processes and
the GUI may attach to them, auto-connect in the GUI is
suspended during session lock to leave the connections free to
be controlled from PLAP screen.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-10-19 09:49:15 -04:00
Selva Nair 67a8db7664 PLAP: Do not show profiles with no management address
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-10-19 09:49:15 -04:00
Selva Nair ed0ceeb95b Add a progress dialog during Connect()
- The dialog supports retry and cancel and shows
  a progress marquee

Signed-off-by: Selva Nair <selva.nair@gmail.com
2022-10-17 11:05:44 -04:00
Selva Nair e64b18074f Intercept management callbacks for better control of the UI
- Dialog windows of connections can popup at any time due to
  restarts not in user's control. Avoid this by marking current
  current profile being connected, and intercepting dialogs for
  other profiles.

  This is implemented by hooking into management callbacks such as
  OnPassword, OnNeedOk etc.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-10-17 11:05:44 -04:00
Selva Nair a500b9553e Implement Pre-Logon Access Provider for start before logon
- COM interfaces for ICredentialProvider and
  IConnectableCredentialProviderCredential combined
  with a trimmed down user-interface implemented as
  libopenvpn_plap.dll

- Connections autostarted by OpenVPNService are enumerated
  as possible PLAP connections. The user is expected to leave
  these in management hold so that "connect" will popup any
  required user dialogs.

To use:
 - Register the dll as a PLAP provider (see included .reg files)
 - The enumerated connections will show up as tiles in the PLAP
   screen of the login desktop (secure desktop).

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2022-10-17 11:05:44 -04:00