Change in openvpn[master]: Add unit tests for 'auth-user-pass username-only'
A message that is not in the archive (sent off-list or not yet received): gerrit.1775000509000.I1c18b3cf4a454444a61941d88a702a140b0ac23d@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
to review the following change.
Change subject: Add unit tests for 'auth-user-pass username-only'
......................................................................
Add unit tests for 'auth-user-pass username-only'
Inlined, file and stdin inputs tested.
---
M tests/unit_tests/openvpn/test_user_pass.c
1 file changed, 32 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1602/1
tests/unit_tests/openvpn/test_user_pass.c +32 -0
@@ -222,6 +222,16 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"cpassword" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_INLINE_CREDS |GET_USER_PASS_USERNAME_ONLY ; +/*FIXME: query_user_exec() needs to be called even though nothing queued */ +will_return (query_user_exec_builtin, true); +assert_true (get_user_pass_cr (&up,"iuser\n" ,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"iuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }/* NOTE: expect_assert_failure does not seem to work with MSVC */
@@ -282,6 +292,17 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_USERNAME_ONLY ; +expect_string (query_user_exec_builtin, query_user[i].prompt,"Enter UT Username:" ); +will_return (query_user_exec_builtin,"cuser" ); +will_return (query_user_exec_builtin, true); +assert_true (get_user_pass_cr (&up,"stdin" ,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"cuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }/* NOTE: expect_assert_failure does not seem to work with MSVC */
@@ -353,6 +374,17 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"fuser" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_USERNAME_ONLY ; +/*FIXME: query_user_exec() needs to be called even though nothing queued */ +will_return (query_user_exec_builtin, true); +openvpn_test_get_srcdir_dir (authfile,PATH_MAX ,"input/user_only.txt" ); +assert_true (get_user_pass_cr (&up, authfile,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"fuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }#ifdef ENABLE_MANAGEMENT
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c18b3cf4a454444a61941d88a702a140b0ac23d
Gerrit-Change-Number: 1602
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email )
Change subject: Add unit tests for 'auth-user-pass username-only'
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
No point in testing this for authfile and inline as those are not supported with username-only. Though the test works. The recommendation in those cases is to include a dummy password.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c18b3cf4a454444a61941d88a702a140b0ac23d
Gerrit-Change-Number: 1602
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 01 Apr 2026 11:58:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
to look at the new patch set (#2).
Change subject: Add unit tests for 'auth-user-pass username-only'
......................................................................
Add unit tests for 'auth-user-pass username-only'
Input from stdin is tested.
---
M tests/unit_tests/openvpn/test_user_pass.c
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1602/2
tests/unit_tests/openvpn/test_user_pass.c +11 -0
@@ -282,6 +282,17 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_USERNAME_ONLY ; +expect_string (query_user_exec_builtin, query_user[i].prompt,"Enter UT Username:" ); +will_return (query_user_exec_builtin,"cuser" ); +will_return (query_user_exec_builtin, true); +assert_true (get_user_pass_cr (&up,"stdin" ,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"cuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }/* NOTE: expect_assert_failure does not seem to work with MSVC */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c18b3cf4a454444a61941d88a702a140b0ac23d
Gerrit-Change-Number: 1602
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email )
Change subject: Add unit tests for 'auth-user-pass username-only'
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c18b3cf4a454444a61941d88a702a140b0ac23d
Gerrit-Change-Number: 1602
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 13 Apr 2026 21:30:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v2 1/1 Add unit tests for 'auth-user-pass username-only'
In reply to a message not in the archiveFrom: Selva Nair <[email protected]...>
Input from stdin is tested.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1602
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1602
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
tests/unit_tests/openvpn/test_user_pass.c +11 -0
@@ -282,6 +282,17 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_USERNAME_ONLY ; +expect_string (query_user_exec_builtin, query_user[i].prompt,"Enter UT Username:" ); +will_return (query_user_exec_builtin,"cuser" ); +will_return (query_user_exec_builtin, true); +assert_true (get_user_pass_cr (&up,"stdin" ,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"cuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }/* NOTE: expect_assert_failure does not seem to work with MSVC */
[Openvpn-devel] [PATCH applied] Re: Add unit tests for 'auth-user-pass username-only'
More test coverage is always welcome, thanks :-)
Verified that "make check" still passes...
Your patch has been applied to the master and release/2.7 branch.
commit 25c5c42ac265c4731c0e44c0afd773dc89bf22da (master) commit e722fde4aa5b6656eca07dae0668440bb31ae63a (release/2.7)
Author: Selva Nair Date: Tue Apr 14 07:57:59 2026 +0200
Add unit tests for 'auth-user-pass username-only'
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1602
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36605.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#3) to the change originally created by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
Change subject: Add unit tests for 'auth-user-pass username-only'
......................................................................
Add unit tests for 'auth-user-pass username-only'
Input from stdin is tested.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1602
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36605.html
---
M tests/unit_tests/openvpn/test_user_pass.c
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1602/3
tests/unit_tests/openvpn/test_user_pass.c +11 -0
@@ -282,6 +282,17 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_USERNAME_ONLY ; +expect_string (query_user_exec_builtin, query_user[i].prompt,"Enter UT Username:" ); +will_return (query_user_exec_builtin,"cuser" ); +will_return (query_user_exec_builtin, true); +assert_true (get_user_pass_cr (&up,"stdin" ,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"cuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }/* NOTE: expect_assert_failure does not seem to work with MSVC */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c18b3cf4a454444a61941d88a702a140b0ac23d
Gerrit-Change-Number: 1602
Gerrit-PatchSet: 3
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email )
Change subject: Add unit tests for 'auth-user-pass username-only'
......................................................................
Add unit tests for 'auth-user-pass username-only'
Input from stdin is tested.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1602
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36605.html
---
M tests/unit_tests/openvpn/test_user_pass.c
1 file changed, 11 insertions(+), 0 deletions(-)
tests/unit_tests/openvpn/test_user_pass.c +11 -0
@@ -282,6 +282,17 @@assert_true (up.defined);assert_string_equal (up.username,"user" );assert_string_equal (up.password,"" ); + +reset_user_pass (&up); + + flags =GET_USER_PASS_USERNAME_ONLY ; +expect_string (query_user_exec_builtin, query_user[i].prompt,"Enter UT Username:" ); +will_return (query_user_exec_builtin,"cuser" ); +will_return (query_user_exec_builtin, true); +assert_true (get_user_pass_cr (&up,"stdin" ,"UT" , flags,NULL )); +assert_true (up.defined); +assert_string_equal (up.username,"cuser" ); +assert_string_equal (up.password,"[[BLANK]]" ); }/* NOTE: expect_assert_failure does not seem to work with MSVC */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1602?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c18b3cf4a454444a61941d88a702a140b0ac23d
Gerrit-Change-Number: 1602
Gerrit-PatchSet: 3
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>