]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
push: fix compilation with --disable-management and --enable-werror
authorAntonio Quartulli <a@unstable.cc>
Wed, 3 Aug 2022 15:40:49 +0000 (17:40 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 3 Aug 2022 19:44:34 +0000 (21:44 +0200)
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 <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220803154049.1213-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24792.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/push.c

index 9503e666ffd6a06a69013e74686973797a162539..121ea691a10b3aabd3696e1794736abac086e5d1 100644 (file)
@@ -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,12 @@ 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;
@@ -112,7 +112,7 @@ receive_auth_failed(struct context *c, const struct buffer *buffer)
     {
         ssl_put_auth_challenge(BSTR(&buf));
     }
-#endif
+#endif /* ifdef ENABLE_MANAGEMENT */
 
 }