Repository navigation
Parse username indication in >PASSWORD 'Auth' - #838
Merged
Merged
Conversation
If the server prompts with preferred username indicated as UN:<base64> in the >PASSWORD 'Auth' username/password prompt use it to prefill the dialog. Any saved username takes precedence. The user may still edit the username. Change management client version to 6 to announce support for this feature. Add a call to CheckVersion() in PLAP as client version will not get announced otherwise when run from logn screen. OpenVPN caches prompts like this, so username hint will be present only if client version is set before the prompt is created. For persistent and PLAP instances its recommended to start the tunnel instance with --management-hold. Github: OpenVPN#719 Signed-off-by: Selva Nair <selva.nair@gmail.com>
selvanair
force-pushed
the
prefered-username
branch
from
November 3, 2026 23:08
1219064 to
a97720c
Compare
Collaborator
Author
|
As core support for this will be in 2.7.9, would be nice to get this too merged before then! |
lstipakov
requested changes
Nov 5, 2026
| c->dynamic_cr = NULL; | ||
| } | ||
|
|
||
| static void |
Member
There was a problem hiding this comment.
This is never called on Cleanup(), as a consequence the last allocation leaks per connection AND the hint survives into the later prompt:
- prompt with UN:YWxpY2U= → username "alice"
- next prompt with NO UN: field → username "alice" ← stale
| o.hInstance = hinstance; | ||
|
|
||
| /* OnReady() needs the daemon version to announce the management client version. */ | ||
| if (!CheckVersion()) |
Member
There was a problem hiding this comment.
return 1 here propagates as E_FAIL from SetUsageScenario(CPUS_PLAP), so a CheckVersion() failure doesn't just skip the version announcement — the PLAP entry never appears on the logon screen.
Two of its failure paths are silent, the rest pop a modal MessageBoxEx from LogonUI. Could we log and continue at the old version 4 behavior instead?
A CheckVersion() failure made InitializeUI() return 1, which surfaces as E_FAIL from SetUsageScenario(CPUS_PLAP) and makes LogonUI drop the PLAP entry altogether. Log and continue: with o.ovpn_version unset, OnReady() simply omits the "version" command. Add a quiet parameter to CheckVersion() so failures go to the event log instead of a message box, as PLAP has no interactive desktop, and log the two paths that returned FALSE silently. Signed-off-by: Lev Stipakov <lev.stipakov@openvpn.com>
c->username was never freed -- do it in Cleanup(), next to free_dynamic_cr(). Also clear it on every 'Auth' prompt rather than only when a UN: field is present. Otherwise the hint outlives its prompt: on auth retry openvpn re-prompts without UN:, and the stale value would overwrite the username the user had just corrected. Signed-off-by: Lev Stipakov <lev.stipakov@openvpn.com>
lstipakov
self-requested a review
November 5, 2026 10:12
rzvncj
approved these changes
Nov 5, 2026
rzvncj
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the server prompts with preferred username indicated as UN: in the >PASSWORD 'Auth' username/password prompt use it to prefill the dialog. Any saved username takes precedence. The user may still edit the username.
Change management client version to 6 to announce support for this feature.
Add a call to CheckVersion() in PLAP as client version will not get announced otherwise when run from logn screen.
OpenVPN caches prompts like this, so username hint will be present only if client version is set before the prompt is created. For persistent and PLAP instances its recommended to start the tunnel instance with --management-hold.
Github: #719