diff -Nru open-vm-tools-10.3.5/debian/changelog open-vm-tools-10.3.10/debian/changelog --- open-vm-tools-10.3.5/debian/changelog 2019-02-12 08:56:17.000000000 +0000 +++ open-vm-tools-10.3.10/debian/changelog 2019-05-14 07:05:46.000000000 +0000 @@ -1,11 +1,67 @@ -open-vm-tools (2:10.3.5-7~ubuntu0.18.10.1) cosmic; urgency=medium +open-vm-tools (2:10.3.10-1~ubuntu0.18.10.1) cosmic; urgency=medium - * Backport recent open-vm-tools (LP: #1813944) - - also adresses handling of quiesced snapshot failures (LP: #1814832) - - also adresses issues with resolutionKMS plugins sometimes fails to - load at boot (LP: #1818473) + * Backport recent open-vm-tools (LP: #1822204) - -- Christian Ehrhardt Tue, 12 Feb 2019 09:56:17 +0100 + -- Christian Ehrhardt Tue, 14 May 2019 09:05:46 +0200 + +open-vm-tools (2:10.3.10-1) unstable; urgency=high + + * [122e511] Update upstream source from tag 'upstream/10.3.10' + Update to upstream version '10.3.10' + with Debian dir fb12c7cfc99a9497795475c29306e78d08cc3712 + - Closes: #925940 + - Bugfix release for the 10.3 series. + - Correct and/or improve handling of certain quiesced + snapshot failures (shipped as patch in 2:10.3.5-6). + - Fix some bad derefs in primary NIC gather code + - Fix possible security issue with the permissions of the + intermediate staging directory and path. + Closes: #925959 + - CONSTANT_EXPRESSION_RESULT in TimeUtil_StringToDate() + Found by coverity. + - Deploypkg log files of linux should not be world readable. + They might contain sensitive data. + - General code clean-up: + - Treat local variables "len" consistently as "size_t" + type in Posix_Getmntent_r() + - Improve readability of error handling logic in + ShrinkDoWipeAndShrink() and remove another line of dead code. + - Setting "errno" to ENOENT when there is no passwd entry + for the user. + - Fix NULL pointer dereference and remove three lines of dead code. + - Other changes/fixes, not related to Debian: + - Update copyright years + - Fix CentOS 7.6 detection + - Include vmware/tools/log.h to define g_info (fix for SLES) + - Special-case profile loading for StartProgram + (Win32 only) + - Changes to common source files not applicable to + open-vm-tools. (Code used by other vmware tools, unrelated + to open-vm-tools). + - Bump up the SYSIMAGE_VERSION for VMware tools 10.3.10 + + * [18de70f] Removing backported patches, shipped in 10.3.10. + + -- Bernd Zeimetz Fri, 29 Mar 2019 11:58:17 +0100 + +open-vm-tools (2:10.3.5-8) unstable; urgency=medium + + [ Jean-Baptiste Lallement ] + * [0f35aee] Add modaliases to open-vm-tools-desktop. + Added Modaliases to open-vm-tools-desktop to auto-discover and + auto-install the driver on Ubuntu via ubuntu-drivers. The driver is then + installed at installation time and available on first boot for an + improved user experience (LP: #1819207) + + [ Bernd Zeimetz ] + * [dc4e1ce] Load vmwgfx module before vmtoolsd starts. + As discussed on github in vmware/open-vm-tools#214 + we need to load the vmwgfx module before starting vmtoolsd + for desktop users. Otherwise it is not able to retrieve the KMS + resolutions and resizing the VM desktop fails. + Thanks to @thomashvmw @rhertzog (Closes: #924518) + + -- Bernd Zeimetz Wed, 13 Mar 2019 22:15:22 +0100 open-vm-tools (2:10.3.5-7) unstable; urgency=medium diff -Nru open-vm-tools-10.3.5/debian/control open-vm-tools-10.3.10/debian/control --- open-vm-tools-10.3.5/debian/control 2019-02-12 08:56:17.000000000 +0000 +++ open-vm-tools-10.3.10/debian/control 2019-05-14 07:05:27.000000000 +0000 @@ -1,8 +1,7 @@ Source: open-vm-tools Section: admin Priority: extra -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Bernd Zeimetz +Maintainer: Bernd Zeimetz Build-Depends: debhelper (>= 11~), autotools-dev, doxygen, libcunit1-dev, libdumbnet-dev, libfuse-dev, libgtkmm-3.0-dev, libgtk-3-dev, @@ -44,6 +43,7 @@ xauth, xserver-xorg-input-vmmouse, xserver-xorg-video-vmware Suggests: xdg-utils +XB-Modaliases: ${modaliases} Description: Open VMware Tools for virtual machines hosted on VMware (GUI) The Open Virtual Machine Tools (open-vm-tools) project is an open source implementation of VMware Tools. It is a suite of virtualization utilities and diff -Nru open-vm-tools-10.3.5/debian/local/open-vm-tools-desktop.conf open-vm-tools-10.3.10/debian/local/open-vm-tools-desktop.conf --- open-vm-tools-10.3.5/debian/local/open-vm-tools-desktop.conf 2018-12-14 06:16:05.000000000 +0000 +++ open-vm-tools-10.3.10/debian/local/open-vm-tools-desktop.conf 2019-05-14 07:05:27.000000000 +0000 @@ -1 +1,2 @@ fuse +vmwgfx diff -Nru open-vm-tools-10.3.5/debian/open-vm-tools.service open-vm-tools-10.3.10/debian/open-vm-tools.service --- open-vm-tools-10.3.5/debian/open-vm-tools.service 2019-02-12 08:54:25.000000000 +0000 +++ open-vm-tools-10.3.10/debian/open-vm-tools.service 2019-05-14 07:05:27.000000000 +0000 @@ -7,7 +7,7 @@ After=vgauth.service After=apparmor.service RequiresMountsFor=/tmp -After=systemd-remount-fs.service systemd-tmpfiles-setup.service +After=systemd-remount-fs.service systemd-tmpfiles-setup.service systemd-modules-load.service [Service] ExecStart=/usr/bin/vmtoolsd diff -Nru open-vm-tools-10.3.5/debian/patches/series open-vm-tools-10.3.10/debian/patches/series --- open-vm-tools-10.3.5/debian/patches/series 2019-02-12 08:54:25.000000000 +0000 +++ open-vm-tools-10.3.10/debian/patches/series 2019-05-14 07:05:27.000000000 +0000 @@ -1,4 +1,3 @@ debian/pam-use-common-auth-account debian/max_nic_count debian/scsi-udev-rule -stable-10.3.5-quiesced-snapshot diff -Nru open-vm-tools-10.3.5/debian/patches/stable-10.3.5-quiesced-snapshot open-vm-tools-10.3.10/debian/patches/stable-10.3.5-quiesced-snapshot --- open-vm-tools-10.3.5/debian/patches/stable-10.3.5-quiesced-snapshot 2019-02-12 08:54:25.000000000 +0000 +++ open-vm-tools-10.3.10/debian/patches/stable-10.3.5-quiesced-snapshot 1970-01-01 00:00:00.000000000 +0000 @@ -1,631 +0,0 @@ ---- a/open-vm-tools/services/plugins/vmbackup/stateMachine.c -+++ b/open-vm-tools/services/plugins/vmbackup/stateMachine.c -@@ -201,17 +201,19 @@ VmBackupPrivSendMsg(gchar *msg, - * Sends a command to the VMX asking it to update VMDB about a new backup event. - * This will restart the keep-alive timer. - * -+ * As the name implies, does not abort the quiesce operation on failure. -+ * - * @param[in] event The event to set. - * @param[in] code Error code. -- * @param[in] dest Error description. -+ * @param[in] desc Error description. - * - * @return TRUE on success. - */ - - Bool --VmBackup_SendEvent(const char *event, -- const uint32 code, -- const char *desc) -+VmBackup_SendEventNoAbort(const char *event, -+ const uint32 code, -+ const char *desc) - { - Bool success; - char *result = NULL; -@@ -224,6 +226,7 @@ VmBackup_SendEvent(const char *event, - if (gBackupState->keepAlive != NULL) { - g_source_destroy(gBackupState->keepAlive); - g_source_unref(gBackupState->keepAlive); -+ gBackupState->keepAlive = NULL; - } - - msg = g_strdup_printf(VMBACKUP_PROTOCOL_EVENT_SET" %s %u %s", -@@ -267,19 +270,52 @@ VmBackup_SendEvent(const char *event, - &result, &resultLen); - #endif - -- if (!success) { -+ if (success) { -+ ASSERT(gBackupState->keepAlive == NULL); -+ gBackupState->keepAlive = -+ g_timeout_source_new(VMBACKUP_KEEP_ALIVE_PERIOD / 2); -+ VMTOOLSAPP_ATTACH_SOURCE(gBackupState->ctx, -+ gBackupState->keepAlive, -+ VmBackupKeepAliveCallback, -+ NULL, -+ NULL); -+ } else { - g_warning("Failed to send vmbackup event: %s, result: %s.\n", - msg, result); - } - vm_free(result); - g_free(msg); - -- gBackupState->keepAlive = g_timeout_source_new(VMBACKUP_KEEP_ALIVE_PERIOD / 2); -- VMTOOLSAPP_ATTACH_SOURCE(gBackupState->ctx, -- gBackupState->keepAlive, -- VmBackupKeepAliveCallback, -- NULL, -- NULL); -+ return success; -+} -+ -+ -+/** -+ * Sends a command to the VMX asking it to update VMDB about a new backup event. -+ * This will restart the keep-alive timer. -+ * -+ * Aborts the quiesce operation on RPC failure. -+ * -+ * @param[in] event The event to set. -+ * @param[in] code Error code. -+ * @param[in] desc Error description. -+ * -+ * @return TRUE on success. -+ */ -+ -+Bool -+VmBackup_SendEvent(const char *event, -+ const uint32 code, -+ const char *desc) -+{ -+ Bool success = VmBackup_SendEventNoAbort(event, code, desc); -+ -+ if (!success && gBackupState->rpcState != VMBACKUP_RPC_STATE_IGNORE) { -+ g_debug("Changing rpcState from %d to %d\n", -+ gBackupState->rpcState, VMBACKUP_RPC_STATE_ERROR); -+ gBackupState->rpcState = VMBACKUP_RPC_STATE_ERROR; -+ } -+ - return success; - } - -@@ -440,6 +476,12 @@ VmBackupDoAbort(void) - { - g_debug("*** %s\n", __FUNCTION__); - ASSERT(gBackupState != NULL); -+ -+ /* -+ * Once we abort the operation, we don't care about RPC state. -+ */ -+ gBackupState->rpcState = VMBACKUP_RPC_STATE_IGNORE; -+ - if (gBackupState->machineState != VMBACKUP_MSTATE_SCRIPT_ERROR && - gBackupState->machineState != VMBACKUP_MSTATE_SYNC_ERROR) { - const char *eventMsg = "Quiesce aborted."; -@@ -453,12 +495,13 @@ VmBackupDoAbort(void) - g_static_mutex_unlock(&gBackupState->opLock); - - #ifdef __linux__ -- /* Thaw the guest if already quiesced */ -+ /* If quiescing has been completed, then undo it. */ - if (gBackupState->machineState == VMBACKUP_MSTATE_SYNC_FREEZE) { -- g_debug("Guest already quiesced, thawing for abort\n"); -- if (!gBackupState->provider->snapshotDone(gBackupState, -+ g_debug("Aborting with file system already quiesced, undo quiescing " -+ "operation.\n"); -+ if (!gBackupState->provider->undo(gBackupState, - gBackupState->provider->clientData)) { -- g_debug("Thaw during abort failed\n"); -+ g_debug("Quiescing undo failed.\n"); - eventMsg = "Quiesce could not be aborted."; - } - } -@@ -622,6 +665,17 @@ VmBackupAsyncCallback(void *clientData) - if (opPending) { - goto exit; - } -+ -+ /* -+ * VMX state might have changed when we were processing -+ * currentOp. This is usually detected by failures in -+ * sending backup event to the host. -+ */ -+ if (gBackupState->rpcState == VMBACKUP_RPC_STATE_ERROR) { -+ g_warning("Aborting backup operation due to RPC errors."); -+ VmBackupDoAbort(); -+ goto exit; -+ } - } - - switch (gBackupState->machineState) { -@@ -957,6 +1011,7 @@ VmBackupStartCommon(RpcInData *data, - gBackupState->enableNullDriver = VMBACKUP_CONFIG_GET_BOOL(ctx->config, - "enableNullDriver", - TRUE); -+ gBackupState->rpcState = VMBACKUP_RPC_STATE_NORMAL; - - g_debug("Using quiesceApps = %d, quiesceFS = %d, allowHWProvider = %d," - " execScripts = %d, scriptArg = %s, timeout = %u," -@@ -1333,7 +1388,7 @@ VmBackupDumpState(gpointer src, - - - /** -- * Reset callback. -+ * Reset callback. Currently does nothing. - * - * @param[in] src The source object. Unused. - * @param[in] ctx Unused. -@@ -1345,7 +1400,7 @@ VmBackupReset(gpointer src, - ToolsAppCtx *ctx, - gpointer data) - { -- VmBackup_SyncDriverReset(); -+ - } - - ---- a/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c -+++ b/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c -@@ -35,16 +35,53 @@ - #include - #endif - -+/* -+ * Define an enumeration type VmBackupOpType and a corresponding array -+ * VmBackupOpName whose entries provide the printable names of the -+ * enumeration ids in VmBackupOpType. -+ * -+ * VmBackupOpType and VmBackupOpName are each defined as an invocation -+ * of a macro VMBACKUP_OPLIST. VMBACKUP_OPLIST specifies a list of -+ * enumeration ids using a macro VMBACKUP_OP that must be defined before -+ * invoking VMBACKUP_OPLIST. VMBACKUP_OP takes a single argument, which -+ * should be an enumeration id, and is defined to generate from the id -+ * either the id itself or a string to be used as its printable name. The -+ * result is that an invocation of VMBACKUP_OPLIST generates either the -+ * list of enumeration ids or the list of their printable names. -+ */ -+#define VMBACKUP_OPLIST \ -+ VMBACKUP_OP(OP_FREEZE), \ -+ VMBACKUP_OP(OP_THAW), \ -+ VMBACKUP_OP(OP_UNDO), -+ -+#define VMBACKUP_OPID(id) id -+#define VMBACKUP_OPNAME(id) #id -+ -+#undef VMBACKUP_OP -+#define VMBACKUP_OP(id) VMBACKUP_OPID(id) -+ -+typedef enum { -+ VMBACKUP_OPLIST -+} VmBackupOpType; -+ -+#undef VMBACKUP_OP -+#define VMBACKUP_OP(id) VMBACKUP_OPNAME(id) -+ -+static const char *VmBackupOpName[] = { -+ VMBACKUP_OPLIST -+}; -+ -+#undef VMBACKUP_OP -+ - typedef struct VmBackupDriverOp { - VmBackupOp callbacks; - const char *volumes; -- Bool freeze; -+ VmBackupOpType opType; - Bool canceled; - SyncDriverHandle *syncHandle; - SyncManifest *manifest; - } VmBackupDriverOp; - -- - /* - *----------------------------------------------------------------------------- - * -@@ -97,7 +134,7 @@ VmBackupDriverOpQuery(VmBackupOp *_op) / - VmBackupDriverOp *op = (VmBackupDriverOp *) _op; - VmBackupOpStatus ret; - -- if (op->freeze) { -+ if (op->opType == OP_FREEZE) { - SyncDriverStatus st = SyncDriver_QueryStatus(*op->syncHandle, 0); - - g_debug("SyncDriver status: %d\n", st); -@@ -208,7 +245,7 @@ VmBackupDriverOpCancel(VmBackupOp *_op) - - static VmBackupDriverOp * - VmBackupNewDriverOp(VmBackupState *state, // IN -- Bool freeze, // IN -+ VmBackupOpType opType, // IN - SyncDriverHandle *handle, // IN - const char *volumes, // IN - Bool useNullDriverPrefs) // IN -@@ -216,8 +253,9 @@ VmBackupNewDriverOp(VmBackupState *state - Bool success; - VmBackupDriverOp *op = NULL; - -- g_return_val_if_fail((handle == NULL || *handle == SYNCDRIVER_INVALID_HANDLE) || -- !freeze, -+ g_return_val_if_fail((handle == NULL || -+ *handle == SYNCDRIVER_INVALID_HANDLE) || -+ opType != OP_FREEZE, - NULL); - - op = Util_SafeMalloc(sizeof *op); -@@ -226,24 +264,32 @@ VmBackupNewDriverOp(VmBackupState *state - op->callbacks.queryFn = VmBackupDriverOpQuery; - op->callbacks.cancelFn = VmBackupDriverOpCancel; - op->callbacks.releaseFn = VmBackupDriverOpRelease; -- op->freeze = freeze; -+ op->opType = opType; - op->volumes = volumes; - - op->syncHandle = g_new0(SyncDriverHandle, 1); - *op->syncHandle = (handle != NULL) ? *handle : SYNCDRIVER_INVALID_HANDLE; - -- if (freeze) { -- success = SyncDriver_Freeze(op->volumes, -- useNullDriverPrefs ? -- state->enableNullDriver : FALSE, -- op->syncHandle, -- state->excludedFileSystems); -- } else { -- op->manifest = SyncNewManifest(state, *op->syncHandle); -- success = VmBackupDriverThaw(op->syncHandle); -+ switch (opType) { -+ case OP_FREEZE: -+ success = SyncDriver_Freeze(op->volumes, -+ useNullDriverPrefs ? -+ state->enableNullDriver : FALSE, -+ op->syncHandle, -+ state->excludedFileSystems); -+ break; -+ case OP_THAW: -+ op->manifest = SyncNewManifest(state, *op->syncHandle); -+ success = VmBackupDriverThaw(op->syncHandle); -+ break; -+ default: -+ ASSERT(opType == OP_UNDO); -+ success = VmBackupDriverThaw(op->syncHandle); -+ break; - } - if (!success) { -- g_warning("Error %s filesystems.", freeze ? "freezing" : "thawing"); -+ g_warning("Error trying to perform %s on filesystems.", -+ VmBackupOpName[opType]); - g_free(op->syncHandle); - SyncManifestRelease(op->manifest); - free(op); -@@ -329,7 +375,7 @@ VmBackupSyncDriverStart(VmBackupState *s - VmBackupDriverOp *op; - - g_debug("*** %s\n", __FUNCTION__); -- op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, TRUE); -+ op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, TRUE); - - if (op != NULL) { - state->clientData = op->syncHandle; -@@ -366,7 +412,7 @@ VmBackupSyncDriverOnlyStart(VmBackupStat - VmBackupDriverOp *op; - - g_debug("*** %s\n", __FUNCTION__); -- op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, FALSE); -+ op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, FALSE); - - if (op != NULL) { - state->clientData = op->syncHandle; -@@ -404,7 +450,7 @@ VmBackupSyncDriverStart(ToolsAppCtx *ctx - VmBackupState *state = (VmBackupState*) clientData; - - g_debug("*** %s\n", __FUNCTION__); -- op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, TRUE); -+ op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, TRUE); - - if (op != NULL) { - state->clientData = op->syncHandle; -@@ -442,7 +488,7 @@ VmBackupSyncDriverOnlyStart(ToolsAppCtx - VmBackupState *state = (VmBackupState*) clientData; - - g_debug("*** %s\n", __FUNCTION__); -- op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, FALSE); -+ op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, FALSE); - - if (op != NULL) { - state->clientData = op->syncHandle; -@@ -480,7 +526,7 @@ VmBackupSyncDriverSnapshotDone(VmBackupS - - g_debug("*** %s\n", __FUNCTION__); - -- op = VmBackupNewDriverOp(state, FALSE, state->clientData, NULL, TRUE); -+ op = VmBackupNewDriverOp(state, OP_THAW, state->clientData, NULL, TRUE); - g_free(state->clientData); - state->clientData = NULL; - -@@ -513,7 +559,40 @@ VmBackupSyncDriverOnlySnapshotDone(VmBac - - g_debug("*** %s\n", __FUNCTION__); - -- op = VmBackupNewDriverOp(state, FALSE, state->clientData, NULL, FALSE); -+ op = VmBackupNewDriverOp(state, OP_THAW, state->clientData, NULL, FALSE); -+ g_free(state->clientData); -+ state->clientData = NULL; -+ -+ return VmBackup_SetCurrentOp(state, (VmBackupOp *) op, NULL, __FUNCTION__); -+} -+ -+ -+#if defined(__linux__) -+/* -+ *----------------------------------------------------------------------------- -+ * -+ * VmBackupSyncDriverUndo -- -+ * -+ * Undo a completed quiescing operation. -+ * -+ * Result -+ * TRUE, unless an error occurs. -+ * -+ * Side effects: -+ * None. -+ * -+ *----------------------------------------------------------------------------- -+ */ -+ -+static Bool -+VmBackupSyncDriverUndo(VmBackupState *state, -+ void *clientData) -+{ -+ VmBackupDriverOp *op; -+ -+ g_debug("*** %s\n", __FUNCTION__); -+ -+ op = VmBackupNewDriverOp(state, OP_UNDO, state->clientData, NULL, TRUE); - g_free(state->clientData); - state->clientData = NULL; - -@@ -524,6 +603,39 @@ VmBackupSyncDriverOnlySnapshotDone(VmBac - /* - *----------------------------------------------------------------------------- - * -+ * VmBackupSyncDriverOnlyUndo -- -+ * -+ * Undo a completed quiescing operation. -+ * -+ * Result -+ * TRUE, unless an error occurs. -+ * -+ * Side effects: -+ * None. -+ * -+ *----------------------------------------------------------------------------- -+ */ -+ -+static Bool -+VmBackupSyncDriverOnlyUndo(VmBackupState *state, -+ void *clientData) -+{ -+ VmBackupDriverOp *op; -+ -+ g_debug("*** %s\n", __FUNCTION__); -+ -+ op = VmBackupNewDriverOp(state, OP_UNDO, state->clientData, NULL, FALSE); -+ g_free(state->clientData); -+ state->clientData = NULL; -+ -+ return VmBackup_SetCurrentOp(state, (VmBackupOp *) op, NULL, __FUNCTION__); -+} -+#endif -+ -+ -+/* -+ *----------------------------------------------------------------------------- -+ * - * VmBackupSyncDriverRelease -- - * - * Frees the given pointer. -@@ -579,10 +691,17 @@ VmBackup_NewSyncDriverProviderInternal(B - if (useNullDriverPrefs) { - provider->start = VmBackupSyncDriverStart; - provider->snapshotDone = VmBackupSyncDriverSnapshotDone; -+#if defined(__linux__) -+ provider->undo = VmBackupSyncDriverUndo; -+#endif - } else { - provider->start = VmBackupSyncDriverOnlyStart; - provider->snapshotDone = VmBackupSyncDriverOnlySnapshotDone; -+#if defined(__linux__) -+ provider->undo = VmBackupSyncDriverOnlyUndo; -+#endif - } -+ - provider->release = VmBackupSyncDriverRelease; - provider->clientData = NULL; - -@@ -642,26 +761,3 @@ VmBackup_NewSyncDriverOnlyProvider(void) - } - - #endif -- -- --/* -- *----------------------------------------------------------------------------- -- * -- * VmBackup_SyncDriverReset -- -- * -- * Reset function -- * -- * Results: -- * None. -- * -- * Side effects: -- * Whatever are the side effects of what it calls. -- * -- *----------------------------------------------------------------------------- -- */ -- --void --VmBackup_SyncDriverReset(void) --{ -- SyncManifestReset(); --} ---- a/open-vm-tools/services/plugins/vmbackup/syncManifest.c -+++ b/open-vm-tools/services/plugins/vmbackup/syncManifest.c -@@ -1,5 +1,5 @@ - /********************************************************* -- * Copyright (C) 2017-2018 VMware, Inc. All rights reserved. -+ * Copyright (C) 2017-2019 VMware, Inc. All rights reserved. - * - * 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 -@@ -27,6 +27,7 @@ - #include "syncDriver.h" - #include "syncManifest.h" - #include "vm_tools_version.h" -+#include "vmware/tools/log.h" - - #include - #include -@@ -49,12 +50,6 @@ static const char syncManifestFmt[] = { - */ - static const char syncManifestSwitch[] = "enableXmlManifest"; - --/* -- * If TRUE, indicates that VMTools should try to generate the backup -- * manifest and send it to VMX; if FALSE, it won't try to do so. -- */ --static Bool gSyncManifestTrySend = TRUE; -- - - /* - *----------------------------------------------------------------------------- -@@ -95,12 +90,6 @@ SyncNewManifest(VmBackupState *state, - return NULL; - } - -- if (!gSyncManifestTrySend) { -- g_debug("No backup manifest generated since previous" -- " attempt to send one to host failed.\n"); -- return NULL; -- } -- - manifest = g_new0(SyncManifest, 1); - manifest->path = g_strdup_printf("%s/%s", state->configDir, - syncManifestName); -@@ -173,37 +162,14 @@ SyncManifestSend(SyncManifest *manifest) - return FALSE; - } - -- if (!VmBackup_SendEvent(VMBACKUP_EVENT_GENERIC_MANIFEST, -- VMBACKUP_SUCCESS, manifest->path)) { -- g_warning("Host doesn't appear to support backup manifests " -- "for Linux guests.\n"); -- gSyncManifestTrySend = FALSE; -+ if (!VmBackup_SendEventNoAbort(VMBACKUP_EVENT_GENERIC_MANIFEST, -+ VMBACKUP_SUCCESS, manifest->path)) { -+ /* VmBackup_SendEventNoAbort logs the error */ -+ g_info("Non-fatal error occurred while sending %s, continuing " -+ "with the operation", VMBACKUP_EVENT_GENERIC_MANIFEST); - return FALSE; - } - - g_debug("Backup manifest was sent successfully.\n"); - return TRUE; - } -- -- --/* -- *----------------------------------------------------------------------------- -- * -- * SyncManifestReset -- -- * -- * Reset SyncManifest global state -- * -- * Results: -- * None -- * -- * Side effects: -- * None -- * -- *----------------------------------------------------------------------------- -- */ -- --void --SyncManifestReset(void) --{ -- gSyncManifestTrySend = TRUE; --} ---- a/open-vm-tools/services/plugins/vmbackup/syncManifest.h -+++ b/open-vm-tools/services/plugins/vmbackup/syncManifest.h -@@ -1,5 +1,5 @@ - /********************************************************* -- * Copyright (C) 2017-2018 VMware, Inc. All rights reserved. -+ * Copyright (C) 2017-2019 VMware, Inc. All rights reserved. - * - * 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 -@@ -45,9 +45,6 @@ SyncManifestSend(SyncManifest *manifest) - void - SyncManifestRelease(SyncManifest *manifest); - --void --SyncManifestReset(void); -- - #else /* !defined(__linux__) */ - - typedef void SyncManifest; -@@ -55,7 +52,6 @@ typedef void SyncManifest; - #define SyncNewManifest(s, h) (NULL) - #define SyncManifestSend(m) (TRUE) - #define SyncManifestRelease(m) ASSERT(m == NULL) --#define SyncManifestReset() - - #endif /* defined(__linux__) */ - ---- a/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h -+++ b/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h -@@ -72,6 +72,12 @@ typedef enum { - VMBACKUP_MSTATE_SYNC_ERROR - } VmBackupMState; - -+typedef enum { -+ VMBACKUP_RPC_STATE_NORMAL, -+ VMBACKUP_RPC_STATE_ERROR, -+ VMBACKUP_RPC_STATE_IGNORE -+} VmBackupRpcState; -+ - /** - * This is a "base struct" for asynchronous operations monitored by the - * state machine. Each implementation should provide these three functions -@@ -138,6 +144,7 @@ typedef struct VmBackupState { - Bool vssBootableSystemState; - Bool vssPartialFileSupport; - Bool vssUseDefault; -+ VmBackupRpcState rpcState; - } VmBackupState; - - typedef Bool (*VmBackupCallback)(VmBackupState *); -@@ -156,6 +163,7 @@ typedef struct VmBackupSyncProvider { - VmBackupProviderCallback start; - #else - ToolsCorePoolCb start; -+ VmBackupProviderCallback undo; - #endif - VmBackupProviderCallback snapshotDone; - void (*release)(struct VmBackupSyncProvider *); -@@ -295,8 +303,11 @@ VmBackup_SendEvent(const char *event, - const uint32 code, - const char *desc); - --void --VmBackup_SyncDriverReset(void); -+ -+Bool -+VmBackup_SendEventNoAbort(const char *event, -+ const uint32 code, -+ const char *desc); - - #endif /* _VMBACKUPINT_H_*/ - diff -Nru open-vm-tools-10.3.5/debian/rules open-vm-tools-10.3.10/debian/rules --- open-vm-tools-10.3.5/debian/rules 2019-01-30 14:05:42.000000000 +0000 +++ open-vm-tools-10.3.10/debian/rules 2019-05-14 07:05:27.000000000 +0000 @@ -3,6 +3,12 @@ DEBHELPER_VERSION = $(strip $(shell dpkg-query -f '$${Version}' -W debhelper)) DEBHELPER_SYSTEMD_OK = $(strip $(shell dpkg --compare-versions $(DEBHELPER_VERSION) ge 10.9.1~; echo $$?)) +ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) + VENDOR := UBUNTU +else + VENDOR := DEBIAN +endif + %: dh ${@} --sourcedirectory=open-vm-tools @@ -71,6 +77,13 @@ mkdir -p debian/open-vm-tools-desktop/lib/systemd/system/open-vm-tools.service.d cp debian/desktop.conf debian/open-vm-tools-desktop/lib/systemd/system/open-vm-tools.service.d/ +override_dh_gencontrol: + if [ "${VENDOR}" = "UBUNTU" ]; \ + then \ + dh_gencontrol -- -Vmodaliases="vmwgfx(pci:v000015ADd00000405sv*sd*bc*sc*i*)"; \ + else \ + dh_gencontrol; \ + fi override_dh_builddeb: dh_builddeb -- -Zxz diff -Nru open-vm-tools-10.3.5/open-vm-tools/AUTHORS open-vm-tools-10.3.10/open-vm-tools/AUTHORS --- open-vm-tools-10.3.5/open-vm-tools/AUTHORS 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/AUTHORS 2019-03-16 17:55:01.000000000 +0000 @@ -36,3 +36,7 @@ Steve Wills Fix vmmemctl.ko driver build for supported FreeBSD releases. - https://github.com/vmware/open-vm-tools/pull/140 + +[Code]Ai Highlighted a potential NULL pointer dereference and four + pieces of dead code. + - https://github.com/vmware/open-vm-tools/pull/247 diff -Nru open-vm-tools-10.3.5/open-vm-tools/ChangeLog open-vm-tools-10.3.10/open-vm-tools/ChangeLog --- open-vm-tools-10.3.5/open-vm-tools/ChangeLog 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/ChangeLog 2019-03-16 17:55:01.000000000 +0000 @@ -1,3 +1,307 @@ +commit 4826a76513b6f8254132f664e07fa70ed18f22c4 +Author: Oliver Kurth +Date: Sat Mar 16 10:40:23 2019 -0700 + + update version and build number + +commit 990cc40de10f257d1d3c01b69fe476c233afb950 +Author: Oliver Kurth +Date: Sat Mar 16 10:39:48 2019 -0700 + + correct verson numbers + +commit f6a274cf64eebfd574e8cf587b4ebaf1c579267f +Author: Oliver Kurth +Date: Sat Mar 16 10:27:03 2019 -0700 + + Update release notes for 10.3.10 + +commit 640bd4f9c012b201ad1d45a131dad2e804f53766 +Author: Oliver Kurth +Date: Wed Feb 6 16:47:22 2019 -0800 + + sync deploypkg files + +commit 182eda3bc5f371339114241f0581f446e72def6d +Author: Oliver Kurth +Date: Tue Feb 5 17:36:53 2019 -0800 + + Update copyright year to 2019 for OVT 10.3.10 files. + + * Few dnd related files have been modified since 10.3.5 OVT and + we just missed updating the copyright year to 2019. + + * Updated the copyright year accordingly. + +commit ba83c29fcd703ecb6a13a7767bad180033234aea +Author: Oliver Kurth +Date: Tue Jan 29 17:24:44 2019 -0800 + + Fix CentOS 7.6 detection + + The version information in /etc/centos-release has 3 parts, + in particular for CentOS 7.6: + + CentOS Linux release 7.6.1810 (Core) + + This was misidentified as CentOS 6 because the substring "6." + was matched before matching "7.". This change fixes this by + requiring a space before the major version. + +commit f4708f4b5a9d24b122237875ce6a542f267caab3 +Author: Oliver Kurth +Date: Tue Jan 29 17:24:44 2019 -0800 + + Include vmware/tools/log.h to define g_info. + + A recent change added a call to g_info from syncManifest.c. This + in turn is causing open-vm-tools builds to fail because g_info is + not available on SLES 12sp1. + + To fix the problem, include vmware/tools/log.h in syncManifest.c. + log.h defines g_info as a macro. + +commit 139a21cab79d971e9fe3ea5b8e993646b2e6cb48 +Author: Oliver Kurth +Date: Tue Jan 29 17:24:44 2019 -0800 + + Always send VMBACKUP_EVENT_GENERIC_MANIFEST during quiesced snapshots. + + vSphere 6.7 added a host-side interface that allows VMTools to send + a "generic" backup manifest during a quiesced snapshot on Linux guests. + VMTools 10.2.0 or later tries to notify the host of the backup manifest + file through a vmbackup event message VMBACKUP_EVENT_GENERIC_MANIFEST. + If the host is unable to field the message, then VMTools logs the + failure and then continues with the quiesced snapshot in the older + fashion, without the backup manifest. + + An earlier change attempted to reduce the amount of logging done when + running on older hosts that don't support VMBACKUP_EVENT_GENERIC_MANIFEST + by detecting when sending VMBACKUP_EVENT_GENERIC_MANIFEST fails and + not sending the message again for subsequent quiesced snapshots. + However, subsequent stress testing has uncovered problems with this + approach when running on newer hosts; specifically, errors may sometimes + be encountered on newer hosts when sending VMBACKUP_EVENT_GENERIC_MANIFEST. + Therefore this change backs out that earlier change. + + Note that the need to solve the problem that that earlier change was + intended to solve has been reduced because support for + VMBACKUP_EVENT_GENERIC_MANIFEST has been backported to vSphere 6.5 + P03, which is available, and vSphere 6.0 P08, which is scheduled for + release later this year. ESXi 5.5 is out of general support. + + This change also addresses an issue that surfaced when testing on a + host without support for VMBACKUP_EVENT_GENERIC_MANIFEST. + If VMTools fails to send VMBACKUP_EVENT_GENERIC_MANIFEST, the quiesced + snapshot operation will be aborted rather than continuing as it should. + To address this, create a new function, VmBackup_SendEventNoAbort, + which does not abort the quiesced snapshot on failure, and call that + function rather than VmBackup_SendEvent when sending + VMBACKUP_EVENT_GENERIC_MANIFEST. + +commit f9a93010ac532ab8eaaeba7f1de5c0c3e732554a +Author: Oliver Kurth +Date: Tue Jan 29 17:24:43 2019 -0800 + + Update copyright year to 2019. + +commit 74d165bab17132b50d909b7f2e5cb19f3f140a01 +Author: Oliver Kurth +Date: Tue Jan 29 14:03:19 2019 -0800 + + Fix some bad derefs in primary NIC gather code + + Found by user in https://github.com/vmware/open-vm-tools/issues/272 + + Debug code tries to access a struct field that may not be init'd. + Pointer deref'd without a sanity check. + +commit e88f91b00a715b79255de6576506d80ecfdb064c +Author: Oliver Kurth +Date: Tue Jan 29 14:03:19 2019 -0800 + + Fix possible security issue with the permissions of the intermediate + staging directory and path + + /tmp/VMwareDnD is a staging directory used for DnD and CnP. It should be + a regular directory, but malicious code or user may create the /tmp/VMwareDnD + as a symbolic link which points elsewhere on the system. This may provide + user access to user B's files. + + Do not set the permission of the root directory if the root directory + already exists and has the wrong permission. The permission of the directory + must be 1777 if it is created by the VMToolsi. If not, then the directory + has been created or modified by malicious code or user, so just cancel the + host to guest DnD or CnP operation. + +commit bfa5e5d27a8a96a9c71fbe581f3fe32dcd2e55fd +Author: Oliver Kurth +Date: Tue Jan 29 14:03:19 2019 -0800 + + CONSTANT_EXPRESSION_RESULT in TimeUtil_StringToDate(). + + Red Hat ran coverity scan on open-vm-tools and found an occurrence + of CONSTANT_EXPRESSION_RESULT in TimeUtil_StringToDate(). + +commit 4bba1dcd28806eff0cb3795cbfeea32f91fb1c40 +Author: Oliver Kurth +Date: Tue Jan 29 14:03:19 2019 -0800 + + Bail out vmtoolsd early when there are RPC errors. + + VMX state machine could give up quiescing operation for various + reasons when vmtoolsd is busy performing necessary state transitions. + Once VMX gives up quiescing operation, there is no point in + vmtoolsd continuing with it. vmtoolsd should also give up the + operation asap. vmtoolsd can detect VMX state machine change + when it gets errors sending VMBACKUP_PROTOCOL_EVENT_SET RPC. + + RPC errors are only used as a trigger to abort the operation. + We ignore the RPC errors that might occur after aborting the + operation. + +commit 0cb7f7a903015e5e711fa6eb5b41748f797ce794 +Author: Oliver Kurth +Date: Tue Jan 29 14:03:19 2019 -0800 + + [10.3.10] Update copyright year to 2019. + + Update the copyright year to 2019 for ALL open-vm-tools destined files + modified since the release of 10.3.5. + +commit e569c47f85fa8520f0834148d6774c1cb66df68c +Author: Oliver Kurth +Date: Tue Jan 29 14:03:19 2019 -0800 + + Don't send a backup manifest when aborting a Linux quiesced snapshot. + + When taking a Linux quiesced snapshot, communication failures between + VMX and VMTools may result in VMTools sending a genericManifest event + message after the quiesced snapshot operation has been aborted. If + this happens, VMX will send an error back to VMTools, which in turn + causes VMTools not to send genericManifest messages on subsequent + quiesced snapshots even if the host supports such messages. + + One aspect of the implementation that gives rise to this behavior is + the use of the sync provider's snapshotDone function to undo a + quiescing operation. Specifically, if VMTools aborts a quiesced + snapshot when the file system is quiesced, the quiescing must be + undone. Currently, this is handled by calling the sync provider's + snapshotDone function. This is the same function that is called to + complete the quiescing snapshot protocol when it is successful. In + some respects this makes sense, since in either case snapshotDone + unquiesces the file system. However, architecturally and conceptually, + it seems useful to distinguish between the action to be taken in the + successful case versus the aborting case. It's also useful to do so + in practice, because the successful case sends the genericManifest + event to notify the host there is a backup manifest file, while the + aborting case should not do that. + + To address the issue, add an "undo" function for the Linux sync + provider. The undo function is called instead of snapshotDone as + part of aborting a quiesced snapshot in which the file system is + quiesced at the time of the abort. + +commit 81835cd72369b5b75fc5b0bed761f3b75cb7146b +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + Special-case profile loading for StartProgram + + Keep the user's profile loaded for the life of the + program, to avoid races where its unloaded too quickly. + +commit d3515adb2a1617dcde4b65a6a9ab72ee8624454b +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + Changes to common source files not applicable to open-vm-tools. + +commit 4d3e3183bc04517cf75ab590a12e14224207eb6d +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + Bump up the SYSIMAGE_VERSION for VMware tools 10.3.10 + + The last released deploypkg version for 'VMware Tools' 10.3.5 is 8.4.1. + Bumping up the CBS version to 8.4.10. + +commit 8f3630e77bcf647c22c40093bb37500f3032e578 +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + Deploypkg log files of linux should not be world readable. + +commit 4470d99e5eaf19cea741e6fa6f46c72acd57b3e1 +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + General code clean-up. + + bora/lib/misc/posixPosix.c: + Treat local variables "len" consistently as "size_t" type in + Posix_Getmntent_r() + + bora-vmsoft/apps/toolbox-cmd/toolboxcmd-shrink.c: + Improve readability of error handling logic in ShrinkDoWipeAndShrink() + and remove another line of dead code. + + bora-vmsoft/lib/procMgr/procMgrPosix.c: + Recent discussions about setting "errno" to ENOENT when either + getpwuid_r() or getpwnam_r() return 0 (success) if there is no passwd + entry for the user have vacillated. + + Since none of the current callers of the routines in procMgrPosix.c + query the contents of "errno", the current consensus is to simply log + a warning message along with reason for the failure. + +commit 5f3f6ccd3ad143d64f2927bd19791a6148e1e2ba +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + Fix NULL pointer dereference and remove three lines of dead code. + + QbitLogic has run [Code]Ai on the open-vm-tools source code and + and notified VMware of a potential NULL pointer reference and four + pieces of dead code. + + See https://github.com/vmware/open-vm-tools/pull/247 + + bora-vmsoft/services/vmtoolsd/pluginMgr.c + The proposed fix conditionally emitted a log message. That fix has + been reworked to consistently emit a log message with conditional + content. + + bora/lib/misc/posixPosix.c + bora-vmsoft/apps/toolbox-cmd/toolboxcmd-shrink.c + Remove one line of dead code from each source file. + + bora-vmsoft/lib/procMgr/procMgrPosix.c: + Suggested dead code fix actually pointed to a bug where errno + was not getting updated as intended. + + bora-vmsoft/services/plugins/guestInfo/perfMonLinux.c: + Suggested dead code is no longer dead; change not applicable. + +commit f10780bc3d7119d90bf72c0cf2f07066955d7d98 +Author: Oliver Kurth +Date: Tue Jan 29 14:03:18 2019 -0800 + + Bump VMware Tools version to 10.3.10 for the next scheduled update release + + Set the VMware Tools version as TOOLS_VERSION_JACKHAMMER_UPDATE2 = 10.3.10 + +commit f2ff192717375b95a6b7e278fb47dbb3d3bc56d1 +Author: Oliver Kurth +Date: Wed Nov 7 15:00:09 2018 -0800 + + release notes for 10.3.5 + +commit 8f98dbc87304546cbb75756bbad8ba0dbc0221a4 +Author: Oliver Kurth +Date: Wed Nov 7 14:13:03 2018 -0800 + + add 10.3.5 changes to ChangeLog commit 583fc02dbee4ba88a20c67a0f5e5a9b023b551ea Author: Oliver Kurth Date: Tue Nov 6 17:14:40 2018 -0800 diff -Nru open-vm-tools-10.3.5/open-vm-tools/configure.ac open-vm-tools-10.3.10/open-vm-tools/configure.ac --- open-vm-tools-10.3.5/open-vm-tools/configure.ac 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/configure.ac 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ ################################################################################ -### Copyright (C) 2007-2018 VMware, Inc. All rights reserved. +### Copyright (C) 2007-2019 VMware, Inc. All rights reserved. ### ### Configure script for building the VMware OSS Tools. ### @@ -35,10 +35,10 @@ ### Initialization ### -TOOLS_VERSION="10.3.5" +TOOLS_VERSION="10.3.10" AC_INIT( [open-vm-tools], - [10.3.5], + [10.3.10], [open-vm-tools-devel@lists.sourceforge.net]) # In order to make this configure script auto-detect situations where diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/include/buildNumber.h open-vm-tools-10.3.10/open-vm-tools/lib/include/buildNumber.h --- open-vm-tools-10.3.5/open-vm-tools/lib/include/buildNumber.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/include/buildNumber.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,12 +1,12 @@ #define BUILD_NUMBER \ - "build-10430147" + "build-12406962" #define BUILD_NUMBER_NUMERIC \ - 10430147 + 12406962 #define BUILD_NUMBER_NUMERIC_STRING \ - "10430147" + "12406962" #define PRODUCT_BUILD_NUMBER \ - "product-build-7752" + "product-build-10540" #define PRODUCT_BUILD_NUMBER_NUMERIC \ - 7752 + 10540 #define PRODUCT_BUILD_NUMBER_NUMERIC_STRING \ - "7752" + "10540" diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/include/vm_legal.h open-vm-tools-10.3.10/open-vm-tools/lib/include/vm_legal.h --- open-vm-tools-10.3.5/open-vm-tools/lib/include/vm_legal.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/include/vm_legal.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2019 VMware, Inc. All rights reserved. * * 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 @@ -37,7 +37,7 @@ * Updating them therefore may require updating translations and vmsg * auditing files in bora/messages/ to avoid breaking the build. */ -#define COPYRIGHT_YEARS "1998-2018" /* See the note above when changing. */ +#define COPYRIGHT_YEARS "1998-2019" /* See the note above when changing. */ #define COPYRIGHT_STRING "Copyright (C) " COPYRIGHT_YEARS " " COMPANY_NAME #define RIGHT_RESERVED "All rights reserved." diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/include/vm_product_versions.h open-vm-tools-10.3.10/open-vm-tools/lib/include/vm_product_versions.h --- open-vm-tools-10.3.5/open-vm-tools/lib/include/vm_product_versions.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/include/vm_product_versions.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * 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 @@ -57,7 +57,7 @@ #define PRODUCT_VERSION 14,0,0,PRODUCT_BUILD_NUMBER_NUMERIC #elif defined(VMX86_SYSIMAGE) // SYSIMAGE_VERSION below has to match this - #define PRODUCT_VERSION 8,4,1,PRODUCT_BUILD_NUMBER_NUMERIC + #define PRODUCT_VERSION 8,4,10,PRODUCT_BUILD_NUMBER_NUMERIC #else /* Generic catch-all. */ #define PRODUCT_VERSION 0,0,0,PRODUCT_BUILD_NUMBER_NUMERIC @@ -177,7 +177,7 @@ #define FUSION_VERSION "e.x.p" // These must match PRODUCT_VERSION for VMX86_SYSIMAGE above -#define SYSIMAGE_VERSION "8.4.1" +#define SYSIMAGE_VERSION "8.4.10" #define SYSIMAGE_VERSION_EXT_STR \ SYSIMAGE_VERSION "." PRODUCT_BUILD_NUMBER_NUMERIC_STRING diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/include/vm_tools_version.h open-vm-tools-10.3.10/open-vm-tools/lib/include/vm_tools_version.h --- open-vm-tools-10.3.5/open-vm-tools/lib/include/vm_tools_version.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/include/vm_tools_version.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * 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 @@ -1488,9 +1488,16 @@ #define TOOLS_VERSION_JACKHAMMER_UPDATE1_V_MNR 3 #define TOOLS_VERSION_JACKHAMMER_UPDATE1_V_BASE 5 -#define TOOLS_VERSION_CURRENT TOOLS_VERSION_JACKHAMMER_UPDATE1 -#define TOOLS_VERSION_CURRENT_STR TOOLS_VERSION_TO_STR(TOOLS_VERSION_JACKHAMMER_UPDATE1) -#define TOOLS_VERSION_CURRENT_CSV TOOLS_VERSION_TO_CSV(TOOLS_VERSION_JACKHAMMER_UPDATE1) +#ifndef RC_INVOKED +#define TOOLS_VERSION_JACKHAMMER_UPDATE2 TOOLS_VERSION_TO_UINT(TOOLS_VERSION_JACKHAMMER_UPDATE2_V) +#endif /* RC_INVOKED */ +#define TOOLS_VERSION_JACKHAMMER_UPDATE2_V_MJR 10 +#define TOOLS_VERSION_JACKHAMMER_UPDATE2_V_MNR 3 +#define TOOLS_VERSION_JACKHAMMER_UPDATE2_V_BASE 10 + +#define TOOLS_VERSION_CURRENT TOOLS_VERSION_JACKHAMMER_UPDATE2 +#define TOOLS_VERSION_CURRENT_STR TOOLS_VERSION_TO_STR(TOOLS_VERSION_JACKHAMMER_UPDATE2) +#define TOOLS_VERSION_CURRENT_CSV TOOLS_VERSION_TO_CSV(TOOLS_VERSION_JACKHAMMER_UPDATE2) /* * The extended Tools version is the current Tools version with the diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/misc/hostinfoPosix.c open-vm-tools-10.3.10/open-vm-tools/lib/misc/hostinfoPosix.c --- open-vm-tools-10.3.5/open-vm-tools/lib/misc/hostinfoPosix.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/misc/hostinfoPosix.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * 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 @@ -790,11 +790,11 @@ } else if (strstr(distroLower, "cobalt")) { Str_Strcpy(distroShort, STR_OS_COBALT, distroShortSize); } else if (StrUtil_StartsWith(distroLower, "centos")) { - if (strstr(distroLower, "6.")) { + if (strstr(distroLower, " 6.")) { Str_Strcpy(distroShort, STR_OS_CENTOS6, distroShortSize); - } else if (strstr(distroLower, "7.")) { + } else if (strstr(distroLower, " 7.")) { Str_Strcpy(distroShort, STR_OS_CENTOS7, distroShortSize); - } else if (strstr(distroLower, "8.")) { + } else if (strstr(distroLower, " 8.")) { Str_Strcpy(distroShort, STR_OS_CENTOS8, distroShortSize); } else { Str_Strcpy(distroShort, STR_OS_CENTOS, distroShortSize); diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/misc/posixPosix.c open-vm-tools-10.3.10/open-vm-tools/lib/misc/posixPosix.c --- open-vm-tools-10.3.5/open-vm-tools/lib/misc/posixPosix.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/misc/posixPosix.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019 VMware, Inc. All rights reserved. * * 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 @@ -2075,7 +2075,7 @@ n = 0; if (fsname) { - int len = strlen(fsname) + 1; + size_t len = strlen(fsname) + 1; if (n + len > size || n + len < n) { goto exit; @@ -2085,7 +2085,7 @@ } if (dir != NULL) { - int len = strlen(dir) + 1; + size_t len = strlen(dir) + 1; if (n + len > size || n + len < n) { goto exit; @@ -2095,7 +2095,7 @@ } if (type) { - int len = strlen(type) + 1; + size_t len = strlen(type) + 1; if (n + len > size || n + len < n) { goto exit; @@ -2111,7 +2111,6 @@ goto exit; } m->mnt_opts = memcpy(buf + n, opts, len); - n += len; } ret = 0; @@ -2129,7 +2128,7 @@ } return m; -#endif // defined __ANDROID__ +#endif // NO_GETMNTENT_R } diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/misc/timeutil.c open-vm-tools-10.3.10/open-vm-tools/lib/misc/timeutil.c --- open-vm-tools-10.3.5/open-vm-tools/lib/misc/timeutil.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/misc/timeutil.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * 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 @@ -152,8 +152,8 @@ /* 'YYYY/MM/DD' */ char temp[16] = { 0 }; - if (!(((date[4] != '/') || (date[7] != '/')) || - ((date[4] != '-') || (date[7] != '-')))) { + if (!((date[4] == '/' && date[7] == '/') || + (date[4] == '-' && date[7] == '-'))) { return FALSE; } diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/nicInfo/nicInfoPosix.c open-vm-tools-10.3.10/open-vm-tools/lib/nicInfo/nicInfoPosix.c --- open-vm-tools-10.3.5/open-vm-tools/lib/nicInfo/nicInfoPosix.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/nicInfo/nicInfoPosix.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2014-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2014-2019 VMware, Inc. All rights reserved. * * 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 @@ -377,7 +377,7 @@ /* Get a handle to read the network interface configuration details. */ if ((intf = intf_open()) == NULL) { - g_debug("Error, failed NULL result from intf_open()\n"); + g_warning("%s: intf_open() failed\n", __FUNCTION__); return FALSE; } @@ -484,7 +484,15 @@ * the first non-loopback, internet interface in the interface list. */ for (curr = ifaces; curr != NULL; curr = curr->ifa_next) { - int currFamily = ((struct sockaddr_storage *)curr->ifa_addr)->ss_family; + int currFamily; + + /* + * Some interfaces ("tun") have no ifa_addr, so ignore them. + */ + if (NULL == curr->ifa_addr) { + continue; + } + currFamily = ((struct sockaddr_storage *)curr->ifa_addr)->ss_family; if (!(curr->ifa_flags & IFF_UP) || curr->ifa_flags & IFF_LOOPBACK) { continue; @@ -518,6 +526,7 @@ } #else + #ifndef NO_DNET char * @@ -526,20 +535,24 @@ GuestInfoIpPriority ipp; intf_t *intf = intf_open(); - if (intf != NULL) { - ipp.ipstr = NULL; - for (ipp.priority = NICINFO_PRIORITY_PRIMARY; - ipp.priority < NICINFO_PRIORITY_MAX; - ipp.priority++){ - intf_loop(intf, GuestInfoGetIntf, &ipp); - if (ipp.ipstr != NULL) { - break; - } + if (NULL == intf) { + g_warning("%s: intf_open() failed\n", __FUNCTION__); + return NULL; + } + + ipp.ipstr = NULL; + for (ipp.priority = NICINFO_PRIORITY_PRIMARY; + ipp.priority < NICINFO_PRIORITY_MAX; + ipp.priority++){ + intf_loop(intf, GuestInfoGetIntf, &ipp); + if (ipp.ipstr != NULL) { + break; } - intf_close(intf); } + intf_close(intf); - g_debug("%s: returning '%s'", __FUNCTION__, ipp.ipstr); + g_debug("%s: returning '%s'", + __FUNCTION__, ipp.ipstr ? ipp.ipstr : ""); return ipp.ipstr; } diff -Nru open-vm-tools-10.3.5/open-vm-tools/lib/procMgr/procMgrPosix.c open-vm-tools-10.3.10/open-vm-tools/lib/procMgr/procMgrPosix.c --- open-vm-tools-10.3.5/open-vm-tools/lib/procMgr/procMgrPosix.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/lib/procMgr/procMgrPosix.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2017 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * 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 @@ -2205,9 +2205,8 @@ * set the return pointer (ppw) if there's no entry for the user, * according to POSIX 1003.1-2003, so patch up the errno. */ - if (error == 0) { - error = ENOENT; - } + Warning("Failed to lookup user with uid: %" FMTUID ". Reason: %s\n", 0, + error == 0 ? "entry not found" : Err_Errno2String(error)); return FALSE; } @@ -2220,17 +2219,16 @@ return FALSE; } - error = getpwnam_r(userLocal, &pw, buffer, sizeof buffer, &ppw); - - free(userLocal); - - if (error != 0 || !ppw) { - if (error == 0) { - error = ENOENT; - } + if ((error = getpwnam_r(userLocal, &pw, buffer, sizeof buffer, &ppw)) != 0 || + !ppw) { + Warning("Failed to lookup user name %s. Reason: %s\n", userLocal, + error == 0 ? "entry not found" : Err_Errno2String(error)); + free(userLocal); return FALSE; } + free(userLocal); + // first change group #if defined(USERWORLD) ret = Id_SetREGid(ppw->pw_gid, ppw->pw_gid); @@ -2306,9 +2304,8 @@ if ((error = getpwuid_r(0, &pw, buffer, sizeof buffer, &ppw)) != 0 || !ppw) { - if (error == 0) { - error = ENOENT; - } + Warning("Failed to lookup user with uid: %" FMTUID ". Reason: %s\n", 0, + error == 0 ? "entry not found" : Err_Errno2String(error)); return FALSE; } @@ -2432,9 +2429,8 @@ * set the return pointer (ppw) if there's no entry for the user, * according to POSIX 1003.1-2003, so patch up the errno. */ - if (error == 0) { - error = ENOENT; - } + Warning("Failed to lookup user with uid: %" FMTUID ". Reason: %s\n", uid, + error == 0 ? "entry not found" : Err_Errno2String(error)); return FALSE; } diff -Nru open-vm-tools-10.3.5/open-vm-tools/libDeployPkg/linuxDeployment.c open-vm-tools-10.3.10/open-vm-tools/libDeployPkg/linuxDeployment.c --- open-vm-tools-10.3.5/open-vm-tools/libDeployPkg/linuxDeployment.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/libDeployPkg/linuxDeployment.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2019 VMware, Inc. All rights reserved. * * 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 @@ -45,6 +45,7 @@ #include "mspackWrapper.h" #include "vmware/guestrpc/deploypkg.h" #include "vmware/tools/guestrpc.h" +#include #include #include @@ -74,9 +75,9 @@ #define IMC_TMP_PATH_VAR "@@IMC_TMP_PATH_VAR@@" #endif -// '/tmp' below will be addressed by PR 1601405. -#ifndef TMP_DIR_PATH_PATTERN -#define TMP_DIR_PATH_PATTERN "/tmp/.vmware-imgcust-dXXXXXX" +// Use it to create random name folder for extracting the package +#ifndef IMC_DIR_PATH_PATTERN +#define IMC_DIR_PATH_PATTERN "/.vmware-imgcust-dXXXXXX" #endif #ifndef BASEFILENAME @@ -100,6 +101,9 @@ static const char* INPROGRESS = "INPROGRESS"; static const char* DONE = "Done"; static const char* ERRORED = "ERRORED"; +static const char* RUNDIR = "/run"; +static const char* VARRUNDIR = "/var/run"; +static const char* TMPDIR = "/tmp"; // Possible return codes from perl script static const int CUST_SUCCESS = 0; @@ -902,14 +906,14 @@ * - nics.tx * - cust.cfg to a predefined location. * - * @param [IN] tmpDirPath Path where nics.txt and cust.cfg exist + * @param [IN] imcDirPath Path where nics.txt and cust.cfg exist * @returns DEPLOYPKG_STATUS_CLOUD_INIT_DELEGATED on success * DEPLOYPKG_STATUS_ERROR on error * *---------------------------------------------------------------------------- * */ static DeployPkgStatus -CloudInitSetup(const char *tmpDirPath) +CloudInitSetup(const char *imcDirPath) { DeployPkgStatus deployPkgStatus = DEPLOYPKG_STATUS_ERROR; static const char *cloudInitTmpDirPath = "/var/run/vmware-imc"; @@ -937,7 +941,7 @@ // rename in order to avoid race conditions with partial writes. sLog(log_info, "Check if nics.txt exists. Copy if exists, skip otherwise"); snprintf(command, sizeof(command), - "/usr/bin/test -f %s/nics.txt", tmpDirPath); + "/usr/bin/test -f %s/nics.txt", imcDirPath); command[sizeof(command) - 1] = '\0'; forkExecResult = ForkExecAndWaitCommand(command, false); @@ -949,18 +953,19 @@ */ if (forkExecResult == 0) { sLog(log_info, "nics.txt file exists. Copying.."); - if (!CopyFileToDirectory(tmpDirPath, cloudInitTmpDirPath, "nics.txt")) { + if (!CopyFileToDirectory(imcDirPath, cloudInitTmpDirPath, "nics.txt")) { goto done; } } // Get custom script name. - if (HasCustomScript(tmpDirPath, &customScriptName)) { + customScriptName = GetCustomScript(imcDirPath); + if (customScriptName != NULL) { char scriptPath[1024]; sLog(log_info, "Custom script present."); sLog(log_info, "Copying script to execute post customization."); - snprintf(scriptPath, sizeof(scriptPath), "%s/scripts", tmpDirPath); + snprintf(scriptPath, sizeof(scriptPath), "%s/scripts", imcDirPath); scriptPath[sizeof(scriptPath) - 1] = '\0'; if (!CopyFileToDirectory(scriptPath, cloudInitTmpDirPath, "post-customize-guest.sh")) { @@ -969,14 +974,14 @@ sLog(log_info, "Copying user uploaded custom script %s", customScriptName); - if (!CopyFileToDirectory(tmpDirPath, cloudInitTmpDirPath, + if (!CopyFileToDirectory(imcDirPath, cloudInitTmpDirPath, customScriptName)) { goto done; } } sLog(log_info, "Copying main configuration file cust.cfg"); - if (!CopyFileToDirectory(tmpDirPath, cloudInitTmpDirPath, "cust.cfg")) { + if (!CopyFileToDirectory(imcDirPath, cloudInitTmpDirPath, "cust.cfg")) { goto done; } @@ -1133,7 +1138,8 @@ uint8 archiveType; uint8 flags; bool forceSkipReboot = false; - char *tmpDirPath; + const char *baseDirPath = NULL; + char *imcDirPath = NULL; bool useCloudInitWorkflow = false; TransitionState(NULL, INPROGRESS); @@ -1142,19 +1148,40 @@ SetCustomizationStatusInVmx(TOOLSDEPLOYPKG_RUNNING, TOOLSDEPLOYPKG_ERROR_SUCCESS, NULL); - tmpDirPath = mkdtemp((char *)Util_SafeStrdup(TMP_DIR_PATH_PATTERN)); - if (tmpDirPath == NULL) { - SetDeployError("Error creating tmp dir: %s", strerror(errno)); + + // PR 2127543, Use /var/run or /run but /tmp firstly + if (File_IsDirectory(VARRUNDIR)) { + baseDirPath = VARRUNDIR; + } else if (File_IsDirectory(RUNDIR)) { + baseDirPath = RUNDIR; + } else { + baseDirPath = TMPDIR; + } + + // Create a random name dir under base dir path + imcDirPath = malloc(strlen(baseDirPath) + strlen(IMC_DIR_PATH_PATTERN) + 1); + if (imcDirPath == NULL) { + SetDeployError("Error allocating memory to create imc dir."); + return DEPLOYPKG_STATUS_ERROR; + } + strcpy(imcDirPath, baseDirPath); + strcat(imcDirPath, IMC_DIR_PATH_PATTERN); + if (mkdtemp(imcDirPath) == NULL) { + free(imcDirPath); + SetDeployError("Error creating imc dir: %s", strerror(errno)); return DEPLOYPKG_STATUS_ERROR; } - sLog(log_info, "Reading cabinet file %s. \n", packageName); + sLog(log_info, + "Reading cabinet file %s and will extract it to %s. \n", + packageName, + imcDirPath); // Get the command to execute if (!GetPackageInfo(packageName, &pkgCommand, &archiveType, &flags)) { SetDeployError("Error extracting package header information. (%s)", GetDeployError()); - free(tmpDirPath); + free(imcDirPath); return DEPLOYPKG_STATUS_CAB_ERROR; } @@ -1162,30 +1189,30 @@ sLog(log_info, "Original deployment command: %s\n", pkgCommand); if (strstr(pkgCommand, IMC_TMP_PATH_VAR) != NULL) { - command = StrUtil_ReplaceAll(pkgCommand, IMC_TMP_PATH_VAR, tmpDirPath); + command = StrUtil_ReplaceAll(pkgCommand, IMC_TMP_PATH_VAR, imcDirPath); } else { - command = StrUtil_ReplaceAll(pkgCommand, TMP_PATH_VAR, tmpDirPath); + command = StrUtil_ReplaceAll(pkgCommand, TMP_PATH_VAR, imcDirPath); } free(pkgCommand); sLog(log_info, "Actual deployment command: %s\n", command); if (archiveType == VMWAREDEPLOYPKG_PAYLOAD_TYPE_CAB) { - if (!ExtractCabPackage(packageName, tmpDirPath)) { - free(tmpDirPath); + if (!ExtractCabPackage(packageName, imcDirPath)) { + free(imcDirPath); free(command); return DEPLOYPKG_STATUS_CAB_ERROR; } } else if (archiveType == VMWAREDEPLOYPKG_PAYLOAD_TYPE_ZIP) { - if (!ExtractZipPackage(packageName, tmpDirPath)) { - free(tmpDirPath); + if (!ExtractZipPackage(packageName, imcDirPath)) { + free(imcDirPath); free(command); return DEPLOYPKG_STATUS_CAB_ERROR; } } if (!(flags & VMWAREDEPLOYPKG_HEADER_FLAGS_IGNORE_CLOUD_INIT)) { - useCloudInitWorkflow = UseCloudInitWorkflow(tmpDirPath); + useCloudInitWorkflow = UseCloudInitWorkflow(imcDirPath); } else { sLog(log_info, "Ignoring cloud-init."); } @@ -1194,7 +1221,7 @@ sLog(log_info, "Executing cloud-init workflow"); sSkipReboot = TRUE; free(command); - deployPkgStatus = CloudInitSetup(tmpDirPath); + deployPkgStatus = CloudInitSetup(imcDirPath); } else { sLog(log_info, "Executing traditional GOSC workflow"); deploymentResult = ForkExecAndWaitCommand(command, false); @@ -1227,7 +1254,7 @@ sLog(log_error, "Deployment failed. " "The forked off process returned error code. \n"); } else { - nics = GetNicsToEnable(tmpDirPath); + nics = GetNicsToEnable(imcDirPath); if (nics) { // XXX: Sleep before the last SetCustomizationStatusInVmx // This is a temporary-hack for PR 422790 @@ -1252,23 +1279,23 @@ } } - cleanupCommand = malloc(strlen(CLEANUPCMD) + strlen(tmpDirPath) + 1); + cleanupCommand = malloc(strlen(CLEANUPCMD) + strlen(imcDirPath) + 1); if (!cleanupCommand) { SetDeployError("Error allocating memory."); - free(tmpDirPath); + free(imcDirPath); return DEPLOYPKG_STATUS_ERROR; } strcpy(cleanupCommand, CLEANUPCMD); - strcat(cleanupCommand, tmpDirPath); + strcat(cleanupCommand, imcDirPath); sLog(log_info, "Launching cleanup. \n"); if (ForkExecAndWaitCommand(cleanupCommand, false) != 0) { - sLog(log_warning, "Error while clean up tmp directory %s: (%s)", - tmpDirPath, strerror (errno)); + sLog(log_warning, "Error while cleaning up imc directory %s: (%s)", + imcDirPath, strerror (errno)); } free (cleanupCommand); - free(tmpDirPath); + free(imcDirPath); if (flags & VMWAREDEPLOYPKG_HEADER_FLAGS_SKIP_REBOOT) { forceSkipReboot = true; diff -Nru open-vm-tools-10.3.5/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.c open-vm-tools-10.3.10/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.c --- open-vm-tools-10.3.5/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2016-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2016-2019 VMware, Inc. All rights reserved. * * 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 @@ -48,93 +48,100 @@ FILE *cloudFile; char line[256]; regex_t regex; - // Expected regex in cloud.cfg file - const char *cloudInitRegex = "^\\s*disable_vmware_customization\\s*:\\s*false\\s*$"; - int reti = regcomp(®ex, cloudInitRegex, 0); - if (reti) { - char buf[256]; - regerror(reti, ®ex, buf, sizeof(buf)); - sLog(log_warning, "Error compiling regex for cloud-init flag: %s", buf); - return isEnabled; - } + const char *cloudInitRegex = + "^\\s*disable_vmware_customization\\s*:\\s*false\\s*$"; + int reti; sLog(log_info, "Checking if cloud.cfg exists and if cloud-init is enabled."); - // Read cloud.cfg file and find expected string. cloudFile = fopen(cloudFilePath, "r"); if (cloudFile == NULL) { sLog(log_info, "Could not open file: %s", strerror(errno)); + return isEnabled; + } + + reti = regcomp(®ex, cloudInitRegex, 0); + if (reti != 0) { + char buf[256]; + regerror(reti, ®ex, buf, sizeof(buf)); + sLog(log_error, "Error compiling regex for cloud-init flag: %s", buf); goto done; } - while(fgets(line, sizeof(line), cloudFile)) { - if (!regexec(®ex, line, 0, NULL, 0)) { + + while (fgets(line, sizeof(line), cloudFile) != NULL) { + if (regexec(®ex, line, 0, NULL, 0) == 0) { isEnabled = true; break; } } - if (ferror(cloudFile)) { + if (ferror(cloudFile) != 0) { sLog(log_warning, "Error reading file: %s", strerror(errno)); isEnabled = false; } - fclose(cloudFile); + regfree(®ex); done: - regfree(®ex); + fclose(cloudFile); return isEnabled; } /** *----------------------------------------------------------------------------- * - * HasCustomScript + * GetCustomScript * - * Get custom script name if it exists. + * Get custom script name if it exists. Returns the first script found. * * @param [IN] dirPath path to extracted cab files - * @param [IN/OUT] scriptName name of the user uploaded custom script. - * scriptName will be set only if custom script - * exists. - * @returns TRUE if custom script exists in dirPath + * + * @returns the script name of the user uploaded custom script if it + * is found in dirPath. Must be freed by caller. + * + * NULL on failure or if the script does not exist * * ---------------------------------------------------------------------------- **/ -bool -HasCustomScript(const char* dirPath, char** scriptName) +char * +GetCustomScript(const char* dirPath) { - bool hasScript = false; + char *scriptName = NULL; static const char *customScriptRegex = "^script[A-Za-z0-9]*\\.bat"; DIR *tempDir; struct dirent *dir; regex_t scriptRegex; - int ret = regcomp(&scriptRegex, customScriptRegex, 0); - if (ret) { - char buf[256]; - regerror(ret, &scriptRegex, buf, sizeof(buf)); - sLog(log_warning, "Error compiling regex for custom script: %s", - buf); - return hasScript; - } + int regRet; + sLog(log_info, "Check if custom script(pre/post customization) exists."); tempDir = opendir(dirPath); if (tempDir == NULL) { sLog(log_warning, "Could not open directory %s: error: %s", dirPath, strerror(errno)); + return scriptName; + } + + regRet = regcomp(&scriptRegex, customScriptRegex, 0); + if (regRet != 0) { + char buf[256]; + + regerror(regRet, &scriptRegex, buf, sizeof(buf)); + sLog(log_error, "Error compiling regex for custom script: %s", buf); goto done; } + while ((dir = readdir(tempDir)) != NULL) { - if (!regexec(&scriptRegex, dir->d_name, 0, NULL, 0)) { - *scriptName = strdup(dir->d_name); - if (*scriptName == NULL) { + if (regexec(&scriptRegex, dir->d_name, 0, NULL, 0) == 0) { + scriptName = strdup(dir->d_name); + if (scriptName == NULL) { sLog(log_warning, "Could not allocate memory for scriptName: %s", strerror(errno)); - closedir(tempDir); - goto done; + break; } - hasScript = true; + break; } } - closedir(tempDir); -done: regfree(&scriptRegex); - return hasScript; + +done: + closedir(tempDir); + return scriptName; } diff -Nru open-vm-tools-10.3.5/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.h open-vm-tools-10.3.10/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.h --- open-vm-tools-10.3.5/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/libDeployPkg/linuxDeploymentUtilities.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2016-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2016-2019 VMware, Inc. All rights reserved. * * 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 @@ -26,7 +26,7 @@ IMGCUST_API bool IsCloudInitEnabled(const char* configFile); -IMGCUST_API bool -HasCustomScript(const char* dirPath, char** scriptName); +IMGCUST_API char * +GetCustomScript(const char* dirPath); #endif //_LINUXDEPLOYMENTUTILITIES_H_ diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/deployPkg/deployPkgLog.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/deployPkg/deployPkgLog.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/deployPkg/deployPkgLog.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/deployPkg/deployPkgLog.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2019 VMware, Inc. All rights reserved. * * 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 @@ -30,6 +30,7 @@ #include "vmware/tools/utils.h" #include +#include #ifdef _WIN32 #include @@ -43,8 +44,9 @@ * * DeployPkgLog_Open -- * - * Init the log. Creates a file in %temp%/vmware and - * opens it for writing. On error, the file will not be opened and logging + * Init the log. Creates a file in %temp%/vmware and + * opens it for writing. On linux, only root own r/w right. + * On error, the file will not be opened and logging * will be disabled. * * Results: @@ -67,7 +69,7 @@ if (ret == 0) { return; } - + Str_Strcat(logPath, "vmware-imc", sizeof logPath); #else Str_Strcpy(logPath, "/var/log/vmware-imc", sizeof logPath); @@ -79,6 +81,7 @@ if (_file != NULL) { #ifndef _WIN32 setlinebuf(_file); + (void) chmod(logPath, 0600); #endif DeployPkgLog_Log(log_debug, "## Starting deploy pkg operation"); } diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2005-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2005-2019 VMware, Inc. All rights reserved. * * 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 @@ -276,12 +276,11 @@ } if (File_Exists(root)) { - if (!DnDRootDirUsable(root) && - !DnDSetPermissionsOnRootDir(root)) { + if (!DnDRootDirUsable(root)) { /* - * The directory already exists and its permissions are wrong and - * cannot be set, so there's not much we can do. + * The directory already exists and its permissions are wrong. */ + Log("%s: The root dir is not usable.\n", __FUNCTION__); return NULL; } } else { diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/dndcp/dnd/dndXdg.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/dndcp/dnd/dndXdg.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/dndcp/dnd/dndXdg.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/dndcp/dnd/dndXdg.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2014-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2014-2019 VMware, Inc. All rights reserved. * * 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 @@ -318,12 +318,11 @@ } if (File_Exists(root)) { - if ( !DnDRootDirUsable(root) - && !DnDSetPermissionsOnRootDir(root)) { + if (!DnDRootDirUsable(root)) { /* - * The directory already exists and its permissions are wrong and - * cannot be set, so there's not much we can do. + * The directory already exists and its permissions are wrong. */ + Log_Trivia("dnd: The root dir is not usable.\n"); return NULL; } } else { diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/vix/vixTools.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/vix/vixTools.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/vix/vixTools.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/vix/vixTools.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2019 VMware, Inc. All rights reserved. * * 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 @@ -293,10 +293,18 @@ /* * State of a single asynch startProgram. + * + * On Windows, keep the user's token and profile HANDLEs around + * so the profile isn't unloaded until the program exits. */ typedef struct VixToolsStartProgramState { ProcMgr_AsyncProc *procState; +#if defined(_WIN32) && SUPPORT_VGAUTH + HANDLE hToken; + HANDLE hProfile; +#endif + void *eventQueue; } VixToolsStartProgramState; @@ -693,6 +701,10 @@ VGAuthError TheVGAuthContext(VGAuthContext **ctx); +#ifdef _WIN32 +static void GuestAuthUnloadUserProfileAndToken(HANDLE hToken, HANDLE hProfile); +#endif + #endif @@ -1629,6 +1641,12 @@ Bool envBlockFromMalloc = TRUE; #endif GSource *timer; +#if defined(_WIN32) && SUPPORT_VGAUTH + HANDLE hToken = INVALID_HANDLE_VALUE; + HANDLE hProfile = INVALID_HANDLE_VALUE; + VGAuthError vgErr; + VGAuthContext *ctx; +#endif /* * Initialize this here so we can call free on its member variables in abort @@ -1788,6 +1806,43 @@ procArgs.envp = (char **)envVars; #endif +#if defined(_WIN32) && SUPPORT_VGAUTH + /* + * Special case profile handling for StartProgram. It should stay loaded + * until the program exits, so copy the profile and user handles for + * later cleanup, and clobber the profile handle so that it's not unloaded + * when the impersonation ends. + * + * Only do this when we've actually impersonated; its not + * needed when impersonation isn't done (eg vmusr or SYSTEM bypass). + */ + if (GuestAuthEnabled() && PROCESS_CREATOR_USER_TOKEN != userToken) { + vgErr = TheVGAuthContext(&ctx); + if (VGAUTH_FAILED(vgErr)) { + err = VixToolsTranslateVGAuthError(vgErr); + g_warning("%s: Couldn't get the vgauth context\n", __FUNCTION__); + goto abort; + } + + vgErr = VGAuth_UserHandleAccessToken(ctx, currentUserHandle, &hToken); + if (VGAUTH_FAILED(vgErr)) { + err = VixToolsTranslateVGAuthError(vgErr); + g_warning("%s: Failed to get user token\n", __FUNCTION__); + goto abort; + } + vgErr = VGAuth_UserHandleGetUserProfile(ctx, currentUserHandle, + &hProfile); + if (VGAUTH_FAILED(vgErr)) { + err = VixToolsTranslateVGAuthError(vgErr); + g_warning("%s: Failed to get user profile\n", __FUNCTION__); + CloseHandle(hToken); + goto abort; + } + } + asyncState->hToken = hToken; + asyncState->hProfile = hProfile; +#endif + asyncState->procState = ProcMgr_ExecAsync(fullCommandLine, &procArgs); #if defined(_WIN32) @@ -1808,6 +1863,25 @@ g_debug("%s: started '%s', pid %"FMT64"d\n", __FUNCTION__, fullCommandLine, *pid); +#if defined(_WIN32) && SUPPORT_VGAUTH + /* + * Clobber the profile handle before un-impersonation. + */ + if (GuestAuthEnabled() && PROCESS_CREATOR_USER_TOKEN != userToken) { + vgErr = VGAuth_UserHandleSetUserProfile(ctx, currentUserHandle, + INVALID_HANDLE_VALUE); + if (VGAUTH_FAILED(vgErr)) { + err = VixToolsTranslateVGAuthError(vgErr); + g_warning("%s: Failed to clobber user profile\n", __FUNCTION__); + // VGAuth_EndImpersonation will take care of profile, close hToken + CloseHandle(asyncState->hToken); + asyncState->hToken = INVALID_HANDLE_VALUE; + asyncState->hProfile = INVALID_HANDLE_VALUE; + goto abort; + } + } +#endif + /* * Start a periodic procedure to check the app periodically */ @@ -1823,6 +1897,7 @@ */ asyncState = NULL; + abort: free(tempCommandLine); free(fullCommandLine); @@ -2123,6 +2198,7 @@ * *----------------------------------------------------------------------------- */ + static void VixToolsUpdateStartedProgramList(VixToolsStartedProgramState *state) // IN { @@ -2147,6 +2223,9 @@ spList->endTime = state->endTime; spList->isRunning = FALSE; + g_debug("%s: started program '%s' has completed, exitCode %d\n", + __FUNCTION__, spList->fullCommandLine, spList->exitCode); + /* * Don't let the procState be free'd on Windows to * keep OS from reusing the pid. We need to free @@ -7882,6 +7961,9 @@ *userToken = PROCESS_CREATOR_USER_TOKEN; gImpersonatedUsername = Util_SafeStrdup(unobfuscatedUserName); + g_debug("%s: allowing interactive mode for user '%s'\n", + __FUNCTION__, gImpersonatedUsername); + goto abort; } else { /* @@ -8188,6 +8270,16 @@ if (NULL == asyncState) { return; } +#if defined(_WIN32) && SUPPORT_VGAUTH + /* + * Unload the user profile if saved. + */ + if (asyncState->hProfile != INVALID_HANDLE_VALUE && + asyncState->hToken != INVALID_HANDLE_VALUE) { + GuestAuthUnloadUserProfileAndToken(asyncState->hToken, + asyncState->hProfile); + } +#endif free(asyncState); } // VixToolsFreeStartProgramState @@ -11825,4 +11917,41 @@ *ctx = vgaCtx; return vgaCode; } -#endif + + +#ifdef _WIN32 +/* + *----------------------------------------------------------------------------- + * + * GuestAuthUnloadUserProfileAndToken -- + * + * Unload user profile and close user token. + * + * Helper to handle StartProgram cleanup. + * + * Return value: + * None + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static void +GuestAuthUnloadUserProfileAndToken(HANDLE hToken, + HANDLE hProfile) +{ + if (GuestAuthEnabled()) { + g_debug("%s: special-case profile unload %p\n", __FUNCTION__, hProfile); + if (!UnloadUserProfile(hToken, hProfile)) { + g_warning("%s: UnloadUserProfile() failed %d\n", + __FUNCTION__, GetLastError()); + } + CloseHandle(hToken); + } +} +#endif // _WIN32 + +#endif // SUPPORT_VGAUTH + diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/stateMachine.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/stateMachine.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/stateMachine.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/stateMachine.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2019 VMware, Inc. All rights reserved. * * 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 @@ -201,17 +201,19 @@ * Sends a command to the VMX asking it to update VMDB about a new backup event. * This will restart the keep-alive timer. * + * As the name implies, does not abort the quiesce operation on failure. + * * @param[in] event The event to set. * @param[in] code Error code. - * @param[in] dest Error description. + * @param[in] desc Error description. * * @return TRUE on success. */ Bool -VmBackup_SendEvent(const char *event, - const uint32 code, - const char *desc) +VmBackup_SendEventNoAbort(const char *event, + const uint32 code, + const char *desc) { Bool success; char *result = NULL; @@ -224,6 +226,7 @@ if (gBackupState->keepAlive != NULL) { g_source_destroy(gBackupState->keepAlive); g_source_unref(gBackupState->keepAlive); + gBackupState->keepAlive = NULL; } msg = g_strdup_printf(VMBACKUP_PROTOCOL_EVENT_SET" %s %u %s", @@ -267,19 +270,52 @@ &result, &resultLen); #endif - if (!success) { + if (success) { + ASSERT(gBackupState->keepAlive == NULL); + gBackupState->keepAlive = + g_timeout_source_new(VMBACKUP_KEEP_ALIVE_PERIOD / 2); + VMTOOLSAPP_ATTACH_SOURCE(gBackupState->ctx, + gBackupState->keepAlive, + VmBackupKeepAliveCallback, + NULL, + NULL); + } else { g_warning("Failed to send vmbackup event: %s, result: %s.\n", msg, result); } vm_free(result); g_free(msg); - gBackupState->keepAlive = g_timeout_source_new(VMBACKUP_KEEP_ALIVE_PERIOD / 2); - VMTOOLSAPP_ATTACH_SOURCE(gBackupState->ctx, - gBackupState->keepAlive, - VmBackupKeepAliveCallback, - NULL, - NULL); + return success; +} + + +/** + * Sends a command to the VMX asking it to update VMDB about a new backup event. + * This will restart the keep-alive timer. + * + * Aborts the quiesce operation on RPC failure. + * + * @param[in] event The event to set. + * @param[in] code Error code. + * @param[in] desc Error description. + * + * @return TRUE on success. + */ + +Bool +VmBackup_SendEvent(const char *event, + const uint32 code, + const char *desc) +{ + Bool success = VmBackup_SendEventNoAbort(event, code, desc); + + if (!success && gBackupState->rpcState != VMBACKUP_RPC_STATE_IGNORE) { + g_debug("Changing rpcState from %d to %d\n", + gBackupState->rpcState, VMBACKUP_RPC_STATE_ERROR); + gBackupState->rpcState = VMBACKUP_RPC_STATE_ERROR; + } + return success; } @@ -440,6 +476,12 @@ { g_debug("*** %s\n", __FUNCTION__); ASSERT(gBackupState != NULL); + + /* + * Once we abort the operation, we don't care about RPC state. + */ + gBackupState->rpcState = VMBACKUP_RPC_STATE_IGNORE; + if (gBackupState->machineState != VMBACKUP_MSTATE_SCRIPT_ERROR && gBackupState->machineState != VMBACKUP_MSTATE_SYNC_ERROR) { const char *eventMsg = "Quiesce aborted."; @@ -453,12 +495,13 @@ g_static_mutex_unlock(&gBackupState->opLock); #ifdef __linux__ - /* Thaw the guest if already quiesced */ + /* If quiescing has been completed, then undo it. */ if (gBackupState->machineState == VMBACKUP_MSTATE_SYNC_FREEZE) { - g_debug("Guest already quiesced, thawing for abort\n"); - if (!gBackupState->provider->snapshotDone(gBackupState, + g_debug("Aborting with file system already quiesced, undo quiescing " + "operation.\n"); + if (!gBackupState->provider->undo(gBackupState, gBackupState->provider->clientData)) { - g_debug("Thaw during abort failed\n"); + g_debug("Quiescing undo failed.\n"); eventMsg = "Quiesce could not be aborted."; } } @@ -622,6 +665,17 @@ if (opPending) { goto exit; } + + /* + * VMX state might have changed when we were processing + * currentOp. This is usually detected by failures in + * sending backup event to the host. + */ + if (gBackupState->rpcState == VMBACKUP_RPC_STATE_ERROR) { + g_warning("Aborting backup operation due to RPC errors."); + VmBackupDoAbort(); + goto exit; + } } switch (gBackupState->machineState) { @@ -957,6 +1011,7 @@ gBackupState->enableNullDriver = VMBACKUP_CONFIG_GET_BOOL(ctx->config, "enableNullDriver", TRUE); + gBackupState->rpcState = VMBACKUP_RPC_STATE_NORMAL; g_debug("Using quiesceApps = %d, quiesceFS = %d, allowHWProvider = %d," " execScripts = %d, scriptArg = %s, timeout = %u," @@ -1333,7 +1388,7 @@ /** - * Reset callback. + * Reset callback. Currently does nothing. * * @param[in] src The source object. Unused. * @param[in] ctx Unused. @@ -1345,7 +1400,7 @@ ToolsAppCtx *ctx, gpointer data) { - VmBackup_SyncDriverReset(); + } diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2019 VMware, Inc. All rights reserved. * * 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 @@ -35,16 +35,53 @@ #include #endif +/* + * Define an enumeration type VmBackupOpType and a corresponding array + * VmBackupOpName whose entries provide the printable names of the + * enumeration ids in VmBackupOpType. + * + * VmBackupOpType and VmBackupOpName are each defined as an invocation + * of a macro VMBACKUP_OPLIST. VMBACKUP_OPLIST specifies a list of + * enumeration ids using a macro VMBACKUP_OP that must be defined before + * invoking VMBACKUP_OPLIST. VMBACKUP_OP takes a single argument, which + * should be an enumeration id, and is defined to generate from the id + * either the id itself or a string to be used as its printable name. The + * result is that an invocation of VMBACKUP_OPLIST generates either the + * list of enumeration ids or the list of their printable names. + */ +#define VMBACKUP_OPLIST \ + VMBACKUP_OP(OP_FREEZE), \ + VMBACKUP_OP(OP_THAW), \ + VMBACKUP_OP(OP_UNDO), + +#define VMBACKUP_OPID(id) id +#define VMBACKUP_OPNAME(id) #id + +#undef VMBACKUP_OP +#define VMBACKUP_OP(id) VMBACKUP_OPID(id) + +typedef enum { + VMBACKUP_OPLIST +} VmBackupOpType; + +#undef VMBACKUP_OP +#define VMBACKUP_OP(id) VMBACKUP_OPNAME(id) + +static const char *VmBackupOpName[] = { + VMBACKUP_OPLIST +}; + +#undef VMBACKUP_OP + typedef struct VmBackupDriverOp { VmBackupOp callbacks; const char *volumes; - Bool freeze; + VmBackupOpType opType; Bool canceled; SyncDriverHandle *syncHandle; SyncManifest *manifest; } VmBackupDriverOp; - /* *----------------------------------------------------------------------------- * @@ -97,7 +134,7 @@ VmBackupDriverOp *op = (VmBackupDriverOp *) _op; VmBackupOpStatus ret; - if (op->freeze) { + if (op->opType == OP_FREEZE) { SyncDriverStatus st = SyncDriver_QueryStatus(*op->syncHandle, 0); g_debug("SyncDriver status: %d\n", st); @@ -208,7 +245,7 @@ static VmBackupDriverOp * VmBackupNewDriverOp(VmBackupState *state, // IN - Bool freeze, // IN + VmBackupOpType opType, // IN SyncDriverHandle *handle, // IN const char *volumes, // IN Bool useNullDriverPrefs) // IN @@ -216,8 +253,9 @@ Bool success; VmBackupDriverOp *op = NULL; - g_return_val_if_fail((handle == NULL || *handle == SYNCDRIVER_INVALID_HANDLE) || - !freeze, + g_return_val_if_fail((handle == NULL || + *handle == SYNCDRIVER_INVALID_HANDLE) || + opType != OP_FREEZE, NULL); op = Util_SafeMalloc(sizeof *op); @@ -226,24 +264,32 @@ op->callbacks.queryFn = VmBackupDriverOpQuery; op->callbacks.cancelFn = VmBackupDriverOpCancel; op->callbacks.releaseFn = VmBackupDriverOpRelease; - op->freeze = freeze; + op->opType = opType; op->volumes = volumes; op->syncHandle = g_new0(SyncDriverHandle, 1); *op->syncHandle = (handle != NULL) ? *handle : SYNCDRIVER_INVALID_HANDLE; - if (freeze) { - success = SyncDriver_Freeze(op->volumes, - useNullDriverPrefs ? - state->enableNullDriver : FALSE, - op->syncHandle, - state->excludedFileSystems); - } else { - op->manifest = SyncNewManifest(state, *op->syncHandle); - success = VmBackupDriverThaw(op->syncHandle); + switch (opType) { + case OP_FREEZE: + success = SyncDriver_Freeze(op->volumes, + useNullDriverPrefs ? + state->enableNullDriver : FALSE, + op->syncHandle, + state->excludedFileSystems); + break; + case OP_THAW: + op->manifest = SyncNewManifest(state, *op->syncHandle); + success = VmBackupDriverThaw(op->syncHandle); + break; + default: + ASSERT(opType == OP_UNDO); + success = VmBackupDriverThaw(op->syncHandle); + break; } if (!success) { - g_warning("Error %s filesystems.", freeze ? "freezing" : "thawing"); + g_warning("Error trying to perform %s on filesystems.", + VmBackupOpName[opType]); g_free(op->syncHandle); SyncManifestRelease(op->manifest); free(op); @@ -329,7 +375,7 @@ VmBackupDriverOp *op; g_debug("*** %s\n", __FUNCTION__); - op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, TRUE); + op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, TRUE); if (op != NULL) { state->clientData = op->syncHandle; @@ -366,7 +412,7 @@ VmBackupDriverOp *op; g_debug("*** %s\n", __FUNCTION__); - op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, FALSE); + op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, FALSE); if (op != NULL) { state->clientData = op->syncHandle; @@ -404,7 +450,7 @@ VmBackupState *state = (VmBackupState*) clientData; g_debug("*** %s\n", __FUNCTION__); - op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, TRUE); + op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, TRUE); if (op != NULL) { state->clientData = op->syncHandle; @@ -442,7 +488,7 @@ VmBackupState *state = (VmBackupState*) clientData; g_debug("*** %s\n", __FUNCTION__); - op = VmBackupNewDriverOp(state, TRUE, NULL, state->volumes, FALSE); + op = VmBackupNewDriverOp(state, OP_FREEZE, NULL, state->volumes, FALSE); if (op != NULL) { state->clientData = op->syncHandle; @@ -480,7 +526,7 @@ g_debug("*** %s\n", __FUNCTION__); - op = VmBackupNewDriverOp(state, FALSE, state->clientData, NULL, TRUE); + op = VmBackupNewDriverOp(state, OP_THAW, state->clientData, NULL, TRUE); g_free(state->clientData); state->clientData = NULL; @@ -513,7 +559,40 @@ g_debug("*** %s\n", __FUNCTION__); - op = VmBackupNewDriverOp(state, FALSE, state->clientData, NULL, FALSE); + op = VmBackupNewDriverOp(state, OP_THAW, state->clientData, NULL, FALSE); + g_free(state->clientData); + state->clientData = NULL; + + return VmBackup_SetCurrentOp(state, (VmBackupOp *) op, NULL, __FUNCTION__); +} + + +#if defined(__linux__) +/* + *----------------------------------------------------------------------------- + * + * VmBackupSyncDriverUndo -- + * + * Undo a completed quiescing operation. + * + * Result + * TRUE, unless an error occurs. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static Bool +VmBackupSyncDriverUndo(VmBackupState *state, + void *clientData) +{ + VmBackupDriverOp *op; + + g_debug("*** %s\n", __FUNCTION__); + + op = VmBackupNewDriverOp(state, OP_UNDO, state->clientData, NULL, TRUE); g_free(state->clientData); state->clientData = NULL; @@ -524,6 +603,39 @@ /* *----------------------------------------------------------------------------- * + * VmBackupSyncDriverOnlyUndo -- + * + * Undo a completed quiescing operation. + * + * Result + * TRUE, unless an error occurs. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static Bool +VmBackupSyncDriverOnlyUndo(VmBackupState *state, + void *clientData) +{ + VmBackupDriverOp *op; + + g_debug("*** %s\n", __FUNCTION__); + + op = VmBackupNewDriverOp(state, OP_UNDO, state->clientData, NULL, FALSE); + g_free(state->clientData); + state->clientData = NULL; + + return VmBackup_SetCurrentOp(state, (VmBackupOp *) op, NULL, __FUNCTION__); +} +#endif + + +/* + *----------------------------------------------------------------------------- + * * VmBackupSyncDriverRelease -- * * Frees the given pointer. @@ -579,10 +691,17 @@ if (useNullDriverPrefs) { provider->start = VmBackupSyncDriverStart; provider->snapshotDone = VmBackupSyncDriverSnapshotDone; +#if defined(__linux__) + provider->undo = VmBackupSyncDriverUndo; +#endif } else { provider->start = VmBackupSyncDriverOnlyStart; provider->snapshotDone = VmBackupSyncDriverOnlySnapshotDone; +#if defined(__linux__) + provider->undo = VmBackupSyncDriverOnlyUndo; +#endif } + provider->release = VmBackupSyncDriverRelease; provider->clientData = NULL; @@ -642,26 +761,3 @@ } #endif - - -/* - *----------------------------------------------------------------------------- - * - * VmBackup_SyncDriverReset -- - * - * Reset function - * - * Results: - * None. - * - * Side effects: - * Whatever are the side effects of what it calls. - * - *----------------------------------------------------------------------------- - */ - -void -VmBackup_SyncDriverReset(void) -{ - SyncManifestReset(); -} diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/syncManifest.c open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/syncManifest.c --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/syncManifest.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/syncManifest.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2017-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2017-2019 VMware, Inc. All rights reserved. * * 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 @@ -27,6 +27,7 @@ #include "syncDriver.h" #include "syncManifest.h" #include "vm_tools_version.h" +#include "vmware/tools/log.h" #include #include @@ -49,12 +50,6 @@ */ static const char syncManifestSwitch[] = "enableXmlManifest"; -/* - * If TRUE, indicates that VMTools should try to generate the backup - * manifest and send it to VMX; if FALSE, it won't try to do so. - */ -static Bool gSyncManifestTrySend = TRUE; - /* *----------------------------------------------------------------------------- @@ -95,12 +90,6 @@ return NULL; } - if (!gSyncManifestTrySend) { - g_debug("No backup manifest generated since previous" - " attempt to send one to host failed.\n"); - return NULL; - } - manifest = g_new0(SyncManifest, 1); manifest->path = g_strdup_printf("%s/%s", state->configDir, syncManifestName); @@ -173,37 +162,14 @@ return FALSE; } - if (!VmBackup_SendEvent(VMBACKUP_EVENT_GENERIC_MANIFEST, - VMBACKUP_SUCCESS, manifest->path)) { - g_warning("Host doesn't appear to support backup manifests " - "for Linux guests.\n"); - gSyncManifestTrySend = FALSE; + if (!VmBackup_SendEventNoAbort(VMBACKUP_EVENT_GENERIC_MANIFEST, + VMBACKUP_SUCCESS, manifest->path)) { + /* VmBackup_SendEventNoAbort logs the error */ + g_info("Non-fatal error occurred while sending %s, continuing " + "with the operation", VMBACKUP_EVENT_GENERIC_MANIFEST); return FALSE; } g_debug("Backup manifest was sent successfully.\n"); return TRUE; } - - -/* - *----------------------------------------------------------------------------- - * - * SyncManifestReset -- - * - * Reset SyncManifest global state - * - * Results: - * None - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ - -void -SyncManifestReset(void) -{ - gSyncManifestTrySend = TRUE; -} diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/syncManifest.h open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/syncManifest.h --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/syncManifest.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/syncManifest.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2017-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2017-2019 VMware, Inc. All rights reserved. * * 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 @@ -45,9 +45,6 @@ void SyncManifestRelease(SyncManifest *manifest); -void -SyncManifestReset(void); - #else /* !defined(__linux__) */ typedef void SyncManifest; @@ -55,7 +52,6 @@ #define SyncNewManifest(s, h) (NULL) #define SyncManifestSend(m) (TRUE) #define SyncManifestRelease(m) ASSERT(m == NULL) -#define SyncManifestReset() #endif /* defined(__linux__) */ diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h --- open-vm-tools-10.3.5/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019 VMware, Inc. All rights reserved. * * 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 @@ -72,6 +72,12 @@ VMBACKUP_MSTATE_SYNC_ERROR } VmBackupMState; +typedef enum { + VMBACKUP_RPC_STATE_NORMAL, + VMBACKUP_RPC_STATE_ERROR, + VMBACKUP_RPC_STATE_IGNORE +} VmBackupRpcState; + /** * This is a "base struct" for asynchronous operations monitored by the * state machine. Each implementation should provide these three functions @@ -138,6 +144,7 @@ Bool vssBootableSystemState; Bool vssPartialFileSupport; Bool vssUseDefault; + VmBackupRpcState rpcState; } VmBackupState; typedef Bool (*VmBackupCallback)(VmBackupState *); @@ -156,6 +163,7 @@ VmBackupProviderCallback start; #else ToolsCorePoolCb start; + VmBackupProviderCallback undo; #endif VmBackupProviderCallback snapshotDone; void (*release)(struct VmBackupSyncProvider *); @@ -295,8 +303,11 @@ const uint32 code, const char *desc); -void -VmBackup_SyncDriverReset(void); + +Bool +VmBackup_SendEventNoAbort(const char *event, + const uint32 code, + const char *desc); #endif /* _VMBACKUPINT_H_*/ diff -Nru open-vm-tools-10.3.5/open-vm-tools/services/vmtoolsd/pluginMgr.c open-vm-tools-10.3.10/open-vm-tools/services/vmtoolsd/pluginMgr.c --- open-vm-tools-10.3.5/open-vm-tools/services/vmtoolsd/pluginMgr.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/services/vmtoolsd/pluginMgr.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019 VMware, Inc. All rights reserved. * * 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 @@ -922,7 +922,8 @@ ToolsPlugin *plugin = g_ptr_array_index(state->plugins, state->plugins->len - 1); GArray *regs = (plugin->data != NULL) ? plugin->data->regs : NULL; - g_message("Unloading plugin '%s'.\n", plugin->data->name); + g_message("Unloading plugin '%s'.\n", + plugin->data != NULL ? plugin->data->name : "unknown"); if (regs != NULL) { guint i; diff -Nru open-vm-tools-10.3.5/open-vm-tools/toolbox/toolboxcmd-shrink.c open-vm-tools-10.3.10/open-vm-tools/toolbox/toolboxcmd-shrink.c --- open-vm-tools-10.3.5/open-vm-tools/toolbox/toolboxcmd-shrink.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/toolbox/toolboxcmd-shrink.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2019 VMware, Inc. All rights reserved. * * 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 @@ -438,8 +438,7 @@ } else { ToolsCmd_PrintErr(SU_(error.message, "Error: %s\n"), err); } - - rc = EX_TEMPFAIL; + /* progress < 100 will result in "rc" of EX_TEMPFAIL */ break; } @@ -461,14 +460,14 @@ } #endif - rc = EXIT_SUCCESS; g_print("\n"); - if (progress >= 100 && performShrink) { - rc = ShrinkDiskSendRPC(); - } else if (progress < 100) { + if (progress < 100) { rc = EX_TEMPFAIL; + } else if (performShrink) { + rc = ShrinkDiskSendRPC(); } else { - g_debug("Shrinking skipped.\n"); + rc = EXIT_SUCCESS; + g_debug("Shrink skipped.\n"); } if (rc != EXIT_SUCCESS) { diff -Nru open-vm-tools-10.3.5/open-vm-tools/vgauth/lib/impersonate.c open-vm-tools-10.3.10/open-vm-tools/vgauth/lib/impersonate.c --- open-vm-tools-10.3.5/open-vm-tools/vgauth/lib/impersonate.c 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/vgauth/lib/impersonate.c 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2011-2018 VMware, Inc. All rights reserved. + * Copyright (C) 2011-2019 VMware, Inc. All rights reserved. * * 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 @@ -115,7 +115,7 @@ #ifdef _WIN32 newHandle->token = token; - newHandle->hProfile = NULL; + newHandle->hProfile = INVALID_HANDLE_VALUE; #endif newHandle->refCount = 1; diff -Nru open-vm-tools-10.3.5/open-vm-tools/vgauth/public/VGAuthAuthentication.h open-vm-tools-10.3.10/open-vm-tools/vgauth/public/VGAuthAuthentication.h --- open-vm-tools-10.3.5/open-vm-tools/vgauth/public/VGAuthAuthentication.h 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/open-vm-tools/vgauth/public/VGAuthAuthentication.h 2019-03-16 17:55:01.000000000 +0000 @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2011-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2011-2019 VMware, Inc. All rights reserved. * * 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 @@ -80,9 +80,22 @@ char **userName); // OUT #ifdef _WIN32 +/* + * Special accessor functions for Windows to set and get user and + * profile handles. + */ + VGAuthError VGAuth_UserHandleAccessToken(VGAuthContext *ctx, VGAuthUserHandle *handle, HANDLE *authToken); + +VGAuthError VGAuth_UserHandleGetUserProfile(VGAuthContext *ctx, + VGAuthUserHandle *handle, + HANDLE *hProfile); + +VGAuthError VGAuth_UserHandleSetUserProfile(VGAuthContext *ctx, + VGAuthUserHandle *handle, + HANDLE hProfile); #endif diff -Nru open-vm-tools-10.3.5/ReleaseNotes.md open-vm-tools-10.3.10/ReleaseNotes.md --- open-vm-tools-10.3.5/ReleaseNotes.md 2018-11-07 23:00:09.000000000 +0000 +++ open-vm-tools-10.3.10/ReleaseNotes.md 2019-03-16 17:55:01.000000000 +0000 @@ -1,9 +1,9 @@ -open-vm-tools 10.3.5 Release Notes +open-vm-tools 10.3.10 Release Notes ================================= -**Updated on: 01 Nov 2018** +**Updated on: 14 MAR 2019** -open-vm-tools | 01 NOV 2018 | Build 10430147 +open-vm-tools | 14 MAR 2019 | Build 12406962 Check for additions and updates to these release notes. @@ -40,7 +40,7 @@ Internationalization -------------------- -open-vm-tools 10.3.5 is available in the following languages: +open-vm-tools 10.3.10 is available in the following languages: * English * French @@ -56,8 +56,8 @@ ----------------------------- * Support for Common Agent Framework (CAF) will be removed in the next major release of open-vm-tools. -* open-vm-tools 10.3.5 freezes feature support for tar tools and OSPs  - The tar tools (linux.iso) and OSPs shipped with open-vm-tools 10.3.5 release will continue to be supported. However, releases after open-vm-tools 10.3.5 will only include critical and security fixes and no new feature support in these types of open-vm-tools (tar tools and OSP's). It is recommended that customers use open-vm-tools for those operating systems that support open-vm-tools. For more information on different types of open-vm-tools, see [https://blogs.vmware.com/vsphere/2016/02/understanding-the-three-types-of-vm-tools.html](https://blogs.vmware.com/vsphere/2016/02/understanding-the-three-types-of-vm-tools.html) +* VMware Tools 10.3.5 freezes feature support for tar tools and OSPs  + The tar tools (linux.iso) and OSPs shipped with open-vm-tools 10.3.5 release will continue to be supported. However, releases after VMware Tools 10.3.5 will only include critical and security fixes and no new feature support in these types of open-vm-tools (tar tools and OSP's). It is recommended that customers use open-vm-tools for those operating systems that support open-vm-tools. For more information on different types of open-vm-tools, see [https://blogs.vmware.com/vsphere/2016/02/understanding-the-three-types-of-vm-tools.html](https://blogs.vmware.com/vsphere/2016/02/understanding-the-three-types-of-vm-tools.html) Guest Operating System Customization Support -------------------------------------------- @@ -72,50 +72,11 @@ Resolved Issues --------------- -* **While running a quiesced snapshot of a Linux guest on the vSphere hosts earlier than version 6.7, open-vm-tools logs warning messages.** - - open-vm-tools logs warning messages like the following: - - \[