From: "cron2 (Code Review)" Date: Mon, 27 Jan 2025 11:40:12 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <2c9956c27b79e88f6e7b31f25e777850e541a7fe-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="u1EpuWEV7mQ="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Remove comparing username to NULL in tls_lock_username List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: flichtenheld , openvpn-devel --u1EpuWEV7mQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/87= 1?usp=3Demail ) Change subject: Remove comparing username to NULL in tls_lock_username ...................................................................... Remove comparing username to NULL in tls_lock_username tls_lock_username is only called in a single place and that place calls this is function with up->username, which is always defined. Change-Id: Ib8adf7b31cae02e2de3d45da23b76a2d79f13e20 Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Message-Id: <20250121161247.37883-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 520.html Signed-off-by: Gert Doering --- M src/openvpn/ssl_verify.c 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index 4c4b58d..e7d7ed6 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -153,11 +153,11 @@ { if (multi->locked_username) { - if (!username || strcmp(username, multi->locked_username)) + if (strcmp(username, multi->locked_username) !=3D 0) { msg(D_TLS_ERRORS, "TLS Auth Error: username attempted to chang= e from '%s' to '%s' -- tunnel disabled", multi->locked_username, - np(username)); + username); /* disable the tunnel */ tls_deauthenticate(multi); @@ -166,10 +166,7 @@ } else { - if (username) - { - multi->locked_username =3D string_alloc(username, NULL); - } + multi->locked_username =3D string_alloc(username, NULL); } return true; } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/871?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: Ib8adf7b31cae02e2de3d45da23b76a2d79f13e20 Gerrit-Change-Number: 871 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --u1EpuWEV7mQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Remove comparing username to NULL in tls_lock_=
username

tls_lock_username is only called in a single place and that= place
calls this is function with up->username, which is always defi= ned.

Change-Id: Ib8adf7b31cae02e2de3d45da23b76a2d79f13e20
Signed-= off-by: Arne Schwabe <arne@...1227...>
Acked-by: Frank Lichtenheld= <frank@...2641...>
Message-Id: <20250121161247.37883-1-frank@...220...= ..2641...>
URL: https://www.mail-archive.com/openvpn-devel@...1439...= ceforge.net/msg30520.html
Signed-off-by: Gert Doering <gert@...2132...= .>
---
M src/openvpn/ssl_verify.c
1 file changed, 3 insertions(= +), 6 deletions(-)

diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c<=
br>index 4c4b58d..e7d7ed6 100644
--- a/src/openvpn/ss= l_verify.c
+++ b/src/openvpn/ssl_verify.c
@= @ -153,11 +153,11 @@
{
if (multi->= locked_username)
{
- if (!username || strcmp(username, multi->locke= d_username))
+ = if (strcmp(username, multi->locked_username) !=3D 0)
= {
msg(D_TLS_ERRORS, "TLS Auth Erro= r: username attempted to change from '%s' to '%s' -- tunnel= disabled",
multi->locked_username= ,
- np(u= sername));
+ = username);

/* disable= the tunnel */
tls_deauthenticate(multi);
@@ -166,10 +166,7 @@
}
= else
{
- if (username)
- {
- = multi->locked_username =3D string_alloc(username, NULL);<= br>- }
+ multi->locked_username =3D s= tring_alloc(username, NULL);
}
re= turn true;
}

To view, = visit cha= nge 871. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib8adf7b31cae02e2de3d45da23b= 76a2d79f13e20
Gerrit-Change-Number: 871
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--u1EpuWEV7mQ=--