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>

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
         {
... ...
@@ -152,26 +152,18 @@ get_user_pass(struct user_pass *up,
152 152
     return get_user_pass_cr(up, auth_file, prefix, flags, NULL);
153 153
 }
154 154
 
155
-void fail_user_pass(const char *prefix,
156
-                    const unsigned int flags,
157
-                    const char *reason);
158
-
159 155
 void purge_user_pass(struct user_pass *up, const bool force);
160 156
 
161 157
 /**
162
- * Sets the auth-token to token. If a username is available from
163
- * either up or already present in tk that will be used as default
164
- * username for the token. The method will also purge up if
158
+ * Sets the auth-token to token. The method will also purge up if
165 159
  * the auth-nocache option is active.
166 160
  *
167
- * @param up        (non Auth-token) Username/password
168 161
  * @param tk        auth-token userpass to set
169 162
  * @param token     token to use as password for the auth-token
170 163
  *
171 164
  * @note    all parameters to this function must not be null.
172 165
  */
173
-void set_auth_token(struct user_pass *up, struct user_pass *tk,
174
-                    const char *token);
166
+void set_auth_token(struct user_pass *tk, const char *token);
175 167
 
176 168
 /**
177 169
  * Sets the auth-token username by base64 decoding the passed
... ...
@@ -340,7 +340,7 @@ ssl_set_auth_nocache(void)
340 340
 void
341 341
 ssl_set_auth_token(const char *token)
342 342
 {
343
-    set_auth_token(&auth_user_pass, &auth_token, token);
343
+    set_auth_token(&auth_token, token);
344 344
 }
345 345
 
346 346
 void