]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Wed, 11 Jun 2025 00:48:53 +0000 (17:48 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 11 Jun 2025 00:48:53 +0000 (17:48 -0700)
open-vm-tools/vgauth/common/VGAuthUtil.c
open-vm-tools/vgauth/common/VGAuthUtil.h
open-vm-tools/vgauth/serviceImpl/alias.c

index 76383c46237acec60caf04b7d1a7b0ff8719fa3d..b2a39c58e98634921ae429c96514beb2391d4e7b 100644 (file)
@@ -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;
+}
index f7f3aa2169fa2506c5d189b861ebbb5d6c6fa59b..72890e6ee292f609a886edca61b0d2c850c3099c 100644 (file)
@@ -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
index e5dae5fff26cd42ebae23e73d1cf30f91c8d772a..288e5524cc6f47cd02b420560e971dc1ab310ae1 100644 (file)
@@ -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;