]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
openvpnmsica: Fix TAPInterface.DisplayName field interpretation
authorSimon Rozman <simon@rozman.si>
Mon, 9 Mar 2020 13:17:18 +0000 (14:17 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 9 Mar 2020 14:21:12 +0000 (15:21 +0100)
The DisplayName field type is Filename in the MSI database. This means
it must be authored as "8.3" filename, or "8.3|long filename".

This issue does not appear until interface names grow longer than 8
characters, or contain characters invalid in 8.3 filename notation.

Signed-off-by: Simon Rozman <simon@rozman.si>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200309131728.380-2-simon@rozman.si>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19520.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpnmsica/openvpnmsica.c

index 4236330a751fe3cfebc7b9617295e6504089dbbb..e1f0b77d089628e871aeb957e3aa1891deba0d0c 100644 (file)
@@ -2,7 +2,7 @@
  *  openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages
  *                  https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA
  *
- *  Copyright (C) 2018 Simon Rozman <simon@rozman.si>
+ *  Copyright (C) 2018-2020 Simon Rozman <simon@rozman.si>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2
@@ -752,6 +752,9 @@ EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall)
         {
             goto cleanup_hRecord;
         }
+        /* `DisplayName` field type is [Filename](https://docs.microsoft.com/en-us/windows/win32/msi/filename), which is either "8.3|long name" or "8.3". */
+        LPTSTR szDisplayNameEx = _tcschr(szDisplayName, TEXT('|'));
+        szDisplayNameEx = szDisplayNameEx != NULL ? szDisplayNameEx + 1 : szDisplayName;
 
         if (iAction > INSTALLSTATE_BROKEN)
         {
@@ -796,7 +799,7 @@ EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall)
                         msica_op_tap_interface_create,
                         MSICA_INTERFACE_TICK_SIZE,
                         NULL,
-                        szDisplayName));
+                        szDisplayNameEx));
             }
             else
             {
@@ -807,7 +810,7 @@ EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall)
                         msica_op_tap_interface_delete_by_name,
                         MSICA_INTERFACE_TICK_SIZE,
                         NULL,
-                        szDisplayName));
+                        szDisplayNameEx));
             }
 
             /* The amount of tick space to add for each interface to progress indicator. */