From: Kruti Pendharkar Date: Wed, 11 Jun 2025 00:48:53 +0000 (-0700) Subject: Change to common source files not applicable to open-vm-tools. X-Git-Tag: stable-13.0.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6abe63bc8993e41ded4dcdda420257362b57e281;p=thirdparty%2Fopen-vm-tools.git Change to common source files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/vgauth/common/VGAuthUtil.c b/open-vm-tools/vgauth/common/VGAuthUtil.c index 76383c462..b2a39c58e 100644 --- a/open-vm-tools/vgauth/common/VGAuthUtil.c +++ b/open-vm-tools/vgauth/common/VGAuthUtil.c @@ -1,5 +1,6 @@ /********************************************************* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. + * Copyright (c) 2011-2025 Broadcom. All Rights Reserved. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -309,3 +310,36 @@ Util_Assert(const char *cond, #endif g_assert(0); } + + +/* + ****************************************************************************** + * Util_Utf8CaseCmp -- */ /** + * + * Case insensitive comparison for utf8 strings which can have non-ascii + * characters. + * + * @param[in] str1 Null terminated utf8 string. + * @param[in] str2 Null terminated utf8 string. + * + ****************************************************************************** + */ + +int +Util_Utf8CaseCmp(const gchar *str1, + const gchar *str2) +{ + int ret; + gchar *str1Case; + gchar *str2Case; + + str1Case = g_utf8_casefold(str1, -1); + str2Case = g_utf8_casefold(str2, -1); + + ret = g_strcmp0(str1Case, str2Case); + + g_free(str1Case); + g_free(str2Case); + + return ret; +} diff --git a/open-vm-tools/vgauth/common/VGAuthUtil.h b/open-vm-tools/vgauth/common/VGAuthUtil.h index f7f3aa216..72890e6ee 100644 --- a/open-vm-tools/vgauth/common/VGAuthUtil.h +++ b/open-vm-tools/vgauth/common/VGAuthUtil.h @@ -1,5 +1,6 @@ /********************************************************* - * Copyright (C) 2011-2016 VMware, Inc. All rights reserved. + * Copyright (c) 2011-2025 Broadcom. All Rights Reserved. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -105,4 +106,6 @@ gboolean Util_CheckExpiration(const GTimeVal *start, unsigned int duration); void Util_Assert(const char *cond, const char *file, int lineNum); +int Util_Utf8CaseCmp(const gchar *str1, const gchar *str2); + #endif diff --git a/open-vm-tools/vgauth/serviceImpl/alias.c b/open-vm-tools/vgauth/serviceImpl/alias.c index e5dae5fff..288e5524c 100644 --- a/open-vm-tools/vgauth/serviceImpl/alias.c +++ b/open-vm-tools/vgauth/serviceImpl/alias.c @@ -42,6 +42,7 @@ #include "certverify.h" #include "VGAuthProto.h" #include "vmxlog.h" +#include "VGAuthUtil.h" // puts the identity store in an easy to find place #undef WIN_TEST_MODE @@ -639,7 +640,7 @@ ServiceLoadFileContentsWin(const gchar *fileName, err = VGAUTH_E_FAIL; goto done; } - if (_stricmp(realPath, fileName) != 0) { + if (Util_Utf8CaseCmp(realPath, fileName) != 0) { Warning("%s: Real path (%s) is not same as file path (%s)\n", __FUNCTION__, realPath, fileName); err = VGAUTH_E_FAIL;