Browse code

misc.c: remove unused code

Commit

3a4fb1 "Ensure --auth-nocache is handled during renegotiation"

has changed the behavior of set_auth_token(), but left unused parameter

struct user_pass *up

Remove this parameter and amend comments accordingly. Also remove
unused function definition from misc.h.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>

Change-Id: Ic440f2c8d46dfcb5ff41ba2f33bf28bb7286eec4
Message-Id: <20240329103739.28254-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28503.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 4c71e816031f564f834df695b3fa717ea22720d2)

Lev Stipakov authored on 2024/03/29 19:37:39
Showing 3 changed files
... ...
@@ -491,19 +491,15 @@ purge_user_pass(struct user_pass *up, const bool force)
491 491
 }
492 492
 
493 493
 void
494
-set_auth_token(struct user_pass *up, struct user_pass *tk, const char *token)
494
+set_auth_token(struct user_pass *tk, const char *token)
495 495
 {
496
-
497 496
     if (strlen(token))
498 497
     {
499 498
         strncpynt(tk->password, token, USER_PASS_LEN);
500 499
         tk->token_defined = true;
501 500
 
502 501
         /*
503
-         * --auth-token has no username, so it needs the username
504
-         * either already set or copied from up, or later set by
505
-         * --auth-token-user
506
-         * If already set, tk is fully defined.
502
+         * If username already set, tk is fully defined.
507 503
          */
508 504
         if (strlen(tk->username))
509 505
         {
... ...
@@ -135,26 +135,18 @@ get_user_pass(struct user_pass *up,
135 135
     return get_user_pass_cr(up, auth_file, prefix, flags, NULL);
136 136
 }
137 137
 
138
-void fail_user_pass(const char *prefix,
139
-                    const unsigned int flags,
140
-                    const char *reason);
141
-
142 138
 void purge_user_pass(struct user_pass *up, const bool force);
143 139
 
144 140
 /**
145
- * Sets the auth-token to token. If a username is available from
146
- * either up or already present in tk that will be used as default
147
- * username for the token. The method will also purge up if
141
+ * Sets the auth-token to token. The method will also purge up if
148 142
  * the auth-nocache option is active.
149 143
  *
150
- * @param up        (non Auth-token) Username/password
151 144
  * @param tk        auth-token userpass to set
152 145
  * @param token     token to use as password for the auth-token
153 146
  *
154 147
  * @note    all parameters to this function must not be null.
155 148
  */
156
-void set_auth_token(struct user_pass *up, struct user_pass *tk,
157
-                    const char *token);
149
+void set_auth_token(struct user_pass *tk, const char *token);
158 150
 
159 151
 /**
160 152
  * Sets the auth-token username by base64 decoding the passed
... ...
@@ -504,7 +504,7 @@ ssl_set_auth_nocache(void)
504 504
 void
505 505
 ssl_set_auth_token(const char *token)
506 506
 {
507
-    set_auth_token(&auth_user_pass, &auth_token, token);
507
+    set_auth_token(&auth_token, token);
508 508
 }
509 509
 
510 510
 void