From: "cron2 (Code Review)" Date: Fri, 29 Mar 2024 11:55:00 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="aDkKJBBoJ+0="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: misc.c: remove unused code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa , plaisthos , flichtenheld Cc: openvpn-devel --aDkKJBBoJ+0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= stipa. ( http://gerrit.openvpn.net/c/openvpn/+/550?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by flichtenheld Change subject: misc.c: remove unused 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 Acked-by: Frank Lichtenheld Change-Id: Ic440f2c8d46dfcb5ff41ba2f33bf28bb7286eec4 Message-Id: <20240329103739.28254-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28= 503.html Signed-off-by: Gert Doering --- M src/openvpn/misc.c M src/openvpn/misc.h M src/openvpn/ssl.c 3 files changed, 5 insertions(+), 17 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/50/550/2 diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index 3ff0857..598fbae 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -491,19 +491,15 @@ } void -set_auth_token(struct user_pass *up, struct user_pass *tk, const char *tok= en) +set_auth_token(struct user_pass *tk, const char *token) { - if (strlen(token)) { strncpynt(tk->password, token, USER_PASS_LEN); tk->token_defined =3D true; /* - * --auth-token has no username, so it needs the username - * either already set or copied from up, or later set by - * --auth-token-user - * If already set, tk is fully defined. + * If username already set, tk is fully defined. */ if (strlen(tk->username)) { diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h index cb3bf68..963f3e6 100644 --- a/src/openvpn/misc.h +++ b/src/openvpn/misc.h @@ -152,26 +152,18 @@ return get_user_pass_cr(up, auth_file, prefix, flags, NULL); } -void fail_user_pass(const char *prefix, - const unsigned int flags, - const char *reason); - void purge_user_pass(struct user_pass *up, const bool force); /** - * Sets the auth-token to token. If a username is available from - * either up or already present in tk that will be used as default - * username for the token. The method will also purge up if + * Sets the auth-token to token. The method will also purge up if * the auth-nocache option is active. * - * @param up (non Auth-token) Username/password * @param tk auth-token userpass to set * @param token token to use as password for the auth-token * * @note all parameters to this function must not be null. */ -void set_auth_token(struct user_pass *up, struct user_pass *tk, - const char *token); +void set_auth_token(struct user_pass *tk, const char *token); /** * Sets the auth-token username by base64 decoding the passed diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 7895a37..7c49451 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -340,7 +340,7 @@ void ssl_set_auth_token(const char *token) { - set_auth_token(&auth_user_pass, &auth_token, token); + set_auth_token(&auth_token, token); } void -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/550?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ic440f2c8d46dfcb5ff41ba2f33bf28bb7286eec4 Gerrit-Change-Number: 550 Gerrit-PatchSet: 2 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --aDkKJBBoJ+0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 to the change originally cr= eated by stipa.

View Change

The following approvals got outdated and= were removed: Code-Review+2 by flichtenheld

misc.c: remove unused code

Commit
<= br> 3a4fb1 "Ensure --auth-nocache is handled during renegotiation&quo= t;

has changed the behavior of set_auth_token(), but left unused par= ameter

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@...515...>
Acked-by: Fr= ank Lichtenheld <frank@...2641...>

Change-Id: Ic440f2c8d46dfcb= 5ff41ba2f33bf28bb7286eec4
Message-Id: <20240329103739.28254-1-gert@...1186...= .1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1011...= eforge.net/msg28503.html
Signed-off-by: Gert Doering <gert@...1296...= >
---
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvp= n/ssl.c
3 files changed, 5 insertions(+), 17 deletions(-)

<= pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">git = pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/50/550/2d= iff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 3= ff0857..598fbae 100644
--- a/src/openvpn/misc.c
<= span>+++ b/src/openvpn/misc.c
@@ -491,19 +491,15 @@<= br> }

void
-set_auth_token(struct user_pass *up, struct= user_pass *tk, const char *token)
+set_auth_token(struct user_pass *tk, const char *token)
{
-=
if (strlen(token))
{
= strncpynt(tk->password, token, USER_PASS_LEN);
= tk->token_defined =3D true;

= /*
- * --= auth-token has no username, so it needs the username
- * either already set or copied fro= m up, or later set by
-= * --auth-token-user
- * If already set, tk is fully defined.
+ * If username already set, tk i= s fully defined.
*/
if (= strlen(tk->username))
{
diff --= git a/src/openvpn/misc.h b/src/openvpn/misc.h
index cb3bf68= ..963f3e6 100644
--- a/src/openvpn/misc.h
+= ++ b/src/openvpn/misc.h
@@ -152,26 +152,18 @@
return get_user_pass_cr(up, auth_file, prefix, flags, NULL);
=
}

-void fail_user_pass(const char *prefix,
- const unsigned int flags,
- cons= t char *reason);
-
void purge_user_pass(struct user_pass *up, const bool force);<= /span>

/**
- * Sets the auth-token to token. If a username is availabl= e from
- * either up or= already present in tk that will be used as default
- * username for the token. The method will = also purge up if
+ * = Sets the auth-token to token. The method will also purge up if
* the auth-nocache option is active.

*
- * @param up (non Auth-toke= n) Username/password

* @param tk auth-token userpa= ss to set
* @param token token to use as password for= the auth-token
*
* @note all parame= ters to this function must not be null.
*/
-void set_auth_token(struct user_pass= *up, struct user_pass *tk,

- const char *token);
+void set_auth_token(struct user_pass *tk, const c= har *token);

/**
* Set= s the auth-token username by base64 decoding the passed
dif= f --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 7895a= 37..7c49451 100644
--- a/src/openvpn/ssl.c
= +++ b/src/openvpn/ssl.c
@@ -340,7 +340,7 @@
void
ssl_set_auth_token(const char *token)
{
- set_auth_tok= en(&auth_user_pass, &auth_token, token);
+ set_auth_token(&auth_token, token);
}

void

To view, visit change 550. To unsubscribe, or for help writing= mail filters, visit setting= s.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic440f2c8d46dfcb5ff41ba2f33b= f28bb7286eec4
Gerrit-Change-Number: 550
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--aDkKJBBoJ+0=--