Skip to contentSkip to conversation

options: fix inlining auth-gen-token-secret file

PATCH In review Antonio Quartulli 3 participants 3 messages May 8, 2020 – May 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 options: fix inlining auth-gen-token-secret file

With commit ("convert *_inline attributes to bool") the logic for signaling when a certain option is inline has been changed. Due to an overlook, the auth-gen-token-secret was not converted, thus making it impossible to be inlined.

Fix parsing logic and allow auth-gen-token-secret to be inlined as well.

---
 src/openvpn/options.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
src/openvpn/options.c +3 -7
index 56c9e411..2d2089e3 100644
@@ -6981,16 +6981,12 @@ add_option(struct options *options,
         }
 
     }
-    else if (streq(p[0], "auth-gen-token-secret") && p[1] && (!p[2]
-                                                              || (p[2] && streq(p[1], INLINE_FILE_TAG))))
+    else if (streq(p[0], "auth-gen-token-secret") && p[1] && !p[2])
     {
-        VERIFY_PERMISSION(OPT_P_GENERAL);
+        VERIFY_PERMISSION(OPT_P_GENERAL|OPT_P_INLINE);
         options->auth_token_secret_file = p[1];
+        options->auth_token_secret_file_inline = is_inline;
 
-        if (streq(p[1], INLINE_FILE_TAG) && p[2])
-        {
-            options->auth_token_secret_file_inline = p[2];
-        }
     }
     else if (streq(p[0], "client-connect") && p[1])
     {
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 27 lines · Antonio Quartulli

With commit ("convert *_inline attributes to bool") the logic for signaling when a certain option is inline has been changed. Due to an overlook, the auth-gen-token-secret was not converted, thus making it impossible to be inlined.

Fix parsing logic and allow auth-gen-token-secret to be inlined as well.

---
 src/openvpn/options.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
src/openvpn/options.c +2 -3
index 56c9e411..2d2089e3 100644
@@ -6981,16 +6981,12 @@ add_option(struct options *options,
         }
 
     }
-    else if (streq(p[0], "auth-gen-token-secret") && p[1] && (!p[2]
-                                                              || (p[2] && streq(p[1], INLINE_FILE_TAG))))
+    else if (streq(p[0], "auth-gen-token-secret") && p[1] && !p[2])
     {
-        VERIFY_PERMISSION(OPT_P_GENERAL);
+        VERIFY_PERMISSION(OPT_P_GENERAL|OPT_P_INLINE);

src/openvpn/options.c add_option(struct options *options, · line 6992

Quoted 10 lines
src/openvpn/options.c +1 -4
         options->auth_token_secret_file = p[1];
+        options->auth_token_secret_file_inline = is_inline;
 
-        if (streq(p[1], INLINE_FILE_TAG) && p[2])
-        {
-            options->auth_token_secret_file_inline = p[2];
-        }
     }
     else if (streq(p[0], "client-connect") && p[1])
     {

Good to see that braintwister of boolean logic go away. I've only done a quick compile test and glared at the code change, which all makes sense.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#2 lore raw
In reply to Antonio Quartulli

Your patch has been applied to the master branch.

I have just done a compile test. Code change looks good.

commit 416162c5b66055da24e6e7b8acde4e7bb8f67522

Author: Antonio Quartulli
Date:   Fri May 8 23:14:34 2020 +0200
     options: fix inlining auth-gen-token-secret file

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19862.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering