Skip to contentSkip to conversation

push: fix compilation with --disable-management and --enable-werror

PATCH In review Antonio Quartulli 2 participants 2 messages Aug 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 push: fix compilation with --disable-management and --enable-werror

The authfail_extended and buf variables are only used when ENABLE_MANAGEMENT is defined. However, they are currently declared outside of any ifdefs, thus triggering a warning.

Move the declaration of these 2 down, right before their usage (within the existing "#ifdef ENABLE_MANAGEMENT" block.

Fixes ("Cleanup receive_auth_failed and simplify method")
Cc Arne Schwabe <[email protected]...>
---
 src/openvpn/push.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
src/openvpn/push.c +5 -6
index d0038795..51dc8359 100644
@@ -58,12 +58,6 @@ receive_auth_failed(struct context *c, const struct buffer *buffer)
         return;
     }
 
-    struct buffer buf = *buffer;
-
-    /* If the AUTH_FAIL message ends with a , it is an extended message that
-     * contains further flags */
-    bool authfail_extended = buf_string_compare_advance(&buf, "AUTH_FAILED,");
-
     /* Before checking how to react on AUTH_FAILED, first check if the
      * failed auth might be the result of an expired auth-token.
      * Note that a server restart will trigger a generic AUTH_FAILED
@@ -95,6 +89,11 @@ receive_auth_failed(struct context *c, const struct buffer *buffer)
         c->sig->signal_text = "auth-failure";
     }
 #ifdef ENABLE_MANAGEMENT
+    struct buffer buf = *buffer;
+    /* If the AUTH_FAIL message ends with a , it is an extended message that
+     * contains further flags */
+    bool authfail_extended = buf_string_compare_advance(&buf, "AUTH_FAILED,");
+
     if (management)
     {
         const char *reason = NULL;
Signature · 1 line
2.35.1
Acked-by on v1 1/1
#1 lore raw

"So simple" :-) - test compiled on linux, with and without --disable-management, and with -Werror.

Uncrustify complains that the extra lines now require an "#endif /* ..." comment -> added.

Your patch has been applied to the master branch.

commit bb44e87f6a51318547a94a47ebc8f1523a29bb03

Author: Antonio Quartulli
Date:   Wed Aug 3 17:40:49 2022 +0200
     push: fix compilation with --disable-management and --enable-werror

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

--
kind regards,

Gert Doering