[Openvpn-devel,v1] Fix incorrect condition for checking password related check

Message ID 20250323211359.14117-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,v1] Fix incorrect condition for checking password related check | expand

Commit Message

Gert Doering March 23, 2025, 9:13 p.m. UTC
From: Arne Schwabe <arne@rfc2549.org>

Commit db48cea chagned logic to move logic from a variable and repeated
checks to an if clause.

The old code had

            const bool ccnr = (options->auth_user_pass_verify_script
                                || PLUGIN_OPTION_LIST(options)
                                || MAN_CLIENT_AUTH_ENABLED(options));

followed by several condition that checked !ccnr

This commit fixes the if clause by correctly applying De Margan's law.

Change-Id: I28a8abd0ee3fa9168a716171b0a405476089c4a1
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <a@unstable.cc>
---

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/+/912
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Antonio Quartulli <a@unstable.cc>

Comments

Gert Doering March 24, 2025, 7:19 a.m. UTC | #1
Yeah, sorry for not noticing when reviewing db48cea.  In retrospective
this is quite obviously the correct fix.

Added Github: reference, and URLs to sf.net mail archive & gerrit - the
archive at mail-archive.org is broken again :-(

Your patch has been applied to the master branch.

commit 15e663c898fe7a2350c35f5263cbad116cd5b61a
Author: Arne Schwabe
Date:   Sun Mar 23 22:13:53 2025 +0100

     Fix incorrect condition for checking password related check

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Antonio Quartulli <antonio@mandelbit.com>
     Message-Id: <20250323211359.14117-1-gert@greenie.muc.de>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59164222/
     URL: http://gerrit.openvpn.net/c/openvpn/+/912
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 67ef55b..ab56609 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -2752,8 +2752,8 @@ 
 
         }
         if (!options->auth_user_pass_verify_script
-            || PLUGIN_OPTION_LIST(options)
-            || MAN_CLIENT_AUTH_ENABLED(options))
+            && !PLUGIN_OPTION_LIST(options)
+            && !MAN_CLIENT_AUTH_ENABLED(options))
         {
             const char *use_err = "--%s must be used with --management-client-auth, an --auth-user-pass-verify script, or plugin";