summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-10-22 10:46:14 -0700
committerKhem Raj <raj.khem@gmail.com>2019-10-24 01:01:44 -0700
commitb7a7376981d39dd7554ea689d7d85257cc7dbf0d (patch)
treea52b81b29f3e5d8d918fd36b526f4a676b114a73 /meta-oe/recipes-support
parent903bfb78a0ebab367e898825932e8f306570ea89 (diff)
downloadmeta-openembedded-b7a7376981d39dd7554ea689d7d85257cc7dbf0d.tar.gz
open-vm-tools: Upgrade to 11.0.1
Drop backported patch available in 11.0 release --disable-grabbitmqproxy is no longer a supported option Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch8
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch699
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch10
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch1281
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools_11.0.1.bb (renamed from meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb)6
5 files changed, 671 insertions, 1333 deletions
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
index 0736572b3..a711f5e5d 100644
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
@@ -14,11 +14,9 @@ Signed-off-by: Martin Kelly <mkelly@xevo.com>
14 open-vm-tools/configure.ac | 4 ++-- 14 open-vm-tools/configure.ac | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-) 15 1 file changed, 2 insertions(+), 2 deletions(-)
16 16
17diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
18index 325a39f5..713ea683 100644
19--- a/open-vm-tools/configure.ac 17--- a/open-vm-tools/configure.ac
20+++ b/open-vm-tools/configure.ac 18+++ b/open-vm-tools/configure.ac
21@@ -949,7 +949,7 @@ if test "$with_dnet" = "yes"; then 19@@ -937,7 +937,7 @@ if test "$with_dnet" = "yes"; then
22 AC_VMW_CHECK_LIB([dnet], 20 AC_VMW_CHECK_LIB([dnet],
23 [DNET], 21 [DNET],
24 [], 22 [],
@@ -27,11 +25,11 @@ index 325a39f5..713ea683 100644
27 [], 25 [],
28 [dnet.h], 26 [dnet.h],
29 [intf_open], 27 [intf_open],
30@@ -959,7 +959,7 @@ if test "$with_dnet" = "yes"; then 28@@ -947,7 +947,7 @@ if test "$with_dnet" = "yes"; then
31 29
32 if test $have_dnet = "no"; then 30 if test $have_dnet = "no"; then
33 AC_MSG_ERROR( 31 AC_MSG_ERROR(
34- [dnet-config was not found on your PATH. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net]) 32- [dnet-config was not found on your PATH. Please configure without dnet or install dnet - http://libdnet.sourceforge.net])
35+ [dnet was not found. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net]) 33+ [dnet was not found. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net])
36 fi 34 fi
37 fi 35 fi
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch
index 5c1aa7c40..9cf54f6f4 100644
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch
@@ -19,8 +19,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 7 files changed, 7 insertions(+), 7 deletions(-) 19 7 files changed, 7 insertions(+), 7 deletions(-)
20 rename open-vm-tools/lib/include/{poll.h => vm_poll.h} (99%) 20 rename open-vm-tools/lib/include/{poll.h => vm_poll.h} (99%)
21 21
22diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c
23index b41aa29d..8691309d 100644
24--- a/open-vm-tools/lib/asyncsocket/asyncsocket.c 22--- a/open-vm-tools/lib/asyncsocket/asyncsocket.c
25+++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c 23+++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c
26@@ -86,7 +86,7 @@ 24@@ -86,7 +86,7 @@
@@ -32,8 +30,6 @@ index b41aa29d..8691309d 100644
32 #include "log.h" 30 #include "log.h"
33 #include "err.h" 31 #include "err.h"
34 #include "hostinfo.h" 32 #include "hostinfo.h"
35diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c
36index 7ea3b7f4..740c4fed 100644
37--- a/open-vm-tools/lib/hgfsServer/hgfsServer.c 33--- a/open-vm-tools/lib/hgfsServer/hgfsServer.c
38+++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c 34+++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c
39@@ -48,7 +48,7 @@ 35@@ -48,7 +48,7 @@
@@ -45,8 +41,6 @@ index 7ea3b7f4..740c4fed 100644
45 #include "mutexRankLib.h" 41 #include "mutexRankLib.h"
46 #include "vm_basic_asm.h" 42 #include "vm_basic_asm.h"
47 #include "unicodeOperations.h" 43 #include "unicodeOperations.h"
48diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h
49index ec9b45aa..dc91e738 100644
50--- a/open-vm-tools/lib/include/asyncsocket.h 44--- a/open-vm-tools/lib/include/asyncsocket.h
51+++ b/open-vm-tools/lib/include/asyncsocket.h 45+++ b/open-vm-tools/lib/include/asyncsocket.h
52@@ -164,7 +164,7 @@ typedef struct AsyncSocket AsyncSocket; 46@@ -164,7 +164,7 @@ typedef struct AsyncSocket AsyncSocket;
@@ -58,8 +52,6 @@ index ec9b45aa..dc91e738 100644
58 struct IVmdbPoll; 52 struct IVmdbPoll;
59 typedef struct AsyncSocketPollParams { 53 typedef struct AsyncSocketPollParams {
60 int flags; /* Default 0, only POLL_FLAG_NO_BULL is valid */ 54 int flags; /* Default 0, only POLL_FLAG_NO_BULL is valid */
61diff --git a/open-vm-tools/lib/include/pollImpl.h b/open-vm-tools/lib/include/pollImpl.h
62index 46442e55..8bc66997 100644
63--- a/open-vm-tools/lib/include/pollImpl.h 55--- a/open-vm-tools/lib/include/pollImpl.h
64+++ b/open-vm-tools/lib/include/pollImpl.h 56+++ b/open-vm-tools/lib/include/pollImpl.h
65@@ -44,7 +44,7 @@ 57@@ -44,7 +44,7 @@
@@ -71,24 +63,672 @@ index 46442e55..8bc66997 100644
71 #include "vm_basic_asm.h" 63 #include "vm_basic_asm.h"
72 64
73 #if defined(__cplusplus) 65 #if defined(__cplusplus)
74diff --git a/open-vm-tools/lib/include/poll.h b/open-vm-tools/lib/include/vm_poll.h
75similarity index 99%
76rename from open-vm-tools/lib/include/poll.h
77rename to open-vm-tools/lib/include/vm_poll.h
78index 6acd4f35..fbc88494 100644
79--- a/open-vm-tools/lib/include/poll.h 66--- a/open-vm-tools/lib/include/poll.h
80+++ b/open-vm-tools/lib/include/vm_poll.h 67+++ /dev/null
81@@ -60,7 +60,7 @@ extern "C" { 68@@ -1,330 +0,0 @@
82 #if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0 69-/*********************************************************
83 #include <sys/kernel.h> 70- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
84 #endif 71- *
72- * This program is free software; you can redistribute it and/or modify it
73- * under the terms of the GNU Lesser General Public License as published
74- * by the Free Software Foundation version 2.1 and no later version.
75- *
76- * This program is distributed in the hope that it will be useful, but
77- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
78- * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
79- * License for more details.
80- *
81- * You should have received a copy of the GNU Lesser General Public License
82- * along with this program; if not, write to the Free Software Foundation, Inc.,
83- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
84- *
85- *********************************************************/
86-
87-/*********************************************************
88- * The contents of this file are subject to the terms of the Common
89- * Development and Distribution License (the "License") version 1.0
90- * and no later version. You may not use this file except in
91- * compliance with the License.
92- *
93- * You can obtain a copy of the License at
94- * http://www.opensource.org/licenses/cddl1.php
95- *
96- * See the License for the specific language governing permissions
97- * and limitations under the License.
98- *
99- *********************************************************/
100-
101-
102-#ifndef _POLL_H_
103-#define _POLL_H_
104-
105-#define INCLUDE_ALLOW_USERLEVEL
106-#define INCLUDE_ALLOW_VMCORE
107-#include "includeCheck.h"
108-
109-#include "vm_basic_types.h"
110-#include "vm_basic_defs.h"
111-#include "vmware.h"
112-#include "userlock.h"
113-
114-#if defined(__cplusplus)
115-extern "C" {
116-#endif
117-
118-#ifdef _WIN32
119-#define HZ 100
120-#elif defined linux
121-#include <asm/param.h>
122-#elif __APPLE__
123-#include <TargetConditionals.h>
124-/*
125- * Old SDKs don't define TARGET_OS_IPHONE at all.
126- * New ones define it to 0 on Mac OS X, 1 on iOS.
127- */
128-#if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0
129-#include <sys/kernel.h>
130-#endif
85-#include <sys/poll.h> 131-#include <sys/poll.h>
132-#define HZ 100
133-#endif
134-#ifdef __ANDROID__
135-/*
136- * <poll.h> of android should be included, but its name is same
137- * with this file. So its content is put here to avoid conflict.
138- */
139-#include <asm/poll.h>
140-#define HZ 100
141-typedef unsigned int nfds_t;
142-int poll(struct pollfd *, nfds_t, long);
143-#endif
144-
145-
146-/*
147- * Poll event types: each type has a different reason for firing,
148- * or condition that must be met before firing.
149- */
150-
151-typedef enum {
152- /*
153- * Actual Poll queue types against which you can register callbacks.
154- */
155- POLL_VIRTUALREALTIME = -1, /* Negative because it doesn't have its own Q */
156- POLL_VTIME = 0,
157- POLL_REALTIME,
158- POLL_DEVICE,
159- POLL_MAIN_LOOP,
160- POLL_NUM_QUEUES
161-} PollEventType;
162-
163-
164-/*
165- * Classes of events
166- *
167- * These are the predefined classes. More can be declared
168- * with Poll_AllocClass().
169- */
170-
171-typedef enum PollClass {
172- POLL_CLASS_MAIN,
173- POLL_CLASS_PAUSE,
174- POLL_CLASS_IPC,
175- POLL_CLASS_CPT,
176- POLL_CLASS_MKS,
177- POLL_FIXED_CLASSES,
178- POLL_DEFAULT_FIXED_CLASSES,
179- /* Size enum to maximum */
180- POLL_MAX_CLASSES = 31,
181-} PollClass;
182-
183-/*
184- * Do not use; Special pseudo private poll class supported by
185- * PollDefault only
186- */
187-#define POLL_DEFAULT_CLASS_NET POLL_FIXED_CLASSES
188-#define POLL_DEFAULT_CS_NET PollClassSet_Singleton(POLL_DEFAULT_CLASS_NET)
189-
190-/*
191- * Each callback is registered in a set of classes
192- */
193-
194-typedef struct PollClassSet {
195- uintptr_t bits;
196-} PollClassSet;
197-
198-/* An empty PollClassSet. */
199-static INLINE PollClassSet
200-PollClassSet_Empty(void)
201-{
202- PollClassSet set = { 0 };
203- return set;
204-}
205-
206-/* A PollClassSet with the single member. */
207-static INLINE PollClassSet
208-PollClassSet_Singleton(PollClass c)
209-{
210- PollClassSet s = PollClassSet_Empty();
211-
212- ASSERT_ON_COMPILE(POLL_MAX_CLASSES < sizeof s.bits * 8);
213- ASSERT(c < POLL_MAX_CLASSES);
214-
215- s.bits = CONST3264U(1) << c;
216- return s;
217-}
218-
219-/* Combine two PollClassSets. */
220-static INLINE PollClassSet
221-PollClassSet_Union(PollClassSet lhs, PollClassSet rhs)
222-{
223- PollClassSet set;
224- set.bits = lhs.bits | rhs.bits;
225- return set;
226-}
227-
228-/* Add single class to PollClassSet. */
229-static INLINE PollClassSet
230-PollClassSet_Include(PollClassSet set, PollClass c)
231-{
232- return PollClassSet_Union(set, PollClassSet_Singleton(c));
233-}
234-
235-
236-#define POLL_CS_MAIN PollClassSet_Singleton(POLL_CLASS_MAIN)
237-#define POLL_CS_PAUSE PollClassSet_Union(POLL_CS_MAIN, \
238- PollClassSet_Singleton(POLL_CLASS_PAUSE))
239-#define POLL_CS_CPT PollClassSet_Union(POLL_CS_PAUSE, \
240- PollClassSet_Singleton(POLL_CLASS_CPT))
241-#define POLL_CS_IPC PollClassSet_Union(POLL_CS_CPT, \
242- PollClassSet_Singleton(POLL_CLASS_IPC))
243-#define POLL_CS_VMDB POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
244-#define POLL_CS_MKS PollClassSet_Singleton(POLL_CLASS_MKS)
245-/*
246- * DANGER. You don't need POLL_CS_ALWAYS. Really. So don't use it.
247- */
248-#define POLL_CS_ALWAYS PollClassSet_Union(POLL_CS_CPT, POLL_CS_IPC)
249-
250-/*
251- * Poll class-set taxonomy:
252- * POLL_CS_MAIN
253- * - Unless you NEED another class, use POLL_CS_MAIN.
254- * POLL_CS_PAUSE
255- * - For callbacks that must occur even if the guest is paused.
256- * Most VMDB or Foundry commands are in this category.
257- * POLL_CS_CPT
258- * - Only for callbacks which can trigger intermediate Checkpoint
259- * transitions.
260- * The ONLY such callback is Migrate.
261- * POLL_CS_IPC
262- * - Only for callbacks which can contain Msg_(Post|Hint|Question)
263- * responses, and for signal handlers (why)?
264- * Vigor, VMDB, and Foundry can contain Msg_* responses.
265- * POLL_CS_MKS
266- * - Callback runs in MKS thread.
267- * POLL_CS_ALWAYS
268- * - Only for events that must be processed immediately.
269- * The ONLY such callback is OvhdMemVmxSizeCheck.
270- */
271-
272-
273-/*
274- * Poll_Callback flags
275- */
276-
277-#define POLL_FLAG_PERIODIC 0x01 // keep after firing
278-#define POLL_FLAG_REMOVE_AT_POWEROFF 0x02 // self-explanatory
279-#define POLL_FLAG_READ 0x04 // device is ready for reading
280-#define POLL_FLAG_WRITE 0x08 // device is ready for writing
281-#define POLL_FLAG_SOCKET 0x10 // device is a Windows socket
282-#define POLL_FLAG_NO_BULL 0x20 // callback does its own locking
283-#define POLL_FLAG_WINSOCK 0x40 // Winsock style write events
284-#define POLL_FLAG_FD 0x80 // device is a Windows file descriptor.
285-#define POLL_FLAG_ACCEPT_INVALID_FDS 0x100 // For broken 3rd party libs, e.g. curl
286-#define POLL_FLAG_THUNK_TO_WND 0x200 // thunk callback to window message loop
287-
288-
289-typedef void (*PollerFunction)(void *clientData);
290-typedef void (*PollerFireWrapper)(PollerFunction func,
291- void *funcData,
292- void *wrapperData);
293-typedef Bool (*PollerErrorFn)(const char *errorStr);
294-
295-/*
296- * Initialisers:
297- *
298- * For the sake of convenience, we declare the initialisers
299- * for custom implmentations here, even though the actual
300- * implementations are distinct from the core poll code.
301- */
302-
303-typedef struct PollOptions {
304- Bool locked; // Use internal MXUser for locking
305- Bool allowFullQueue; // Don't assert when device event queue is full.
306- VThreadID windowsMsgThread; // thread that processes Windows messages
307- PollerFireWrapper fireWrapperFn; // optional; may be useful for stats
308- void *fireWrapperData; // optional
309- PollerErrorFn errorFn; // optional; called upon unrecoverable error
310-} PollOptions;
311-
312-
313-void Poll_InitDefault(void);
314-void Poll_InitDefaultEx(const PollOptions *opts);
315-void Poll_InitGtk(void); // On top of glib for Linux
316-void Poll_InitCF(void); // On top of CoreFoundation for OSX
317-
318-
319-/*
320- * Functions
321- */
322-int Poll_SocketPair(Bool vmci, Bool stream, int fds[2]);
323-void Poll_Loop(Bool loop, Bool *exit, PollClass c);
324-void Poll_LoopTimeout(Bool loop, Bool *exit, PollClass c, int timeout);
325-Bool Poll_LockingEnabled(void);
326-void Poll_Exit(void);
327-
328-
329-/*
330- * Poll_Callback adds a callback regardless of whether an identical one exists.
331- * The exception to this rule is POLL_DEVICE callbacks: there is a maximum of
332- * one read and one write callback per fd.
333- *
334- * Poll_CallbackRemove removes one callback. If there are multiple identical
335- * callbacks, which one is removed is an implementation detail. Note that in
336- * the case of POLL_DEVICE and POLL_REALTIME callbacks, the fd/delay used to
337- * create the callback is not specified when removing, so all callbacks
338- * of those types with the same flags, function, and clientData are considered
339- * "identical" even if their fd/delay differed.
340- */
341-
342-VMwareStatus Poll_Callback(PollClassSet classSet,
343- int flags,
344- PollerFunction f,
345- void *clientData,
346- PollEventType type,
347- PollDevHandle info, // fd/microsec delay
348- MXUserRecLock *lck);
349-Bool Poll_CallbackRemove(PollClassSet classSet,
350- int flags,
351- PollerFunction f,
352- void *clientData,
353- PollEventType type);
354-Bool Poll_CallbackRemoveOneByCB(PollClassSet classSet,
355- int flags,
356- PollerFunction f,
357- PollEventType type,
358- void **clientData);
359-
360-void Poll_NotifyChange(PollClassSet classSet);
361-
362-/*
363- * Wrappers for Poll_Callback and Poll_CallbackRemove that present
364- * simpler subsets of those interfaces.
365- */
366-
367-VMwareStatus Poll_CB_Device(PollerFunction f,
368- void *clientData,
369- PollDevHandle device,
370- Bool periodic);
371-
372-Bool Poll_CB_DeviceRemove(PollerFunction f,
373- void *clientData,
374- Bool periodic);
375-
376-
377-VMwareStatus Poll_CB_RTime(PollerFunction f,
378- void *clientData,
379- int64 delay, // microseconds
380- Bool periodic,
381- MXUserRecLock *lock);
382-
383-Bool Poll_CB_RTimeRemove(PollerFunction f,
384- void *clientData,
385- Bool periodic);
386-
387-
388-#ifdef _WIN32
389-void Poll_SetPumpsWindowsMessages(Bool pumps);
390-void Poll_SetWindowMessageRecipient(HWND hWnd, UINT msg, Bool alwaysThunk);
391-Bool Poll_FireWndCallback(void *lparam);
392-#endif
393-
394-#if defined(__cplusplus)
395-} // extern "C"
396-#endif
397-
398-#endif // _POLL_H_
399--- /dev/null
400+++ b/open-vm-tools/lib/include/vm_poll.h
401@@ -0,0 +1,330 @@
402+/*********************************************************
403+ * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
404+ *
405+ * This program is free software; you can redistribute it and/or modify it
406+ * under the terms of the GNU Lesser General Public License as published
407+ * by the Free Software Foundation version 2.1 and no later version.
408+ *
409+ * This program is distributed in the hope that it will be useful, but
410+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
411+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
412+ * License for more details.
413+ *
414+ * You should have received a copy of the GNU Lesser General Public License
415+ * along with this program; if not, write to the Free Software Foundation, Inc.,
416+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
417+ *
418+ *********************************************************/
419+
420+/*********************************************************
421+ * The contents of this file are subject to the terms of the Common
422+ * Development and Distribution License (the "License") version 1.0
423+ * and no later version. You may not use this file except in
424+ * compliance with the License.
425+ *
426+ * You can obtain a copy of the License at
427+ * http://www.opensource.org/licenses/cddl1.php
428+ *
429+ * See the License for the specific language governing permissions
430+ * and limitations under the License.
431+ *
432+ *********************************************************/
433+
434+
435+#ifndef _POLL_H_
436+#define _POLL_H_
437+
438+#define INCLUDE_ALLOW_USERLEVEL
439+#define INCLUDE_ALLOW_VMCORE
440+#include "includeCheck.h"
441+
442+#include "vm_basic_types.h"
443+#include "vm_basic_defs.h"
444+#include "vmware.h"
445+#include "userlock.h"
446+
447+#if defined(__cplusplus)
448+extern "C" {
449+#endif
450+
451+#ifdef _WIN32
452+#define HZ 100
453+#elif defined linux
454+#include <asm/param.h>
455+#elif __APPLE__
456+#include <TargetConditionals.h>
457+/*
458+ * Old SDKs don't define TARGET_OS_IPHONE at all.
459+ * New ones define it to 0 on Mac OS X, 1 on iOS.
460+ */
461+#if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0
462+#include <sys/kernel.h>
463+#endif
86+#include <poll.h> 464+#include <poll.h>
87 #define HZ 100 465+#define HZ 100
88 #endif 466+#endif
89 #ifdef __ANDROID__ 467+#ifdef __ANDROID__
90diff --git a/open-vm-tools/lib/rpcIn/rpcin.c b/open-vm-tools/lib/rpcIn/rpcin.c 468+/*
91index 8eea7d86..c48f5be2 100644 469+ * <poll.h> of android should be included, but its name is same
470+ * with this file. So its content is put here to avoid conflict.
471+ */
472+#include <asm/poll.h>
473+#define HZ 100
474+typedef unsigned int nfds_t;
475+int poll(struct pollfd *, nfds_t, long);
476+#endif
477+
478+
479+/*
480+ * Poll event types: each type has a different reason for firing,
481+ * or condition that must be met before firing.
482+ */
483+
484+typedef enum {
485+ /*
486+ * Actual Poll queue types against which you can register callbacks.
487+ */
488+ POLL_VIRTUALREALTIME = -1, /* Negative because it doesn't have its own Q */
489+ POLL_VTIME = 0,
490+ POLL_REALTIME,
491+ POLL_DEVICE,
492+ POLL_MAIN_LOOP,
493+ POLL_NUM_QUEUES
494+} PollEventType;
495+
496+
497+/*
498+ * Classes of events
499+ *
500+ * These are the predefined classes. More can be declared
501+ * with Poll_AllocClass().
502+ */
503+
504+typedef enum PollClass {
505+ POLL_CLASS_MAIN,
506+ POLL_CLASS_PAUSE,
507+ POLL_CLASS_IPC,
508+ POLL_CLASS_CPT,
509+ POLL_CLASS_MKS,
510+ POLL_FIXED_CLASSES,
511+ POLL_DEFAULT_FIXED_CLASSES,
512+ /* Size enum to maximum */
513+ POLL_MAX_CLASSES = 31,
514+} PollClass;
515+
516+/*
517+ * Do not use; Special pseudo private poll class supported by
518+ * PollDefault only
519+ */
520+#define POLL_DEFAULT_CLASS_NET POLL_FIXED_CLASSES
521+#define POLL_DEFAULT_CS_NET PollClassSet_Singleton(POLL_DEFAULT_CLASS_NET)
522+
523+/*
524+ * Each callback is registered in a set of classes
525+ */
526+
527+typedef struct PollClassSet {
528+ uintptr_t bits;
529+} PollClassSet;
530+
531+/* An empty PollClassSet. */
532+static INLINE PollClassSet
533+PollClassSet_Empty(void)
534+{
535+ PollClassSet set = { 0 };
536+ return set;
537+}
538+
539+/* A PollClassSet with the single member. */
540+static INLINE PollClassSet
541+PollClassSet_Singleton(PollClass c)
542+{
543+ PollClassSet s = PollClassSet_Empty();
544+
545+ ASSERT_ON_COMPILE(POLL_MAX_CLASSES < sizeof s.bits * 8);
546+ ASSERT(c < POLL_MAX_CLASSES);
547+
548+ s.bits = CONST3264U(1) << c;
549+ return s;
550+}
551+
552+/* Combine two PollClassSets. */
553+static INLINE PollClassSet
554+PollClassSet_Union(PollClassSet lhs, PollClassSet rhs)
555+{
556+ PollClassSet set;
557+ set.bits = lhs.bits | rhs.bits;
558+ return set;
559+}
560+
561+/* Add single class to PollClassSet. */
562+static INLINE PollClassSet
563+PollClassSet_Include(PollClassSet set, PollClass c)
564+{
565+ return PollClassSet_Union(set, PollClassSet_Singleton(c));
566+}
567+
568+
569+#define POLL_CS_MAIN PollClassSet_Singleton(POLL_CLASS_MAIN)
570+#define POLL_CS_PAUSE PollClassSet_Union(POLL_CS_MAIN, \
571+ PollClassSet_Singleton(POLL_CLASS_PAUSE))
572+#define POLL_CS_CPT PollClassSet_Union(POLL_CS_PAUSE, \
573+ PollClassSet_Singleton(POLL_CLASS_CPT))
574+#define POLL_CS_IPC PollClassSet_Union(POLL_CS_CPT, \
575+ PollClassSet_Singleton(POLL_CLASS_IPC))
576+#define POLL_CS_VMDB POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
577+#define POLL_CS_MKS PollClassSet_Singleton(POLL_CLASS_MKS)
578+/*
579+ * DANGER. You don't need POLL_CS_ALWAYS. Really. So don't use it.
580+ */
581+#define POLL_CS_ALWAYS PollClassSet_Union(POLL_CS_CPT, POLL_CS_IPC)
582+
583+/*
584+ * Poll class-set taxonomy:
585+ * POLL_CS_MAIN
586+ * - Unless you NEED another class, use POLL_CS_MAIN.
587+ * POLL_CS_PAUSE
588+ * - For callbacks that must occur even if the guest is paused.
589+ * Most VMDB or Foundry commands are in this category.
590+ * POLL_CS_CPT
591+ * - Only for callbacks which can trigger intermediate Checkpoint
592+ * transitions.
593+ * The ONLY such callback is Migrate.
594+ * POLL_CS_IPC
595+ * - Only for callbacks which can contain Msg_(Post|Hint|Question)
596+ * responses, and for signal handlers (why)?
597+ * Vigor, VMDB, and Foundry can contain Msg_* responses.
598+ * POLL_CS_MKS
599+ * - Callback runs in MKS thread.
600+ * POLL_CS_ALWAYS
601+ * - Only for events that must be processed immediately.
602+ * The ONLY such callback is OvhdMemVmxSizeCheck.
603+ */
604+
605+
606+/*
607+ * Poll_Callback flags
608+ */
609+
610+#define POLL_FLAG_PERIODIC 0x01 // keep after firing
611+#define POLL_FLAG_REMOVE_AT_POWEROFF 0x02 // self-explanatory
612+#define POLL_FLAG_READ 0x04 // device is ready for reading
613+#define POLL_FLAG_WRITE 0x08 // device is ready for writing
614+#define POLL_FLAG_SOCKET 0x10 // device is a Windows socket
615+#define POLL_FLAG_NO_BULL 0x20 // callback does its own locking
616+#define POLL_FLAG_WINSOCK 0x40 // Winsock style write events
617+#define POLL_FLAG_FD 0x80 // device is a Windows file descriptor.
618+#define POLL_FLAG_ACCEPT_INVALID_FDS 0x100 // For broken 3rd party libs, e.g. curl
619+#define POLL_FLAG_THUNK_TO_WND 0x200 // thunk callback to window message loop
620+
621+
622+typedef void (*PollerFunction)(void *clientData);
623+typedef void (*PollerFireWrapper)(PollerFunction func,
624+ void *funcData,
625+ void *wrapperData);
626+typedef Bool (*PollerErrorFn)(const char *errorStr);
627+
628+/*
629+ * Initialisers:
630+ *
631+ * For the sake of convenience, we declare the initialisers
632+ * for custom implmentations here, even though the actual
633+ * implementations are distinct from the core poll code.
634+ */
635+
636+typedef struct PollOptions {
637+ Bool locked; // Use internal MXUser for locking
638+ Bool allowFullQueue; // Don't assert when device event queue is full.
639+ VThreadID windowsMsgThread; // thread that processes Windows messages
640+ PollerFireWrapper fireWrapperFn; // optional; may be useful for stats
641+ void *fireWrapperData; // optional
642+ PollerErrorFn errorFn; // optional; called upon unrecoverable error
643+} PollOptions;
644+
645+
646+void Poll_InitDefault(void);
647+void Poll_InitDefaultEx(const PollOptions *opts);
648+void Poll_InitGtk(void); // On top of glib for Linux
649+void Poll_InitCF(void); // On top of CoreFoundation for OSX
650+
651+
652+/*
653+ * Functions
654+ */
655+int Poll_SocketPair(Bool vmci, Bool stream, int fds[2]);
656+void Poll_Loop(Bool loop, Bool *exit, PollClass c);
657+void Poll_LoopTimeout(Bool loop, Bool *exit, PollClass c, int timeout);
658+Bool Poll_LockingEnabled(void);
659+void Poll_Exit(void);
660+
661+
662+/*
663+ * Poll_Callback adds a callback regardless of whether an identical one exists.
664+ * The exception to this rule is POLL_DEVICE callbacks: there is a maximum of
665+ * one read and one write callback per fd.
666+ *
667+ * Poll_CallbackRemove removes one callback. If there are multiple identical
668+ * callbacks, which one is removed is an implementation detail. Note that in
669+ * the case of POLL_DEVICE and POLL_REALTIME callbacks, the fd/delay used to
670+ * create the callback is not specified when removing, so all callbacks
671+ * of those types with the same flags, function, and clientData are considered
672+ * "identical" even if their fd/delay differed.
673+ */
674+
675+VMwareStatus Poll_Callback(PollClassSet classSet,
676+ int flags,
677+ PollerFunction f,
678+ void *clientData,
679+ PollEventType type,
680+ PollDevHandle info, // fd/microsec delay
681+ MXUserRecLock *lck);
682+Bool Poll_CallbackRemove(PollClassSet classSet,
683+ int flags,
684+ PollerFunction f,
685+ void *clientData,
686+ PollEventType type);
687+Bool Poll_CallbackRemoveOneByCB(PollClassSet classSet,
688+ int flags,
689+ PollerFunction f,
690+ PollEventType type,
691+ void **clientData);
692+
693+void Poll_NotifyChange(PollClassSet classSet);
694+
695+/*
696+ * Wrappers for Poll_Callback and Poll_CallbackRemove that present
697+ * simpler subsets of those interfaces.
698+ */
699+
700+VMwareStatus Poll_CB_Device(PollerFunction f,
701+ void *clientData,
702+ PollDevHandle device,
703+ Bool periodic);
704+
705+Bool Poll_CB_DeviceRemove(PollerFunction f,
706+ void *clientData,
707+ Bool periodic);
708+
709+
710+VMwareStatus Poll_CB_RTime(PollerFunction f,
711+ void *clientData,
712+ int64 delay, // microseconds
713+ Bool periodic,
714+ MXUserRecLock *lock);
715+
716+Bool Poll_CB_RTimeRemove(PollerFunction f,
717+ void *clientData,
718+ Bool periodic);
719+
720+
721+#ifdef _WIN32
722+void Poll_SetPumpsWindowsMessages(Bool pumps);
723+void Poll_SetWindowMessageRecipient(HWND hWnd, UINT msg, Bool alwaysThunk);
724+Bool Poll_FireWndCallback(void *lparam);
725+#endif
726+
727+#if defined(__cplusplus)
728+} // extern "C"
729+#endif
730+
731+#endif // _POLL_H_
92--- a/open-vm-tools/lib/rpcIn/rpcin.c 732--- a/open-vm-tools/lib/rpcIn/rpcin.c
93+++ b/open-vm-tools/lib/rpcIn/rpcin.c 733+++ b/open-vm-tools/lib/rpcIn/rpcin.c
94@@ -57,7 +57,7 @@ 734@@ -57,7 +57,7 @@
@@ -100,16 +740,3 @@ index 8eea7d86..c48f5be2 100644
100 # include "asyncsocket.h" 740 # include "asyncsocket.h"
101 # include "vmci_defs.h" 741 # include "vmci_defs.h"
102 #include "dataMap.h" 742 #include "dataMap.h"
103diff --git a/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c b/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
104index 03700937..f0b49ad7 100644
105--- a/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
106+++ b/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
107@@ -48,7 +48,7 @@
108 #include "rpcout.h"
109 #include "rabbitmqProxyConst.h"
110 #include "vm_basic_types.h"
111-#include "poll.h"
112+#include "vm_poll.h"
113 #ifdef OPEN_VM_TOOLS
114 #include "vmci_sockets.h"
115 #include "sslDirect.h"
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch
index 88f4f694c..3e4753b2a 100644
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch
@@ -14,18 +14,14 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 open-vm-tools/lib/misc/util_misc.c | 4 ++-- 14 open-vm-tools/lib/misc/util_misc.c | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-) 15 1 file changed, 2 insertions(+), 2 deletions(-)
16 16
17diff --git a/open-vm-tools/lib/misc/util_misc.c b/open-vm-tools/lib/misc/util_misc.c
18index 198c23d2..0ac0a335 100644
19--- a/open-vm-tools/lib/misc/util_misc.c 17--- a/open-vm-tools/lib/misc/util_misc.c
20+++ b/open-vm-tools/lib/misc/util_misc.c 18+++ b/open-vm-tools/lib/misc/util_misc.c
21@@ -719,8 +719,8 @@ Util_ExpandString(const char *fileName) // IN file path to expand 19@@ -719,7 +719,7 @@ Util_ExpandString(const char *fileName)
22 ASSERT(!freeChunk[i]); 20 ASSERT(!freeChunk[i]);
23 chunks[i] = expand; 21 chunks[i] = expand;
24 if (chunks[i] == NULL) { 22 if (chunks[i] == NULL) {
25- Log("%s: Cannot allocate memory to expand \"%s\" in \"%s\".\n", 23- Log("%s: Cannot allocate memory to expand $ in \"%s\".\n",
26- __FUNCTION__, expand, fileName);
27+ Log("%s: Cannot allocate memory to expand in \"%s\".\n", 24+ Log("%s: Cannot allocate memory to expand in \"%s\".\n",
28+ __FUNCTION__, fileName); 25 __FUNCTION__, fileName);
29 goto out; 26 goto out;
30 } 27 }
31 chunkSize[i] = strlen(expand);
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch
deleted file mode 100644
index b5ccffd14..000000000
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0014-Fix-new-warnings-from-gcc9.patch
+++ /dev/null
@@ -1,1281 +0,0 @@
1From af9eca8689c97ea8e792902b458a31608286655e Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@lge.com>
3Date: Thu, 13 Jun 2019 16:01:03 +0000
4Subject: [PATCH] Fix new warnings from gcc9
5
6Imported from Fedora:
7https://src.fedoraproject.org/rpms/open-vm-tools/raw/master/f/gcc9-warnings.patch
8
9Upstream bug:
10https://github.com/vmware/open-vm-tools/issues/330
11
12Upstream-Status: Pending
13---
14 open-vm-tools/hgfsmounter/hgfsmounter.c | 14 +-
15 open-vm-tools/lib/hgfsServer/hgfsServer.c | 24 ++-
16 open-vm-tools/vmhgfs-fuse/dir.c | 175 ++++++++---------
17 open-vm-tools/vmhgfs-fuse/file.c | 217 +++++++++++++---------
18 open-vm-tools/vmhgfs-fuse/filesystem.c | 46 ++---
19 open-vm-tools/vmhgfs-fuse/fsutil.c | 63 ++++---
20 open-vm-tools/vmhgfs-fuse/link.c | 125 +++++++------
21 7 files changed, 367 insertions(+), 297 deletions(-)
22
23diff --git a/open-vm-tools/hgfsmounter/hgfsmounter.c b/open-vm-tools/hgfsmounter/hgfsmounter.c
24index 0921b700..3f6798dc 100644
25--- a/open-vm-tools/hgfsmounter/hgfsmounter.c
26+++ b/open-vm-tools/hgfsmounter/hgfsmounter.c
27@@ -1,5 +1,5 @@
28 /*********************************************************
29- * Copyright (C) 2006-2017 VMware, Inc. All rights reserved.
30+ * Copyright (C) 2006-2019 VMware, Inc. All rights reserved.
31 *
32 * This program is free software; you can redistribute it and/or modify it
33 * under the terms of the GNU Lesser General Public License as published
34@@ -514,11 +514,13 @@ ParseFmask(const char *option, // IN: option string along with value
35 HgfsMountInfo *mountInfo, // OUT: mount data
36 int *flags) // OUT: mount flags
37 {
38+ unsigned short fmask = 0;
39 ASSERT(option);
40 ASSERT(mountInfo);
41
42- if (ParseMask(option, &mountInfo->fmask)) {
43- LOG("Setting mount fmask to %o\n", mountInfo->fmask);
44+ if (ParseMask(option, &fmask)) {
45+ LOG("Setting mount fmask to %o\n", fmask);
46+ mountInfo->fmask = fmask;
47 return TRUE;
48 }
49
50@@ -548,11 +550,13 @@ ParseDmask(const char *option, // IN: option string along with value
51 HgfsMountInfo *mountInfo, // OUT: mount data
52 int *flags) // OUT: mount flags
53 {
54+ unsigned short dmask = 0;
55 ASSERT(option);
56 ASSERT(mountInfo);
57
58- if (ParseMask(option, &mountInfo->dmask)) {
59- LOG("Setting mount dmask to %o\n", mountInfo->dmask);
60+ if (ParseMask(option, &dmask)) {
61+ LOG("Setting mount dmask to %o\n", dmask);
62+ mountInfo->dmask = dmask;
63 return TRUE;
64 }
65
66diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c
67index 740c4fed..422383cd 100644
68--- a/open-vm-tools/lib/hgfsServer/hgfsServer.c
69+++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c
70@@ -1,5 +1,5 @@
71 /*********************************************************
72- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
73+ * Copyright (C) 1998-2019 VMware, Inc. All rights reserved.
74 *
75 * This program is free software; you can redistribute it and/or modify it
76 * under the terms of the GNU Lesser General Public License as published
77@@ -159,7 +159,7 @@ struct HgfsTransportSessionInfo {
78 HgfsServerChannelData channelCapabilities;
79 };
80
81-/* The input request paramaters object. */
82+/* The input request parameters object. */
83 typedef struct HgfsInputParam {
84 const void *request; /* Hgfs header followed by operation request */
85 size_t requestSize; /* Size of Hgfs header and operation request */
86@@ -2682,8 +2682,8 @@ HgfsSearchHandle2Search(HgfsHandle handle, // IN: handle
87 * None
88 *
89 * Side effects:
90- * If there isnt enough memory to accomodate the new names, those file nodes
91- * that couldnt be updated are deleted.
92+ * If there isn't enough memory to accommodate the new names, those file nodes
93+ * that couldn't be updated are deleted.
94 *
95 *-----------------------------------------------------------------------------
96 */
97@@ -3399,7 +3399,7 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet
98
99 /* Send error if we fail to process the op. */
100 if (HGFS_ERROR_SUCCESS != status) {
101- LOG(4, ("Error %d occured parsing the packet\n", (uint32)status));
102+ LOG(4, ("Error %d occurred parsing the packet\n", (uint32)status));
103 HgfsServerCompleteRequest(status, 0, input);
104 }
105 }
106@@ -4131,7 +4131,7 @@ HgfsServerSetSessionCapability(HgfsOp op, // IN: operation code
107 result = TRUE;
108 }
109 }
110- LOG(4, ("%s: Setting capabilitiy flags %x for op code %d %s\n",
111+ LOG(4, ("%s: Setting capability flags %x for op code %d %s\n",
112 __FUNCTION__, flags, op, result ? "succeeded" : "failed"));
113
114 return result;
115@@ -4143,7 +4143,7 @@ HgfsServerSetSessionCapability(HgfsOp op, // IN: operation code
116 *
117 * HgfsServerResEnumInit --
118 *
119- * Initialize an enumeration of all exisitng resources.
120+ * Initialize an enumeration of all existing resources.
121 *
122 * Results:
123 * The enumeration state object.
124@@ -4239,7 +4239,7 @@ HgfsServerResEnumExit(void *enumState) // IN/OUT: enumeration state
125 *
126 * HgfsServerEnumerateSharedFolders --
127 *
128- * Enumerates all exisitng shared folders and registers shared folders with
129+ * Enumerates all existing shared folders and registers shared folders with
130 * directory notification package.
131 *
132 * Results:
133@@ -6536,11 +6536,13 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params
134 payload = &reply->payload[0];
135 }
136 if (payload) {
137+ uint32 actualSize = 0;
138 status = HgfsPlatformReadFile(readFd, input->session, offset,
139 requiredSize, payload,
140- &reply->actualSize);
141+ &actualSize);
142 if (HGFS_ERROR_SUCCESS == status) {
143 reply->reserved = 0;
144+ reply->actualSize = actualSize;
145 replyPayloadSize = sizeof *reply;
146
147 if (readUseDataBuffer) {
148@@ -6556,11 +6558,13 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params
149 break;
150 }
151 case HGFS_OP_READ: {
152+ uint32 actualSize = 0;
153 HgfsReplyRead *reply = replyRead;
154
155 status = HgfsPlatformReadFile(readFd, input->session, offset, requiredSize,
156- reply->payload, &reply->actualSize);
157+ reply->payload, &actualSize);
158 if (HGFS_ERROR_SUCCESS == status) {
159+ reply->actualSize = actualSize;
160 replyPayloadSize = sizeof *reply + reply->actualSize;
161 } else {
162 LOG(4, ("%s: V1 Failed to read-> %d.\n", __FUNCTION__, status));
163diff --git a/open-vm-tools/vmhgfs-fuse/dir.c b/open-vm-tools/vmhgfs-fuse/dir.c
164index 6298a4ea..e71b7afd 100644
165--- a/open-vm-tools/vmhgfs-fuse/dir.c
166+++ b/open-vm-tools/vmhgfs-fuse/dir.c
167@@ -1,5 +1,5 @@
168 /*********************************************************
169- * Copyright (C) 2013 VMware, Inc. All rights reserved.
170+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
171 *
172 * This program is free software; you can redistribute it and/or modify it
173 * under the terms of the GNU Lesser General Public License as published
174@@ -54,38 +54,53 @@ HgfsPackDirOpenRequest(const char *path, // IN: Path of the dir to open
175 HgfsOp opUsed, // IN: Op to be used
176 HgfsReq *req) // IN/OUT: Packet to write into
177 {
178- char *name;
179- unsigned int *nameLength = NULL;
180 size_t reqSize;
181- int result;
182
183 ASSERT(path);
184 ASSERT(req);
185 LOG(4, ("Path = %s \n", path));
186 switch (opUsed) {
187 case HGFS_OP_SEARCH_OPEN_V3: {
188+ int result;
189 HgfsRequestSearchOpenV3 *requestV3 = HgfsGetRequestPayload(req);
190
191- /* We'll use these later. */
192- name = requestV3->dirName.name;
193- nameLength = &requestV3->dirName.length;
194 requestV3->dirName.flags = 0;
195 requestV3->dirName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
196 requestV3->dirName.fid = HGFS_INVALID_HANDLE;
197 requestV3->reserved = 0;
198 reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
199+ /* Convert to CP name. */
200+ result = CPName_ConvertTo(path,
201+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
202+ requestV3->dirName.name);
203+ if (result < 0) {
204+ LOG(4, ("CP conversion failed\n"));
205+ return -EINVAL;
206+ }
207+ LOG(4, ("After conversion = %s\n", requestV3->dirName.name));
208+ requestV3->dirName.length = result;
209+ reqSize += result;
210 break;
211 }
212
213 case HGFS_OP_SEARCH_OPEN: {
214+ int result;
215 HgfsRequestSearchOpen *request;
216
217 request = (HgfsRequestSearchOpen *)(HGFS_REQ_PAYLOAD(req));
218
219- /* We'll use these later. */
220- name = request->dirName.name;
221- nameLength = &request->dirName.length;
222 reqSize = sizeof *request;
223+ /* Convert to CP name. */
224+ result = CPName_ConvertTo(path,
225+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
226+ request->dirName.name);
227+ if (result < 0) {
228+ LOG(4, ("CP conversion failed\n"));
229+ return -EINVAL;
230+ }
231+ LOG(4, ("After conversion = %s\n", request->dirName.name));
232+ request->dirName.length = result;
233+ reqSize += result;
234 break;
235 }
236
237@@ -94,21 +109,7 @@ HgfsPackDirOpenRequest(const char *path, // IN: Path of the dir to open
238 return -EPROTO;
239 }
240
241- /* Convert to CP name. */
242-
243- LOG(4, ("After buildPath = %s\n", path));
244- result = CPName_ConvertTo(path,
245- HGFS_LARGE_PACKET_MAX - (reqSize - 1),
246- name);
247- if (result < 0) {
248- LOG(4, ("CP conversion failed\n"));
249- return -EINVAL;
250- }
251-
252- LOG(4, ("After conversion = %s\n", name));
253-
254- *nameLength = (uint32) result;
255- req->payloadSize = reqSize + result;
256+ req->payloadSize = reqSize;
257
258 /* Fill in header here as payloadSize needs to be there. */
259 HgfsPackHeader(req, opUsed);
260@@ -149,7 +150,6 @@ HgfsDirOpen(const char* path, // IN: Path of dir to open
261 int result;
262 HgfsOp opUsed;
263 HgfsStatus replyStatus;
264- HgfsHandle *replySearch;
265
266 ASSERT(path);
267 req = HgfsGetNewRequest();
268@@ -161,16 +161,6 @@ HgfsDirOpen(const char* path, // IN: Path of dir to open
269
270 retry:
271 opUsed = hgfsVersionSearchOpen;
272- if (opUsed == HGFS_OP_SEARCH_OPEN_V3) {
273- HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req);
274-
275- replySearch = &requestV3->search;
276-
277- } else {
278- HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req);
279-
280- replySearch = &request->search;
281- }
282
283 result = HgfsPackDirOpenRequest(path, opUsed, req);
284 if (result != 0) {
285@@ -187,8 +177,14 @@ retry:
286
287 switch (result) {
288 case 0:
289- *handle = *replySearch;
290- LOG(6, ("Set handle to %u\n", *replySearch));
291+ if (opUsed == HGFS_OP_SEARCH_OPEN_V3) {
292+ HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req);
293+ *handle = requestV3->search;
294+ } else {
295+ HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req);
296+ *handle = request->search;
297+ }
298+ LOG(6, ("Set handle to %u\n", *handle));
299 break;
300 case -EPROTO:
301 /* Retry with older version(s). Set globally. */
302@@ -626,25 +622,30 @@ HgfsPackCreateDirRequest(const char *path,
303 HgfsOp opUsed, // IN: Op to be used.
304 HgfsReq *req) // IN/OUT: Packet to write into
305 {
306- char *fileName = NULL;
307- uint32 *fileNameLength;
308 size_t reqSize;
309- int result;
310+
311
312 ASSERT(req);
313
314 switch (opUsed) {
315 case HGFS_OP_CREATE_DIR_V3: {
316+ int result;
317 HgfsRequestCreateDirV3 *requestV3 = HgfsGetRequestPayload(req);
318
319 reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
320- /* We'll use these later. */
321- fileName = requestV3->fileName.name;
322- fileNameLength = &requestV3->fileName.length;
323 requestV3->fileName.flags = 0;
324 requestV3->fileName.fid = HGFS_INVALID_HANDLE;
325 requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
326-
327+ /* Convert to CP name. */
328+ result = CPName_ConvertTo(path,
329+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
330+ requestV3->fileName.name);
331+ if (result < 0) {
332+ LOG(4, ("CP conversion failed.\n"));
333+ return -EINVAL;
334+ }
335+ requestV3->fileName.length = result;
336+ reqSize += result;
337 requestV3->mask = HGFS_CREATE_DIR_MASK;
338
339 /* Set permissions. */
340@@ -656,15 +657,23 @@ HgfsPackCreateDirRequest(const char *path,
341 break;
342 }
343 case HGFS_OP_CREATE_DIR_V2: {
344+ int result;
345 HgfsRequestCreateDirV2 *requestV2;
346
347 requestV2 = (HgfsRequestCreateDirV2 *)(HGFS_REQ_PAYLOAD(req));
348
349- /* We'll use these later. */
350- fileName = requestV2->fileName.name;
351- fileNameLength = &requestV2->fileName.length;
352 reqSize = sizeof *requestV2;
353
354+ /* Convert to CP name. */
355+ result = CPName_ConvertTo(path,
356+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
357+ requestV2->fileName.name);
358+ if (result < 0) {
359+ LOG(4, ("CP conversion failed.\n"));
360+ return -EINVAL;
361+ }
362+ requestV2->fileName.length = result;
363+ reqSize += result;
364 requestV2->mask = HGFS_CREATE_DIR_MASK;
365
366 /* Set permissions. */
367@@ -675,15 +684,22 @@ HgfsPackCreateDirRequest(const char *path,
368 break;
369 }
370 case HGFS_OP_CREATE_DIR: {
371+ int result;
372 HgfsRequestCreateDir *request;
373
374 request = (HgfsRequestCreateDir *)(HGFS_REQ_PAYLOAD(req));
375
376- /* We'll use these later. */
377- fileName = request->fileName.name;
378- fileNameLength = &request->fileName.length;
379 reqSize = sizeof *request;
380-
381+ /* Convert to CP name. */
382+ result = CPName_ConvertTo(path,
383+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
384+ request->fileName.name);
385+ if (result < 0) {
386+ LOG(4, ("CP conversion failed.\n"));
387+ return -EINVAL;
388+ }
389+ request->fileName.length = result;
390+ reqSize += result;
391 /* Set permissions. */
392 request->permissions = (permsMode & S_IRWXU) >> 6;
393 break;
394@@ -693,18 +709,7 @@ HgfsPackCreateDirRequest(const char *path,
395 return -EPROTO;
396 }
397
398-
399- /* Convert to CP name. */
400- result = CPName_ConvertTo(path,
401- HGFS_LARGE_PACKET_MAX - (reqSize - 1),
402- fileName);
403- if (result < 0) {
404- LOG(4, ("CP conversion failed.\n"));
405- return -EINVAL;
406- }
407-
408- *fileNameLength = result;
409- req->payloadSize = reqSize + result;
410+ req->payloadSize = reqSize;
411
412 /* Fill in header here as payloadSize needs to be there. */
413 HgfsPackHeader(req, opUsed);
414@@ -827,8 +832,6 @@ HgfsDelete(const char* path, // IN: Path to file
415 HgfsReq *req = NULL;
416 int result = 0;
417 HgfsStatus replyStatus;
418- char *fileName = NULL;
419- uint32 *fileNameLength;
420 uint32 reqSize;
421 HgfsOp opUsed;
422 HgfsAttrInfo newAttr = {0};
423@@ -862,8 +865,17 @@ HgfsDelete(const char* path, // IN: Path to file
424
425 reqSize = sizeof(*request) + HgfsGetRequestHeaderSize();
426 request->hints = 0;
427- fileName = request->fileName.name;
428- fileNameLength = &request->fileName.length;
429+ /* Convert to CP name. */
430+ result = CPName_ConvertTo(path,
431+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
432+ request->fileName.name);
433+ if (result < 0) {
434+ LOG(4, ("CP conversion failed.\n"));
435+ result = -EINVAL;
436+ goto out;
437+ }
438+ request->fileName.length = result;
439+ reqSize += result;
440 request->fileName.fid = HGFS_INVALID_HANDLE;
441 request->fileName.flags = 0;
442 request->fileName.caseType = HGFS_FILE_NAME_DEFAULT_CASE;
443@@ -874,24 +886,21 @@ HgfsDelete(const char* path, // IN: Path to file
444
445 request = (HgfsRequestDelete *)(HGFS_REQ_PAYLOAD(req));
446 /* Fill out the request packet. */
447- fileName = request->fileName.name;
448- fileNameLength = &request->fileName.length;
449 reqSize = sizeof *request;
450+ /* Convert to CP name. */
451+ result = CPName_ConvertTo(path,
452+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
453+ request->fileName.name);
454+ if (result < 0) {
455+ LOG(4, ("CP conversion failed.\n"));
456+ result = -EINVAL;
457+ goto out;
458+ }
459+ request->fileName.length = result;
460+ reqSize += result;
461 }
462
463-
464- /* Convert to CP name. */
465- result = CPName_ConvertTo(path,
466- HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
467- fileName);
468- if (result < 0) {
469- LOG(4, ("CP conversion failed.\n"));
470- result = -EINVAL;
471- goto out;
472- }
473-
474- *fileNameLength = result;
475- req->payloadSize = reqSize + result;
476+ req->payloadSize = reqSize;
477
478 /* Fill in header here as payloadSize needs to be there. */
479 HgfsPackHeader(req, opUsed);
480diff --git a/open-vm-tools/vmhgfs-fuse/file.c b/open-vm-tools/vmhgfs-fuse/file.c
481index 389ebba8..0b6c48bc 100644
482--- a/open-vm-tools/vmhgfs-fuse/file.c
483+++ b/open-vm-tools/vmhgfs-fuse/file.c
484@@ -1,5 +1,5 @@
485 /*********************************************************
486- * Copyright (C) 2013,2017 VMware, Inc. All rights reserved.
487+ * Copyright (C) 2013,2018-2019 VMware, Inc. All rights reserved.
488 *
489 * This program is free software; you can redistribute it and/or modify it
490 * under the terms of the GNU Lesser General Public License as published
491@@ -66,10 +66,7 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file
492 HgfsOp opUsed, // IN: Op to use
493 HgfsReq *req) // IN/OUT: Packet to write into
494 {
495- char *name;
496- uint32 *nameLength;
497 size_t reqSize;
498- int result;
499 int openMode, openFlags;
500
501 ASSERT(path);
502@@ -88,14 +85,22 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file
503
504 switch (opUsed) {
505 case HGFS_OP_OPEN_V3: {
506+ int result;
507 HgfsRequestOpenV3 *requestV3 = HgfsGetRequestPayload(req);
508
509 reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
510
511- /* We'll use these later. */
512- name = requestV3->fileName.name;
513- nameLength = &requestV3->fileName.length;
514+ /* Convert to CP name. */
515+ result = CPName_ConvertTo(path,
516+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
517+ requestV3->fileName.name);
518+ if (result < 0) {
519+ LOG(4, ("CP conversion failed.\n"));
520+ return -EINVAL;
521+ }
522
523+ requestV3->fileName.length = result;
524+ reqSize += result;
525 /* Linux clients need case-sensitive lookups. */
526 requestV3->fileName.flags = 0;
527 requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
528@@ -122,15 +127,24 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file
529 }
530
531 case HGFS_OP_OPEN_V2: {
532+ int result;
533 HgfsRequestOpenV2 *requestV2;
534
535 requestV2 = (HgfsRequestOpenV2 *)(HGFS_REQ_PAYLOAD(req));
536
537- /* We'll use these later. */
538- name = requestV2->fileName.name;
539- nameLength = &requestV2->fileName.length;
540 reqSize = sizeof *requestV2;
541
542+ /* Convert to CP name. */
543+ result = CPName_ConvertTo(path,
544+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
545+ requestV2->fileName.name);
546+ if (result < 0) {
547+ LOG(4, ("CP conversion failed.\n"));
548+ return -EINVAL;
549+ }
550+
551+ requestV2->fileName.length = result;
552+ reqSize += result;
553 requestV2->mask = mask;
554 requestV2->mode = openMode;
555 requestV2->flags = openFlags;
556@@ -148,14 +162,23 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file
557 break;
558 }
559 case HGFS_OP_OPEN: {
560+ int result;
561 HgfsRequestOpen *request;
562
563 request = (HgfsRequestOpen *)(HGFS_REQ_PAYLOAD(req));
564- /* We'll use these later. */
565- name = request->fileName.name;
566- nameLength = &request->fileName.length;
567 reqSize = sizeof *request;
568
569+ /* Convert to CP name. */
570+ result = CPName_ConvertTo(path,
571+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
572+ request->fileName.name);
573+ if (result < 0) {
574+ LOG(4, ("CP conversion failed.\n"));
575+ return -EINVAL;
576+ }
577+
578+ request->fileName.length = result;
579+ reqSize += result;
580 request->mode = openMode;
581 request->flags = openFlags;
582
583@@ -168,18 +191,7 @@ HgfsPackOpenRequest(const char *path, // IN: Path to file
584 return -EPROTO;
585 }
586
587-
588- /* Convert to CP name. */
589- result = CPName_ConvertTo(path,
590- HGFS_LARGE_PACKET_MAX - (reqSize - 1),
591- name);
592- if (result < 0) {
593- LOG(4, ("CP conversion failed.\n"));
594- return -EINVAL;
595- }
596-
597- *nameLength = (uint32) result;
598- req->payloadSize = reqSize + result;
599+ req->payloadSize = reqSize;
600
601 /* Fill in header here as payloadSize needs to be there. */
602 HgfsPackHeader(req, opUsed);
603@@ -915,10 +927,6 @@ int
604 HgfsRename(const char* from, const char* to)
605 {
606 HgfsReq *req = NULL;
607- char *oldName;
608- char *newName;
609- uint32 *oldNameLength;
610- uint32 *newNameLength;
611 int result = 0;
612 uint32 reqSize;
613 HgfsOp opUsed;
614@@ -942,33 +950,41 @@ retry:
615 if (opUsed == HGFS_OP_RENAME_V3) {
616 HgfsRequestRenameV3 *requestV3 = HgfsGetRequestPayload(req);
617
618- oldName = requestV3->oldName.name;
619- oldNameLength = &requestV3->oldName.length;
620 requestV3->hints = 0;
621 requestV3->oldName.flags = 0;
622 requestV3->oldName.fid = HGFS_INVALID_HANDLE;
623 requestV3->oldName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
624 requestV3->reserved = 0;
625 reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
626+ /* Convert old name to CP format. */
627+ result = CPName_ConvertTo(from,
628+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
629+ requestV3->oldName.name);
630+ if (result < 0) {
631+ LOG(4, ("oldName CP conversion failed\n"));
632+ result = -EINVAL;
633+ goto out;
634+ }
635+
636+ requestV3->oldName.length = result;
637+ reqSize += result;
638 } else {
639 HgfsRequestRename *request = (HgfsRequestRename *)HGFS_REQ_PAYLOAD(req);
640
641- oldName = request->oldName.name;
642- oldNameLength = &request->oldName.length;
643 reqSize = sizeof *request;
644- }
645- /* Convert old name to CP format. */
646- result = CPName_ConvertTo(from,
647- HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
648- oldName);
649- if (result < 0) {
650- LOG(4, ("oldName CP conversion failed\n"));
651- result = -EINVAL;
652- goto out;
653- }
654+ /* Convert old name to CP format. */
655+ result = CPName_ConvertTo(from,
656+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
657+ request->oldName.name);
658+ if (result < 0) {
659+ LOG(4, ("oldName CP conversion failed\n"));
660+ result = -EINVAL;
661+ goto out;
662+ }
663
664- *oldNameLength = result;
665- reqSize += result;
666+ request->oldName.length = result;
667+ reqSize += result;
668+ }
669
670 /*
671 * Build full new name to send to server.
672@@ -983,8 +999,20 @@ retry:
673
674 newNameP = (HgfsFileNameV3 *)((char *)&requestV3->oldName +
675 sizeof requestV3->oldName + result);
676- newName = newNameP->name;
677- newNameLength = &newNameP->length;
678+
679+ LOG(6, ("New name: \"%s\"\n", newNameP->name));
680+
681+ /* Convert new name to CP format. */
682+ result = CPName_ConvertTo(to,
683+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
684+ newNameP->name);
685+ if (result < 0) {
686+ LOG(4, ("newName CP conversion failed\n"));
687+ result = -EINVAL;
688+ goto out;
689+ }
690+ newNameP->length = result;
691+ reqSize += result;
692 newNameP->flags = 0;
693 newNameP->fid = HGFS_INVALID_HANDLE;
694 newNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
695@@ -993,24 +1021,22 @@ retry:
696 HgfsFileName *newNameP;
697 newNameP = (HgfsFileName *)((char *)&request->oldName +
698 sizeof request->oldName + result);
699- newName = newNameP->name;
700- newNameLength = &newNameP->length;
701- }
702
703- LOG(6, ("New name: \"%s\"\n", newName));
704+ LOG(6, ("New name: \"%s\"\n", newNameP->name));
705
706- /* Convert new name to CP format. */
707- result = CPName_ConvertTo(to,
708- HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
709- newName);
710- if (result < 0) {
711- LOG(4, ("newName CP conversion failed\n"));
712- result = -EINVAL;
713- goto out;
714+ /* Convert new name to CP format. */
715+ result = CPName_ConvertTo(to,
716+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
717+ newNameP->name);
718+ if (result < 0) {
719+ LOG(4, ("newName CP conversion failed\n"));
720+ result = -EINVAL;
721+ goto out;
722+ }
723+ newNameP->length = result;
724+ reqSize += result;
725 }
726
727- *newNameLength = result;
728- reqSize += result;
729 req->payloadSize = reqSize;
730
731 /* Fill in header here as payloadSize needs to be there. */
732@@ -1068,7 +1094,7 @@ retry:
733 }
734 break;
735 default:
736- LOG(4, ("failed with result %d\n", result));
737+ LOG(4, ("Server protocol result %d\n", result));
738 }
739 break;
740 default:
741@@ -1109,21 +1135,17 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
742 {
743 HgfsAttrV2 *attrV2;
744 HgfsAttr *attrV1;
745- HgfsAttrHint *hints;
746 HgfsAttrChanges *update;
747- char *fileName = NULL;
748- uint32 *fileNameLength = NULL;
749 size_t reqBufferSize;
750 size_t reqSize;
751- int result = 0;
752 ASSERT(req);
753
754 switch (opUsed) {
755 case HGFS_OP_SETATTR_V3: {
756+ int result;
757 HgfsRequestSetattrV3 *requestV3 = HgfsGetRequestPayload(req);
758
759 attrV2 = &requestV3->attr;
760- hints = &requestV3->hints;
761
762 /*
763 * Clear attributes, mask, and hints before touching them.
764@@ -1131,7 +1153,7 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
765 * make sure to zero them all here.
766 */
767 memset(attrV2, 0, sizeof *attrV2);
768- memset(hints, 0, sizeof *hints);
769+ requestV3->hints = 0;
770
771 /*
772 * When possible, issue a setattr using an existing handle. This will
773@@ -1143,14 +1165,21 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
774 * the times also requires write permissions on Windows, so we require it
775 * here too. Otherwise, any handle will do.
776 */
777- fileName = requestV3->fileName.name;
778- fileNameLength = &requestV3->fileName.length;
779 requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
780 requestV3->fileName.fid = HGFS_INVALID_HANDLE;
781 requestV3->fileName.flags = 0;
782 requestV3->reserved = 0;
783 reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
784 reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
785+ result = CPName_ConvertTo(path,
786+ reqBufferSize,
787+ requestV3->fileName.name);
788+ if (result < 0) {
789+ LOG(4, ("CP conversion failed.\n"));
790+ return -EINVAL;
791+ }
792+ requestV3->fileName.length = result;
793+ reqSize += result;
794
795 attrV2->mask = attr->mask;
796 if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS |
797@@ -1173,22 +1202,22 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
798 }
799 if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) {
800 attrV2->accessTime = attr->accessTime;
801- *hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
802+ requestV3->hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
803 }
804 if (attr->mask & HGFS_ATTR_VALID_WRITE_TIME) {
805 attrV2->writeTime = attr->writeTime;
806- *hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
807+ requestV3->hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
808 }
809
810 break;
811 }
812 case HGFS_OP_SETATTR_V2: {
813+ int result;
814 HgfsRequestSetattrV2 *requestV2;
815
816 requestV2 = (HgfsRequestSetattrV2 *)(HGFS_REQ_PAYLOAD(req));
817
818 attrV2 = &requestV2->attr;
819- hints = &requestV2->hints;
820
821 /*
822 * Clear attributes, mask, and hints before touching them.
823@@ -1196,13 +1225,19 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
824 * make sure to zero them all here.
825 */
826 memset(attrV2, 0, sizeof *attrV2);
827- memset(hints, 0, sizeof *hints);
828-
829- fileName = requestV2->fileName.name;
830- fileNameLength = &requestV2->fileName.length;
831+ requestV2->hints = 0;
832
833 reqSize = sizeof *requestV2;
834 reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
835+ result = CPName_ConvertTo(path,
836+ reqBufferSize,
837+ requestV2->fileName.name);
838+ if (result < 0) {
839+ LOG(4, ("CP conversion failed.\n"));
840+ return -EINVAL;
841+ }
842+ requestV2->fileName.length = result;
843+ reqSize += result;
844
845 if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS |
846 HGFS_ATTR_VALID_OWNER_PERMS |
847@@ -1224,16 +1259,17 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
848 }
849 if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) {
850 attrV2->accessTime = attr->accessTime;
851- *hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
852+ requestV2->hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
853 }
854 if (attr->mask & HGFS_ATTR_VALID_WRITE_TIME) {
855 attrV2->writeTime = attr->writeTime;
856- *hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
857+ requestV2->hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
858 }
859
860 break;
861 }
862 case HGFS_OP_SETATTR: {
863+ int result;
864 HgfsRequestSetattr *request;
865
866 request = (HgfsRequestSetattr *)(HGFS_REQ_PAYLOAD(req));
867@@ -1241,11 +1277,17 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
868 attrV1 = &request->attr;
869 update = &request->update;
870
871- /* We'll use these later. */
872- fileName = request->fileName.name;
873- fileNameLength = &request->fileName.length;
874 reqSize = sizeof *request;
875 reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, request);
876+ result = CPName_ConvertTo(path,
877+ reqBufferSize,
878+ request->fileName.name);
879+ if (result < 0) {
880+ LOG(4, ("CP conversion failed.\n"));
881+ return -EINVAL;
882+ }
883+ request->fileName.length = result;
884+ reqSize += result;
885
886 /*
887 * Clear attributes before touching them.
888@@ -1284,16 +1326,7 @@ HgfsPackSetattrRequest(const char *path, // IN: path to file
889 return -EPROTO;
890 }
891
892- result = CPName_ConvertTo(path,
893- reqBufferSize,
894- fileName);
895- if (result < 0) {
896- LOG(4, ("CP conversion failed.\n"));
897- return -EINVAL;
898- }
899-
900- *fileNameLength = result;
901- req->payloadSize = reqSize + result;
902+ req->payloadSize = reqSize;
903
904 /* Fill in header here as payloadSize needs to be there. */
905 HgfsPackHeader(req, opUsed);
906diff --git a/open-vm-tools/vmhgfs-fuse/filesystem.c b/open-vm-tools/vmhgfs-fuse/filesystem.c
907index fb9d547d..1931a5d2 100644
908--- a/open-vm-tools/vmhgfs-fuse/filesystem.c
909+++ b/open-vm-tools/vmhgfs-fuse/filesystem.c
910@@ -1,5 +1,5 @@
911 /*********************************************************
912- * Copyright (C) 2013 VMware, Inc. All rights reserved.
913+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
914 *
915 * This program is free software; you can redistribute it and/or modify it
916 * under the terms of the GNU Lesser General Public License as published
917@@ -123,36 +123,50 @@ HgfsPackQueryVolumeRequest(const char *path, // IN: File pointer for this
918 HgfsOp opUsed, // IN: Op to be used.
919 HgfsReq *req) // IN/OUT: Packet to write into
920 {
921- char *name;
922- uint32 *nameLength;
923 size_t requestSize;
924- int result;
925+
926
927 ASSERT(req);
928
929 switch (opUsed) {
930 case HGFS_OP_QUERY_VOLUME_INFO_V3: {
931+ int result;
932 HgfsRequestQueryVolumeV3 *requestV3 = HgfsGetRequestPayload(req);
933
934- /* We'll use these later. */
935- name = requestV3->fileName.name;
936- nameLength = &requestV3->fileName.length;
937 requestV3->fileName.flags = 0;
938 requestV3->fileName.fid = HGFS_INVALID_HANDLE;
939 requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
940 requestV3->reserved = 0;
941 requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
942+ /* Convert to CP name. */
943+ result = CPName_ConvertTo(path,
944+ HGFS_LARGE_PACKET_MAX - (requestSize - 1),
945+ requestV3->fileName.name);
946+ if (result < 0) {
947+ LOG(4, ("CP conversion failed.\n"));
948+ return -EINVAL;
949+ }
950+ requestV3->fileName.length = result;
951+ requestSize += result;
952 break;
953 }
954 case HGFS_OP_QUERY_VOLUME_INFO: {
955+ int result;
956 HgfsRequestQueryVolume *request;
957
958 request = (HgfsRequestQueryVolume *)(HGFS_REQ_PAYLOAD(req));
959
960- /* We'll use these later. */
961- name = request->fileName.name;
962- nameLength = &request->fileName.length;
963 requestSize = sizeof *request;
964+ /* Convert to CP name. */
965+ result = CPName_ConvertTo(path,
966+ HGFS_LARGE_PACKET_MAX - (requestSize - 1),
967+ request->fileName.name);
968+ if (result < 0) {
969+ LOG(4, ("CP conversion failed.\n"));
970+ return -EINVAL;
971+ }
972+ request->fileName.length = result;
973+ requestSize += result;
974 break;
975 }
976 default:
977@@ -160,17 +174,7 @@ HgfsPackQueryVolumeRequest(const char *path, // IN: File pointer for this
978 return -EPROTO;
979 }
980
981- /* Convert to CP name. */
982- result = CPName_ConvertTo(path,
983- HGFS_LARGE_PACKET_MAX - (requestSize - 1),
984- name);
985- if (result < 0) {
986- LOG(4, ("CP conversion failed.\n"));
987- return -EINVAL;
988- }
989-
990- *nameLength = (uint32) result;
991- req->payloadSize = requestSize + result;
992+ req->payloadSize = requestSize;
993
994 /* Fill in header here as payloadSize needs to be there. */
995 HgfsPackHeader(req, opUsed);
996diff --git a/open-vm-tools/vmhgfs-fuse/fsutil.c b/open-vm-tools/vmhgfs-fuse/fsutil.c
997index 042c223c..af85c405 100644
998--- a/open-vm-tools/vmhgfs-fuse/fsutil.c
999+++ b/open-vm-tools/vmhgfs-fuse/fsutil.c
1000@@ -1,5 +1,5 @@
1001 /*********************************************************
1002- * Copyright (C) 2013 VMware, Inc. All rights reserved.
1003+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
1004 *
1005 * This program is free software; you can redistribute it and/or modify it
1006 * under the terms of the GNU Lesser General Public License as published
1007@@ -189,8 +189,6 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer
1008 size_t reqBufferSize;
1009 size_t reqSize;
1010 int result = 0;
1011- char *fileName = NULL;
1012- uint32 *fileNameLength = NULL;
1013 ASSERT(attr);
1014 ASSERT(req);
1015 ASSERT(path);
1016@@ -204,8 +202,6 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer
1017
1018 /* Fill out the request packet. */
1019 requestV3->hints = 0;
1020- fileName = requestV3->fileName.name;
1021- fileNameLength = &requestV3->fileName.length;
1022 requestV3->fileName.flags = 0;
1023 requestV3->fileName.fid = HGFS_INVALID_HANDLE;
1024 requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
1025@@ -213,6 +209,19 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer
1026 requestV3->reserved = 0;
1027 reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
1028 reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
1029+ if (requestV3->fileName.name != NULL) {
1030+ /* Convert to CP name. */
1031+ result = CPName_ConvertTo(path,
1032+ reqBufferSize,
1033+ requestV3->fileName.name);
1034+ LOG(8, ("Converted path %s\n", requestV3->fileName.name));
1035+ if (result < 0) {
1036+ LOG(8, ("CP conversion failed.\n"));
1037+ result = -EINVAL;
1038+ goto out;
1039+ }
1040+ requestV3->fileName.length = result;
1041+ }
1042 break;
1043 }
1044
1045@@ -223,20 +232,42 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer
1046
1047 requestV2 = (HgfsRequestGetattrV2 *)(HGFS_REQ_PAYLOAD(req));
1048 requestV2->hints = 0;
1049- fileName = requestV2->fileName.name;
1050- fileNameLength = &requestV2->fileName.length;
1051 reqSize = sizeof *requestV2;
1052 reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
1053+ if (requestV2->fileName.name != NULL) {
1054+ /* Convert to CP name. */
1055+ result = CPName_ConvertTo(path,
1056+ reqBufferSize,
1057+ requestV2->fileName.name);
1058+ LOG(8, ("Converted path %s\n", requestV2->fileName.name));
1059+ if (result < 0) {
1060+ LOG(8, ("CP conversion failed.\n"));
1061+ result = -EINVAL;
1062+ goto out;
1063+ }
1064+ requestV2->fileName.length = result;
1065+ }
1066 break;
1067 }
1068
1069 case HGFS_OP_GETATTR: {
1070 HgfsRequestGetattr *requestV1;
1071 requestV1 = (HgfsRequestGetattr *)(HGFS_REQ_PAYLOAD(req));
1072- fileName = requestV1->fileName.name;
1073- fileNameLength = &requestV1->fileName.length;
1074 reqSize = sizeof *requestV1;
1075 reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV1);
1076+ if (requestV1->fileName.name != NULL) {
1077+ /* Convert to CP name. */
1078+ result = CPName_ConvertTo(path,
1079+ reqBufferSize,
1080+ requestV1->fileName.name);
1081+ LOG(8, ("Converted path %s\n", requestV1->fileName.name));
1082+ if (result < 0) {
1083+ LOG(8, ("CP conversion failed.\n"));
1084+ result = -EINVAL;
1085+ goto out;
1086+ }
1087+ requestV1->fileName.length = result;
1088+ }
1089 break;
1090 }
1091
1092@@ -246,20 +277,6 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer
1093 goto out;
1094 }
1095
1096- if (fileName != NULL) {
1097- /* Convert to CP name. */
1098- result = CPName_ConvertTo(path,
1099- reqBufferSize,
1100- fileName);
1101- LOG(8, ("Converted path %s\n", fileName));
1102- if (result < 0) {
1103- LOG(8, ("CP conversion failed.\n"));
1104- result = -EINVAL;
1105- goto out;
1106- }
1107- *fileNameLength = result;
1108- }
1109-
1110 req->payloadSize = reqSize + result;
1111
1112 /* Fill in header here as payloadSize needs to be there. */
1113diff --git a/open-vm-tools/vmhgfs-fuse/link.c b/open-vm-tools/vmhgfs-fuse/link.c
1114index a00e8446..777eb76e 100644
1115--- a/open-vm-tools/vmhgfs-fuse/link.c
1116+++ b/open-vm-tools/vmhgfs-fuse/link.c
1117@@ -1,5 +1,5 @@
1118 /*********************************************************
1119- * Copyright (C) 2013 VMware, Inc. All rights reserved.
1120+ * Copyright (C) 2013,2019 VMware, Inc. All rights reserved.
1121 *
1122 * This program is free software; you can redistribute it and/or modify it
1123 * under the terms of the GNU Lesser General Public License as published
1124@@ -51,36 +51,81 @@ HgfsPackSymlinkCreateRequest(const char* symlink, // IN: path of the link
1125 {
1126 HgfsRequestSymlinkCreateV3 *requestV3 = NULL;
1127 HgfsRequestSymlinkCreate *request = NULL;
1128- char *symlinkName;
1129- uint32 *symlinkNameLength;
1130- char *targetName;
1131- uint32 *targetNameLength;
1132 size_t targetNameBytes;
1133-
1134 size_t requestSize;
1135- int result;
1136+
1137+ targetNameBytes = strlen(symname) + 1;
1138
1139 switch (opUsed) {
1140 case HGFS_OP_CREATE_SYMLINK_V3: {
1141+ int result;
1142+ HgfsFileNameV3 *fileNameP;
1143 requestV3 = HgfsGetRequestPayload(req);
1144
1145- /* We'll use these later. */
1146- symlinkName = requestV3->symlinkName.name;
1147- symlinkNameLength = &requestV3->symlinkName.length;
1148 requestV3->symlinkName.flags = 0;
1149 requestV3->symlinkName.fid = HGFS_INVALID_HANDLE;
1150 requestV3->symlinkName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
1151 requestV3->reserved = 0;
1152 requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
1153+ /* Convert symlink name to CP format. */
1154+ result = CPName_ConvertTo(symlink,
1155+ HGFS_LARGE_PACKET_MAX - (requestSize - 1),
1156+ requestV3->symlinkName.name);
1157+ if (result < 0) {
1158+ LOG(4, ("SymlinkName CP conversion failed.\n"));
1159+ return -EINVAL;
1160+ }
1161+ requestV3->symlinkName.length = result;
1162+ requestSize += result;
1163+
1164+ /* Copy target name into request packet. */
1165+ if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
1166+ LOG(4, ("Target name is too long.\n"));
1167+ return -EINVAL;
1168+ }
1169+
1170+ fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName +
1171+ sizeof requestV3->symlinkName + result);
1172+ memcpy(fileNameP->name, symname, targetNameBytes);
1173+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
1174+ /* Convert target name to CPName-lite format. */
1175+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
1176+ fileNameP->length = targetNameBytes - 1;
1177+ fileNameP->flags = 0;
1178+ fileNameP->fid = HGFS_INVALID_HANDLE;
1179+ fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
1180 break;
1181 }
1182 case HGFS_OP_CREATE_SYMLINK: {
1183+ int result;
1184+ HgfsFileName *fileNameP;
1185 request = (HgfsRequestSymlinkCreate *)(HGFS_REQ_PAYLOAD(req));
1186
1187- /* We'll use these later. */
1188- symlinkName = request->symlinkName.name;
1189- symlinkNameLength = &request->symlinkName.length;
1190 requestSize = sizeof *request;
1191+ /* Convert symlink name to CP format. */
1192+ result = CPName_ConvertTo(symlink,
1193+ HGFS_LARGE_PACKET_MAX - (requestSize - 1),
1194+ request->symlinkName.name);
1195+ if (result < 0) {
1196+ LOG(4, ("SymlinkName CP conversion failed.\n"));
1197+ return -EINVAL;
1198+ }
1199+ request->symlinkName.length = result;
1200+ requestSize += result;
1201+
1202+ /* Copy target name into request packet. */
1203+ if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
1204+ LOG(4, ("Target name is too long.\n"));
1205+ return -EINVAL;
1206+ }
1207+
1208+ fileNameP = (HgfsFileName *)((char *)&request->symlinkName +
1209+ sizeof request->symlinkName + result);
1210+ memcpy(fileNameP->name, symname, targetNameBytes);
1211+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
1212+ /* Convert target name to CPName-lite format. */
1213+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
1214+ fileNameP->length = targetNameBytes - 1;
1215 break;
1216 }
1217 default:
1218@@ -88,59 +133,13 @@ HgfsPackSymlinkCreateRequest(const char* symlink, // IN: path of the link
1219 return -EPROTO;
1220 }
1221
1222-
1223- /* Convert symlink name to CP format. */
1224- result = CPName_ConvertTo(symlink,
1225- HGFS_LARGE_PACKET_MAX - (requestSize - 1),
1226- symlinkName);
1227- if (result < 0) {
1228- LOG(4, ("SymlinkName CP conversion failed.\n"));
1229- return -EINVAL;
1230- }
1231-
1232- *symlinkNameLength = result;
1233- req->payloadSize = requestSize + result;
1234+ req->payloadSize = requestSize;
1235
1236 /*
1237- * Note the different buffer length. This is because HgfsRequestSymlink
1238- * contains two filenames, and once we place the first into the packet we
1239- * must account for it when determining the amount of buffer available for
1240- * the second.
1241- *
1242- * Also note that targetNameBytes accounts for the NUL character. Once
1243- * we've converted it to CP name, it won't be NUL-terminated and the length
1244- * of the string in the packet itself won't account for it.
1245+ * targetNameBytes accounts for the NUL character. Once we've converted
1246+ * it to CP name, it won't be NUL-terminated and the length of the string
1247+ * in the packet itself won't account for it.
1248 */
1249- if (opUsed == HGFS_OP_CREATE_SYMLINK_V3) {
1250- HgfsFileNameV3 *fileNameP;
1251- fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName +
1252- sizeof requestV3->symlinkName + result);
1253- targetName = fileNameP->name;
1254- targetNameLength = &fileNameP->length;
1255- fileNameP->flags = 0;
1256- fileNameP->fid = HGFS_INVALID_HANDLE;
1257- fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
1258- } else {
1259- HgfsFileName *fileNameP;
1260- fileNameP = (HgfsFileName *)((char *)&request->symlinkName +
1261- sizeof request->symlinkName + result);
1262- targetName = fileNameP->name;
1263- targetNameLength = &fileNameP->length;
1264- }
1265- targetNameBytes = strlen(symname) + 1;
1266-
1267- /* Copy target name into request packet. */
1268- if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
1269- LOG(4, ("Target name is too long.\n"));
1270- return -EINVAL;
1271- }
1272- memcpy(targetName, symname, targetNameBytes);
1273- LOG(6, ("Target name: \"%s\"\n", targetName));
1274-
1275- /* Convert target name to CPName-lite format. */
1276- CPNameLite_ConvertTo(targetName, targetNameBytes - 1, '/');
1277-
1278- *targetNameLength = targetNameBytes - 1;
1279 req->payloadSize += targetNameBytes - 1;
1280
1281 /* Fill in header here as payloadSize needs to be there. */
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_11.0.1.bb
index 63a64fc71..5dcf81838 100644
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.3.5.bb
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_11.0.1.bb
@@ -38,10 +38,8 @@ SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \
38 file://0011-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \ 38 file://0011-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \
39 file://0012-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \ 39 file://0012-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \
40 file://0013-misc-Do-not-print-NULL-string-into-logs.patch;patchdir=.. \ 40 file://0013-misc-Do-not-print-NULL-string-into-logs.patch;patchdir=.. \
41 file://0014-Fix-new-warnings-from-gcc9.patch;patchdir=.. \
42" 41"
43# stable-10.3.5 42SRCREV = "d3edfd142a81096f9f58aff17d84219b457f4987"
44SRCREV = "f2ff192717375b95a6b7e278fb47dbb3d3bc56d1"
45 43
46S = "${WORKDIR}/git/open-vm-tools" 44S = "${WORKDIR}/git/open-vm-tools"
47 45
@@ -56,7 +54,7 @@ SYSTEMD_SERVICE_${PN} = "vmtoolsd.service"
56 54
57EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \ 55EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \
58 --disable-tests --without-gtkmm --without-xerces --without-pam \ 56 --disable-tests --without-gtkmm --without-xerces --without-pam \
59 --disable-grabbitmqproxy --disable-vgauth --disable-deploypkg \ 57 --disable-vgauth --disable-deploypkg \
60 --without-root-privileges --without-kernel-modules" 58 --without-root-privileges --without-kernel-modules"
61 59
62NO_X11_FLAGS = "--without-x --without-gtk2 --without-gtk3" 60NO_X11_FLAGS = "--without-x --without-gtk2 --without-gtk3"