[PATCH] vpn-provider: Compare using lowercase of type value in set_string()

Jussi Laakkonen <[email protected]> Fri, 10 Apr 2026 13:58:29 +0300
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
The VPN type value is always converted to lowercase. When the type is
set via set_string() the comparison must be done also with lowercase.
The issue was introduced in commit 3aa13afdf706dee92f657bf6799d6bd97b81da4d

Reported by Frank Liepert <[email protected]>
---
 vpn/vpn-provider.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index dafdaffa..2833d249 100644
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -2754,11 +2754,14 @@ static int set_string(struct vpn_provider *provider,
 		hide_value ? "<not printed>" : value);
 
 	if (g_str_equal(key, "Type")) {
-		if (!g_strcmp0(provider->type, value))
+		char *type = g_ascii_strdown(value, -1);
+		if (!g_strcmp0(provider->type, type)) {
+			g_free(type);
 			return -EALREADY;
+		}
 
 		g_free(provider->type);
-		provider->type = g_ascii_strdown(value, -1);
+		provider->type = type;
 		send_value(provider->path, "Type", provider->type);
 	} else if (g_str_equal(key, "Name")) {
 		if (!g_strcmp0(provider->name, value))
-- 
2.47.3