- Automatic scroll sometimes does not appear to work as expected.
Add an explicit command to scroll to current selection.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
- WM_CLOSE is sent if the process is terminated from task manager
or by taskkill etc. Waiting for user confirmation in such cases
leads to abnormal termination of process leaving behind openvpn.exe,
active connections state not saved to the registry etc.
CloseApplication() now gets a second argument ask_user.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
- Also call Kill the IDT_STOP_TIMER in StatusDialogFunc. Though timers
will get destroyed during Window destruction an explicit KillTimer
in case still running is the "right" thing to do.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
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>
To get connection for menu command, we use "dwMenuData" property
of a menu. With single connection profile we read "dwMenuData"
of a main menu, not a submenu. There has been a bug in code which hasn't
set "dwMenuData" for the main menu but it has worked until recently, since
this property stored index of connection array and index 0 has always
worked.
Since commit 94179911 ("Use a list instead of array for connections list")
we have switched to a linked list and store list pointer in dwMenuData.
However due to bug dwMenuData has always being 0, and logic which
fetches connections doesn't work:
minfo.fMask = MIM_MENUDATA;
GetMenuInfo((HMENU) lParam, &minfo);
c = (connection_t *) minfo.dwMenuData;
if (!c)
break; /* ignore invalid connection */
Fix by assigning main menu's dwMenuData to a head of connections list.
Fixes https://github.com/OpenVPN/openvpn-gui/issues/592
Signed-off-by: Lev Stipakov <lev@openvpn.net>
* Check return value of SetProp
- If SetProp() is unsuccessful, we'll crash later when GetProp()
returns null. Add a check, log the error and close the dialog.
We could abort here, but closing the current dialog and possibly the
corresponding connection, provides a chance for the user to fix the OOM
condition which is the most likely cause of SetProp() failure.
- In pkcs11.c if SetProp() fails just do not use bold font for
header instead of leaking the font resource.
Also correct a bad fixup in commit 80697ecae6: hfontProp was not set!
Github: FixesOpenVPN/openvpn-gui#577
Signed-off-by: Selva Nair <selva.nair@gmail.com>
We have tons of warnings like
warning C4244: '=': conversion from 'DWORD' to 'LANGID', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
warning C4996: 'wcsncpy': This function or variable may be unsafe
We should fix those at some point, but meanwhile let's suppress those since they
pollute build logs and make it very hard to analyse.
Signed-off-by: Lev Stipakov <lev@openvpn.net>
- assert while on login screen is hard to get out of.
Only one of these occurrences is relevant for PLAP, but not using assert
at all looks a safer option.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
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>
Since we started finding a free port dynamically, management_port_offset
is used only for making an initial hint. The limit applied to num_configs
base don this does not make sense any longer.
Also the current code does not work as expected as we allow changing of
management_port_offset from the settings menu.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
- GetTickcount() and current-time passed-in to the callback are
both 32 bit which wraps around every ~50 days. In the stop
condition compare the elasped ticks and timeout value instead
of end-time and now. The latter can wraparound in a long-running
process.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
When connected, the daemon now reports the state as
CONNECTED,ROUTE_ERROR on routing errors that would have been
reported as CONNECTED,SUCCESS in the past.
To not overly disrupt the current behaviour we treat CONNECTED,ROUTE_ERROR
almost the same was as CONNECTED,SUCCESS except that an error is logged and
the status window is popped up if not already open for all cases other
that CONNECTED,SUCCESS.
Further, the icons on the status window, is left at yellow
and the status text is set to "Connected with routing errors"
in case of ROUTE_ERROR.
Tray and menu icons will change to green. Leaving them yellow is not
persistent as we do not yet have a state variable in the GUI that distinguishes
between "successfully connected" and "connected with route errors".
TODO: re-work this CONNECTED state handling based on how critical
ROUTE_ERROR is in real use.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
If the prefix string includes ERROR or WARNING these messages
are now shown in colour (red or yellow) similar to how log lines
are displayed.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
As we now allow users to set a management password (for persistent
connections), the max size of password should match what openvpn.exe
can handle (128 or 4096 bytes depending on build options).
Increase the buffer size to 4096 though such large passwords
may not work in practice. 127 bytes + NUL, may be a safe upper limit.
For the random password used for connections spawned by the GUI,
the current size of 15 bytes + NUL is retained.
Fixes: #567
Signed-off-by: Selva Nair <selva.nair@gmail.com>
New feature: any connection that is not disconnected on exit
will auto-connect when the GUi is started the next time.
There is no option to toggle auto-connect of any profile. Instead,
just connect normally and leave the connection open while closing the
GUI directly or indirectly (on logout, for example). Such a connection
will auto-connect when the GUI is started the next time.
If auto-connect is not desired for a particular connection, stop it
before exit. Or, the whole feature may be disabled in the setings menu
(implemented in next commit).
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Provide more room for some long strings in General and
Advanced settings dialogs in German localization.
fixes#244
Signed-off-by: Selva Nair <selva.nair@gmail.com>
WEB_AUTH is treated same way as OPEN_URL with no support
for optional flags in WEB_AUTH message. In particular
proxy is not supported.
Closes#414
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Since version 11.30, we scan config-auto folder and show them
in the menu of available connection profiles. To reduce user-confusion,
always group these configs under a submenu ("Persistent Connections")
even when nested config menu view is not in use.
ActivateConfigGroups() is now always called as Persistent and
System profile groups can now go from empty to non-empty
on rescan.
When nested config menu view is enabled, "persistent", "system"
and "user" configs are always shown in separate groups.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Create the parent groups for persistent and system profiles
in advance so that these always appear at the top when nested
config menu view is active.
Also, while rescanning with active connections present, newly
found configs in global config and auto-config folders are added
to their own parent groups instead of to the root groups.
No user-visible changes unless nested config menu view is enabled.
In that case, "Persistent Connections" followed by "System Profiles"
will always appear first in the connections list.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
PR 418 introduced repeatedly trying to connect to the
management interface on timeout. User can exit out of this loop
by "disconnect", but for this to work an explict
call to OnStop() is required. Normally OnStop() is triggered
by management disconnect which won't happen if not connected
in the first place.
Also call OnStop() on all iservice errors instead of waiting for
management timeout which may never happen.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
_wfopen requires ccs=<encoding> to support writing of
non-ascii text. This was missed in the initial commit.
Signed-off-by: Selva Nair <selva.nair@gmail.com>