From: Adar Dembo Date: Fri, 2 May 2008 23:17:07 +0000 (-0700) Subject: 2008.05.02-90473 refresh. X-Git-Tag: 2008.05.02-90473^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcf4e67f305b1c3b3e2137d3686c10b1f1ee6457;p=thirdparty%2Fopen-vm-tools.git 2008.05.02-90473 refresh. --- diff --git a/open-vm-tools/ChangeLog b/open-vm-tools/ChangeLog index 371b5a141..4b27cf071 100755 --- a/open-vm-tools/ChangeLog +++ b/open-vm-tools/ChangeLog @@ -1,3 +1,110 @@ +2008-05-02 Adar Dembo + + * Resync with internal trunk (2008.04.19). + + * configure.ac, guestd/Makefile.am, hgfsclient/Makefile.am, + lib/misc/*/Makefile.am, lib/string/*/Makefile.am, toolbox/Makefile.am, + vmware-user/Makefile.am, xferlogs/Makefile.am: Added libicu support for + codeset conversions. This includes some makefile logic as well as + autoconf arguments for controlling libicu behavior at compile-time. + + * */foreignVMToolsNetworking.c, lib/vixTools/vixTools.c: Unicode fixes. + + * */foundryToolsDaemon.c, lib/foundryMsg/vixTranslateErrOpenSource.c, + lib/panic/panic.c, lib/printer/printer.c: Added calls to Win32 Unicode + wrappers. + + * guestd/main.c: Cleaned up guestInfo server when guestd shuts down. + + * guestd/toolsDaemon.c, vmware-user/resolution.c: Disabled multi-mon + advertisement for Win2k. + + * lib/auth/authPosix.c, lib/dnd/dndLinux.c, lib/file/*, + lib/impersonate/impersonatePosix.c, lib/include/mntinfo.h, + lib/sync/syncWaitQPosix.c, lib/user/hostinfoPosix.c, lib/user/util.c, + lib/user/utilPosix.c, lib/wiper/wiperPosix.c: Added calls to POSIX + Unicode wrappers. + + * lib/file/*: Replaced calls to string functions with calls to + the "safe" family of string functions. + + * lib/dict/dictll.c, lib/include/dictll.h: Detect and tolerate UTF-8 + dictionary files that contain the UTF-8 BOM. + + * lib/err/*, lib/include/err.h, lib/include/msgfmt.h, + lib/include/msg.h: Added support for localization of error strings. + + * lib/foundryMsg/foundryThreads.c, lib/include/foundryThreads.h, + lib/misc/util_misc.c: Added opaque type for threads/process IDs. + + * lib/guestInfo/guestInfoServer.c: Removed separate thread context. + + * lib/hgfsServer/*, lib/include/hgfs*.h: Additional HGFSv3 cleanup. + + * lib/hgfsServer/hgfsServerLinux.c: Added calls to POSIX Unicode + wrappers. Fixed some alias detection code for MacOS. + + * lib/include/backdoor_def.h: Added backdoor call for debugging events. + + * lib/include/bsdfmt.h, lib/string/bsd_vsnprintf.c, + lib/string/bsd_vsnprintfw.c: Replaced BSDFmt_WCSonv with + BSDFmt_WChartoUTF8. + + * lib/include/codeset.h, lib/include/codesetOld.h, lib/misc/codeset.c, + lib/misc/codesetOld.c, lib/string/convertutf.h: Implemented + libicu-backed codeset layer. When building without libicu, fallback on + codesetOld. + + * lib/include/guestApp.h: Added wide versions of dictionary functions. + + * lib/include/loglevel_user.h: Added two new loglevels. + + * lib/include/posix.h, lib/misc/posixPosix.c: Added new POSIX wrappers. + + * lib/include/str.h: Clarified the use of some functions. + + * lib/include/syncMutex.h, lib/include/syncWaitQ.h: Removed unneeded + macros. + + * lib/include/unicode*.h, lib/unicode/*: Ongoing Unicode work. + + * lib/include/util.h: Added Util_FreeStringList, removed Util_FreeList. + + * lib/include/uuid.h: Added new UUID creation scheme. + + * lib/include/vix*.h: Tweaked some VIX commands, errors, and properties. + + * lib/include/vmBackup.h, lib/vmBackupLib/scriptOps.c, + lib/vmBackupLib/stateMachine.c: Moved disabled targets logic from + library to Windows VSS provider. + + * lib/include/vm_basic_asm_x86*.h: Allow emitted FX functions to + modify main memory as a side effect. + + * lib/include/vm_tools_version.h: Bump Tools version. + + * lib/include/vm_version.h: Added several product versions. + + * modules/linux/vmhgfs/*: Additional cleanup for HGFSv3. Use new kthread + wrapper when possible. Bump module version. + + * modules/linux/vmmemctl/*: Use new kthread wrapper when possible. + Remove dead delayed work code. Bump module version. + + * modules/linux/*/compat_kthread.c: Added kthread wrapper implementation + for modules that use kernel threads. + + * modules/*/*/*: Reflect header file changes from elsewhere in the + source code tree. + + * vmware-user/copyPaste.c, vmware-user/pointer.c, + vmware-user/vmwareuserInt.h: Stop wastefully polling for pointer + updates if the VMX is new enough. + + * xferlogs/xferlogs.c: Fixed a warning in the call to fwrite. + (Thanks to Denis Leroy for reporting this bug.) + + 2008-04-14 Elliot Lee * Resync with internal trunk (2008.04.01). @@ -121,6 +228,7 @@ systems. Detect libprocps. 2008-03-19 Adar Dembo + * Resync with internal trunk (2008.03.13). * vm_version.h: Updated Tools version. @@ -215,6 +323,7 @@ source code tree. 2008-03-11 Adar Dembo + * vm_version.h: Updated Tools version. * modules/vmblock/linux/*: Make vmblock build under 2.6.25-rc2. @@ -226,6 +335,7 @@ The same changes were needed here as in vmblock above. 2008-03-10 Adar Dembo + * vm_version.h: Updated Tools version. * modules/vmhgfs/linux/*: Make vmhgfs build under 2.6.25-rc1. @@ -307,6 +417,7 @@ source code tree. 2008-02-13 Adar Dembo + * Resync with internal trunk (2008.02.12). * configure.ac, lib/unityStub/*, lib/ghIntegrationStub/*, @@ -468,7 +579,7 @@ when guestd sends its version to when guestd registers its capabilities. - * lib/file/*, lib/public/file*.h : Massive overhaul of lib/file to + * lib/file/*, lib/include/file*.h : Massive overhaul of lib/file to integrate the new unicode strings that are i18n-safe. Quite a bit of cleanup and refactoring as well. diff --git a/open-vm-tools/FILES b/open-vm-tools/FILES index 24ab8618c..4b30e3e0e 100644 --- a/open-vm-tools/FILES +++ b/open-vm-tools/FILES @@ -1,1197 +1,1204 @@ -open-vm-tools-2008.04.14-87182: -total 1668 --rwxr-xr-x 1 mts mts 33 Apr 14 13:03 AUTHORS --rwxr-xr-x 1 mts mts 26425 Apr 14 13:03 COPYING --rwxr-xr-x 1 mts mts 32371 Apr 14 13:03 ChangeLog --r--r--r-- 1 mts mts 9416 Apr 14 13:03 INSTALL --rwxr-xr-x 1 mts mts 1361 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 20998 Apr 14 13:03 Makefile.in --rwxr-xr-x 1 mts mts 1293 Apr 14 13:03 NEWS --rwxr-xr-x 1 mts mts 6311 Apr 14 13:03 README --rw-r--r-- 1 mts mts 262309 Apr 14 13:03 aclocal.m4 -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autom4te.cache -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 checkvm +open-vm-tools-2008.05.02-90473: +total 1676 +-rwxr-xr-x 1 mts mts 33 May 2 15:24 AUTHORS +-rwxr-xr-x 1 mts mts 26425 May 2 15:24 COPYING +-rwxr-xr-x 1 mts mts 36356 May 2 15:24 ChangeLog +-r--r--r-- 1 mts mts 9416 May 2 15:25 INSTALL +-rwxr-xr-x 1 mts mts 1361 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 21072 May 2 15:25 Makefile.in +-rwxr-xr-x 1 mts mts 1636 May 2 15:24 NEWS +-rwxr-xr-x 1 mts mts 6311 May 2 15:24 README +-rw-r--r-- 1 mts mts 262309 May 2 15:25 aclocal.m4 +drwxr-xr-x 2 mts mts 4096 May 2 15:25 autom4te.cache +drwxr-xr-x 2 mts mts 4096 May 2 15:25 checkvm -r-xr-xr-x 1 mts mts 43668 Apr 28 2007 config.guess -r-xr-xr-x 1 mts mts 32151 Apr 28 2007 config.sub --rwxr-xr-x 1 mts mts 905644 Apr 14 13:03 configure --rwxr-xr-x 1 mts mts 22293 Apr 14 13:03 configure.ac --r-xr-xr-x 1 mts mts 17574 Apr 14 13:03 depcomp -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 guestd -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfsclient -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfsmounter --r-xr-xr-x 1 mts mts 13184 Apr 14 13:03 install-sh -drwxr-xr-x 48 mts mts 4096 Apr 14 13:03 lib -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 libguestlib +-rwxr-xr-x 1 mts mts 910427 May 2 15:25 configure +-rwxr-xr-x 1 mts mts 23279 May 2 15:25 configure.ac +-r-xr-xr-x 1 mts mts 17574 May 2 15:25 depcomp +drwxr-xr-x 2 mts mts 4096 May 2 15:25 guestd +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfsclient +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfsmounter +-r-xr-xr-x 1 mts mts 13184 May 2 15:25 install-sh +drwxr-xr-x 48 mts mts 4096 May 2 15:25 lib +drwxr-xr-x 2 mts mts 4096 May 2 15:25 libguestlib -r--r--r-- 1 mts mts 198422 Apr 28 2007 ltmain.sh --r-xr-xr-x 1 mts mts 11135 Apr 14 13:03 missing -drwxr-xr-x 4 mts mts 4096 Apr 14 13:03 modules -drwxr-xr-x 6 mts mts 4096 Apr 14 13:03 scripts -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 toolbox -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmware-user -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 xferlogs - -open-vm-tools-2008.04.14-87182/autom4te.cache: -total 2296 --rw-r--r-- 1 mts mts 907832 Apr 14 13:03 output.0 --rw-r--r-- 1 mts mts 907262 Apr 14 13:03 output.1 --rw-r--r-- 1 mts mts 10783 Apr 14 13:03 requests --rw-r--r-- 1 mts mts 439522 Apr 14 13:03 traces.0 --rw-r--r-- 1 mts mts 58923 Apr 14 13:03 traces.1 - -open-vm-tools-2008.04.14-87182/checkvm: +-r-xr-xr-x 1 mts mts 11135 May 2 15:25 missing +drwxr-xr-x 4 mts mts 4096 May 2 15:25 modules +drwxr-xr-x 6 mts mts 4096 May 2 15:25 scripts +drwxr-xr-x 2 mts mts 4096 May 2 15:25 toolbox +drwxr-xr-x 2 mts mts 4096 May 2 15:25 vmware-user +drwxr-xr-x 2 mts mts 4096 May 2 15:25 xferlogs + +open-vm-tools-2008.05.02-90473/autom4te.cache: +total 2304 +-rw-r--r-- 1 mts mts 912616 May 2 15:25 output.0 +-rw-r--r-- 1 mts mts 912046 May 2 15:25 output.1 +-rw-r--r-- 1 mts mts 10783 May 2 15:25 requests +-rw-r--r-- 1 mts mts 440048 May 2 15:25 traces.0 +-rw-r--r-- 1 mts mts 60011 May 2 15:25 traces.1 + +open-vm-tools-2008.05.02-90473/checkvm: total 60 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1001 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14554 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 7107 Apr 14 13:03 checkvm.c --r--r--r-- 1 mts mts 1544 Apr 14 13:03 checkvm_version.h +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 1001 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 14628 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 7107 May 2 15:25 checkvm.c +-r--r--r-- 1 mts mts 1544 May 2 15:25 checkvm_version.h -open-vm-tools-2008.04.14-87182/guestd: +open-vm-tools-2008.05.02-90473/guestd: total 352 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3469 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18278 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 6258 Apr 14 13:03 debugStdio.c --r--r--r-- 1 mts mts 37366 Apr 14 13:03 foreignVMToolsDaemon.c --r--r--r-- 1 mts mts 6210 Apr 14 13:03 foreignVMToolsDaemon.h --r--r--r-- 1 mts mts 37055 Apr 14 13:03 foreignVMToolsNetworking.c --r--r--r-- 1 mts mts 54646 Apr 14 13:03 foundryToolsDaemon.c --r--r--r-- 1 mts mts 1766 Apr 14 13:03 foundryToolsDaemon.h --r--r--r-- 1 mts mts 1521 Apr 14 13:03 guestd_version.h --r--r--r-- 1 mts mts 61201 Apr 14 13:03 main.c --r--r--r-- 1 mts mts 4731 Apr 14 13:03 stub.c --r--r--r-- 1 mts mts 54186 Apr 14 13:03 toolsDaemon.c --r--r--r-- 1 mts mts 4049 Apr 14 13:03 toolsDaemon.h - -open-vm-tools-2008.04.14-87182/hgfsclient: +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 3496 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 18363 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 6258 May 2 15:25 debugStdio.c +-r--r--r-- 1 mts mts 37366 May 2 15:25 foreignVMToolsDaemon.c +-r--r--r-- 1 mts mts 6210 May 2 15:25 foreignVMToolsDaemon.h +-r--r--r-- 1 mts mts 37059 May 2 15:25 foreignVMToolsNetworking.c +-r--r--r-- 1 mts mts 54676 May 2 15:25 foundryToolsDaemon.c +-r--r--r-- 1 mts mts 1766 May 2 15:25 foundryToolsDaemon.h +-r--r--r-- 1 mts mts 1521 May 2 15:25 guestd_version.h +-r--r--r-- 1 mts mts 61260 May 2 15:25 main.c +-r--r--r-- 1 mts mts 4731 May 2 15:25 stub.c +-r--r--r-- 1 mts mts 54521 May 2 15:25 toolsDaemon.c +-r--r--r-- 1 mts mts 4049 May 2 15:25 toolsDaemon.h + +open-vm-tools-2008.05.02-90473/hgfsclient: total 76 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 2151 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15981 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 16756 Apr 14 13:03 hgfsclient.c --r--r--r-- 1 mts mts 1576 Apr 14 13:03 hgfsclient_version.h --r--r--r-- 1 mts mts 2398 Apr 14 13:03 stub.c - -open-vm-tools-2008.04.14-87182/hgfsmounter: +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 2182 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 16066 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 16756 May 2 15:25 hgfsclient.c +-r--r--r-- 1 mts mts 1576 May 2 15:25 hgfsclient_version.h +-r--r--r-- 1 mts mts 2398 May 2 15:25 stub.c + +open-vm-tools-2008.05.02-90473/hgfsmounter: total 88 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1164 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14856 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 29755 Apr 14 13:03 hgfsmounter.c --r--r--r-- 1 mts mts 1578 Apr 14 13:03 hgfsmounter_version.h --r--r--r-- 1 mts mts 2113 Apr 14 13:03 stub.c - -open-vm-tools-2008.04.14-87182/lib: -total 232 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1793 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 16329 Apr 14 13:03 Makefile.in -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 SLPv2Parser -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 auth -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 backdoor -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 conf -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 deployPkg -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 dict -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 dnd -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 err -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 eventManager -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 file -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 foundryMsg -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 ghIntegrationStub -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 guestApp -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 guestInfo -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfs -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfsBd -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfsServer -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfsServerManagerGuest -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 hgfsServerPolicyGuest -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 impersonate -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 include -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 message -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 misc -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 netUtil -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 panic -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 panicDefault -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 printer -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 procMgr -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 rpcIn -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 rpcOut -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 rpcVmx -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 socketMgr -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 strUtil -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 string -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 sync -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 syncDriver -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 system -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 toolsLogger -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 unicode -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 unityStub -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 user -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vixTools -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmBackupLib -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmCheck -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmSignal -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 wiper - -open-vm-tools-2008.04.14-87182/lib/SLPv2Parser: +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 1164 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 14930 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 29755 May 2 15:25 hgfsmounter.c +-r--r--r-- 1 mts mts 1578 May 2 15:25 hgfsmounter_version.h +-r--r--r-- 1 mts mts 2113 May 2 15:25 stub.c + +open-vm-tools-2008.05.02-90473/lib: +total 236 +-r--r--r-- 1 mts mts 26425 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 1793 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 16403 May 2 15:25 Makefile.in +drwxr-xr-x 2 mts mts 4096 May 2 15:25 SLPv2Parser +drwxr-xr-x 2 mts mts 4096 May 2 15:25 auth +drwxr-xr-x 3 mts mts 4096 May 2 15:25 backdoor +drwxr-xr-x 2 mts mts 4096 May 2 15:25 conf +drwxr-xr-x 2 mts mts 4096 May 2 15:25 deployPkg +drwxr-xr-x 2 mts mts 4096 May 2 15:25 dict +drwxr-xr-x 2 mts mts 4096 May 2 15:25 dnd +drwxr-xr-x 2 mts mts 4096 May 2 15:25 err +drwxr-xr-x 2 mts mts 4096 May 2 15:25 eventManager +drwxr-xr-x 2 mts mts 4096 May 2 15:25 file +drwxr-xr-x 2 mts mts 4096 May 2 15:25 foundryMsg +drwxr-xr-x 2 mts mts 4096 May 2 15:25 ghIntegrationStub +drwxr-xr-x 2 mts mts 4096 May 2 15:25 guestApp +drwxr-xr-x 2 mts mts 4096 May 2 15:25 guestInfo +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfs +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfsBd +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfsServer +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfsServerManagerGuest +drwxr-xr-x 2 mts mts 4096 May 2 15:25 hgfsServerPolicyGuest +drwxr-xr-x 2 mts mts 4096 May 2 15:25 impersonate +drwxr-xr-x 3 mts mts 4096 May 2 15:25 include +drwxr-xr-x 3 mts mts 4096 May 2 15:25 message +drwxr-xr-x 3 mts mts 4096 May 2 15:25 misc +drwxr-xr-x 2 mts mts 4096 May 2 15:25 netUtil +drwxr-xr-x 2 mts mts 4096 May 2 15:25 panic +drwxr-xr-x 2 mts mts 4096 May 2 15:25 panicDefault +drwxr-xr-x 2 mts mts 4096 May 2 15:25 printer +drwxr-xr-x 2 mts mts 4096 May 2 15:25 procMgr +drwxr-xr-x 2 mts mts 4096 May 2 15:25 rpcIn +drwxr-xr-x 3 mts mts 4096 May 2 15:25 rpcOut +drwxr-xr-x 2 mts mts 4096 May 2 15:25 rpcVmx +drwxr-xr-x 2 mts mts 4096 May 2 15:25 socketMgr +drwxr-xr-x 2 mts mts 4096 May 2 15:25 strUtil +drwxr-xr-x 3 mts mts 4096 May 2 15:25 string +drwxr-xr-x 3 mts mts 4096 May 2 15:25 sync +drwxr-xr-x 2 mts mts 4096 May 2 15:25 syncDriver +drwxr-xr-x 2 mts mts 4096 May 2 15:25 system +drwxr-xr-x 2 mts mts 4096 May 2 15:25 toolsLogger +drwxr-xr-x 2 mts mts 4096 May 2 15:25 unicode +drwxr-xr-x 2 mts mts 4096 May 2 15:25 unityStub +drwxr-xr-x 2 mts mts 4096 May 2 15:25 user +drwxr-xr-x 2 mts mts 4096 May 2 15:25 vixTools +drwxr-xr-x 2 mts mts 4096 May 2 15:25 vmBackupLib +drwxr-xr-x 2 mts mts 4096 May 2 15:25 vmCheck +drwxr-xr-x 2 mts mts 4096 May 2 15:25 vmSignal +drwxr-xr-x 2 mts mts 4096 May 2 15:25 wiper + +open-vm-tools-2008.05.02-90473/lib/SLPv2Parser: total 68 --r--r--r-- 1 mts mts 1125 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14952 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 7514 Apr 14 13:03 SLPv2Match.c --r--r--r-- 1 mts mts 18294 Apr 14 13:03 SLPv2MsgAssembler.c --r--r--r-- 1 mts mts 16818 Apr 14 13:03 SLPv2MsgParser.c +-r--r--r-- 1 mts mts 1125 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15026 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 7514 May 2 15:25 SLPv2Match.c +-r--r--r-- 1 mts mts 18294 May 2 15:25 SLPv2MsgAssembler.c +-r--r--r-- 1 mts mts 16818 May 2 15:25 SLPv2MsgParser.c -open-vm-tools-2008.04.14-87182/lib/auth: +open-vm-tools-2008.05.02-90473/lib/auth: total 32 --r--r--r-- 1 mts mts 1041 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14565 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8605 Apr 14 13:03 authPosix.c +-r--r--r-- 1 mts mts 1041 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14639 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8638 May 2 15:25 authPosix.c -open-vm-tools-2008.04.14-87182/lib/backdoor: +open-vm-tools-2008.05.02-90473/lib/backdoor: total 52 --r--r--r-- 1 mts mts 1177 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 19278 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 6407 Apr 14 13:03 backdoor.c --r--r--r-- 1 mts mts 6198 Apr 14 13:03 backdoorGcc32.c --r--r--r-- 1 mts mts 5574 Apr 14 13:03 backdoorGcc64.c -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 shared - -open-vm-tools-2008.04.14-87182/lib/backdoor/shared: +-r--r--r-- 1 mts mts 1177 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 19352 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 6407 May 2 15:24 backdoor.c +-r--r--r-- 1 mts mts 6198 May 2 15:24 backdoorGcc32.c +-r--r--r-- 1 mts mts 5574 May 2 15:24 backdoorGcc64.c +drwxr-xr-x 2 mts mts 4096 May 2 15:25 shared + +open-vm-tools-2008.05.02-90473/lib/backdoor/shared: total 24 --r--r--r-- 1 mts mts 1164 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18155 Apr 14 13:03 Makefile.in +-r--r--r-- 1 mts mts 1164 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 18229 May 2 15:25 Makefile.in -open-vm-tools-2008.04.14-87182/lib/conf: +open-vm-tools-2008.05.02-90473/lib/conf: total 28 --r--r--r-- 1 mts mts 1005 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14532 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 5057 Apr 14 13:03 conf.c +-r--r--r-- 1 mts mts 1005 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14606 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 5057 May 2 15:24 conf.c -open-vm-tools-2008.04.14-87182/lib/deployPkg: +open-vm-tools-2008.05.02-90473/lib/deployPkg: total 40 --r--r--r-- 1 mts mts 1112 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14901 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8574 Apr 14 13:03 deployPkg.c --r--r--r-- 1 mts mts 3246 Apr 14 13:03 deployPkgLog.c --r--r--r-- 1 mts mts 3605 Apr 14 13:03 runDeployPkgPosix.c +-r--r--r-- 1 mts mts 1112 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14975 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8574 May 2 15:25 deployPkg.c +-r--r--r-- 1 mts mts 3246 May 2 15:25 deployPkgLog.c +-r--r--r-- 1 mts mts 3605 May 2 15:25 runDeployPkgPosix.c -open-vm-tools-2008.04.14-87182/lib/dict: +open-vm-tools-2008.05.02-90473/lib/dict: total 36 --r--r--r-- 1 mts mts 1008 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14538 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 14701 Apr 14 13:03 dictll.c +-r--r--r-- 1 mts mts 1008 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14612 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 15769 May 2 15:25 dictll.c -open-vm-tools-2008.04.14-87182/lib/dnd: +open-vm-tools-2008.05.02-90473/lib/dnd: total 64 --r--r--r-- 1 mts mts 1038 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14628 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 27742 Apr 14 13:03 dndCommon.c --r--r--r-- 1 mts mts 15018 Apr 14 13:03 dndLinux.c +-r--r--r-- 1 mts mts 1038 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14702 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 27742 May 2 15:25 dndCommon.c +-r--r--r-- 1 mts mts 15024 May 2 15:25 dndLinux.c -open-vm-tools-2008.04.14-87182/lib/err: -total 28 --r--r--r-- 1 mts mts 1033 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14610 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 1465 Apr 14 13:03 err.c --r--r--r-- 1 mts mts 1524 Apr 14 13:03 errPosix.c +open-vm-tools-2008.05.02-90473/lib/err: +total 36 +-r--r--r-- 1 mts mts 1033 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14684 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 6614 May 2 15:25 err.c +-r--r--r-- 1 mts mts 1172 May 2 15:25 errInt.h +-r--r--r-- 1 mts mts 3158 May 2 15:25 errPosix.c -open-vm-tools-2008.04.14-87182/lib/eventManager: +open-vm-tools-2008.05.02-90473/lib/eventManager: total 28 --r--r--r-- 1 mts mts 1037 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14724 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 7083 Apr 14 13:03 eventManager.c - -open-vm-tools-2008.04.14-87182/lib/file: -total 292 --r--r--r-- 1 mts mts 1213 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15117 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 49677 Apr 14 13:03 file.c --r--r--r-- 1 mts mts 13064 Apr 14 13:03 fileIO.c --r--r--r-- 1 mts mts 55082 Apr 14 13:03 fileIOPosix.c --r--r--r-- 1 mts mts 26927 Apr 14 13:03 fileLockPosix.c --r--r--r-- 1 mts mts 42496 Apr 14 13:03 fileLockPrimitive.c --r--r--r-- 1 mts mts 62027 Apr 14 13:03 filePosix.c - -open-vm-tools-2008.04.14-87182/lib/foundryMsg: +-r--r--r-- 1 mts mts 1037 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14798 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 7083 May 2 15:24 eventManager.c + +open-vm-tools-2008.05.02-90473/lib/file: +total 288 +-r--r--r-- 1 mts mts 1213 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15191 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 49675 May 2 15:25 file.c +-r--r--r-- 1 mts mts 13064 May 2 15:25 fileIO.c +-r--r--r-- 1 mts mts 54842 May 2 15:25 fileIOPosix.c +-r--r--r-- 1 mts mts 26974 May 2 15:25 fileLockPosix.c +-r--r--r-- 1 mts mts 42447 May 2 15:25 fileLockPrimitive.c +-r--r--r-- 1 mts mts 61350 May 2 15:25 filePosix.c + +open-vm-tools-2008.05.02-90473/lib/foundryMsg: total 108 --r--r--r-- 1 mts mts 1183 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15111 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 24798 Apr 14 13:03 foundryMsg.c --r--r--r-- 1 mts mts 42795 Apr 14 13:03 foundryPropertyListCommon.c --r--r--r-- 1 mts mts 6842 Apr 14 13:03 foundryThreads.c --r--r--r-- 1 mts mts 7416 Apr 14 13:03 vixTranslateErrOpenSource.c - -open-vm-tools-2008.04.14-87182/lib/ghIntegrationStub: +-r--r--r-- 1 mts mts 1183 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15185 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 24798 May 2 15:25 foundryMsg.c +-r--r--r-- 1 mts mts 42795 May 2 15:25 foundryPropertyListCommon.c +-r--r--r-- 1 mts mts 6874 May 2 15:25 foundryThreads.c +-r--r--r-- 1 mts mts 7449 May 2 15:25 vixTranslateErrOpenSource.c + +open-vm-tools-2008.05.02-90473/lib/ghIntegrationStub: total 24 --r--r--r-- 1 mts mts 1088 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14862 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 1228 Apr 14 13:03 ghIntegrationStub.c +-r--r--r-- 1 mts mts 1088 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14936 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 1228 May 2 15:25 ghIntegrationStub.c -open-vm-tools-2008.04.14-87182/lib/guestApp: +open-vm-tools-2008.05.02-90473/lib/guestApp: total 76 --r--r--r-- 1 mts mts 1062 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14745 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 45993 Apr 14 13:03 guestApp.c --r--r--r-- 1 mts mts 5720 Apr 14 13:03 guestAppPosix.c - -open-vm-tools-2008.04.14-87182/lib/guestInfo: -total 112 --r--r--r-- 1 mts mts 1181 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14969 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 6480 Apr 14 13:03 guestInfoPerfMonLinux.c --r--r--r-- 1 mts mts 25690 Apr 14 13:03 guestInfoPosix.c --r--r--r-- 1 mts mts 50325 Apr 14 13:03 guestInfoServer.c - -open-vm-tools-2008.04.14-87182/lib/hgfs: +-r--r--r-- 1 mts mts 1062 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14819 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 45993 May 2 15:25 guestApp.c +-r--r--r-- 1 mts mts 5720 May 2 15:25 guestAppPosix.c + +open-vm-tools-2008.05.02-90473/lib/guestInfo: +total 104 +-r--r--r-- 1 mts mts 1181 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15043 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 6480 May 2 15:24 guestInfoPerfMonLinux.c +-r--r--r-- 1 mts mts 25690 May 2 15:24 guestInfoPosix.c +-r--r--r-- 1 mts mts 45285 May 2 15:25 guestInfoServer.c + +open-vm-tools-2008.05.02-90473/lib/hgfs: total 88 --r--r--r-- 1 mts mts 1217 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15216 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 12069 Apr 14 13:03 cpName.c --r--r--r-- 1 mts mts 5787 Apr 14 13:03 cpNameLinux.c --r--r--r-- 1 mts mts 2666 Apr 14 13:03 cpNameLite.c --r--r--r-- 1 mts mts 9115 Apr 14 13:03 cpNameUtil.c --r--r--r-- 1 mts mts 1477 Apr 14 13:03 cpNameUtilInt.h --r--r--r-- 1 mts mts 5613 Apr 14 13:03 cpNameUtilLinux.c --r--r--r-- 1 mts mts 6846 Apr 14 13:03 hgfsUtil.c --r--r--r-- 1 mts mts 8847 Apr 14 13:03 staticEscape.c - -open-vm-tools-2008.04.14-87182/lib/hgfsBd: +-r--r--r-- 1 mts mts 1217 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15290 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 12069 May 2 15:25 cpName.c +-r--r--r-- 1 mts mts 5787 May 2 15:25 cpNameLinux.c +-r--r--r-- 1 mts mts 2666 May 2 15:25 cpNameLite.c +-r--r--r-- 1 mts mts 9115 May 2 15:25 cpNameUtil.c +-r--r--r-- 1 mts mts 1477 May 2 15:25 cpNameUtilInt.h +-r--r--r-- 1 mts mts 5613 May 2 15:25 cpNameUtilLinux.c +-r--r--r-- 1 mts mts 6846 May 2 15:25 hgfsUtil.c +-r--r--r-- 1 mts mts 8847 May 2 15:25 staticEscape.c + +open-vm-tools-2008.05.02-90473/lib/hgfsBd: total 32 --r--r--r-- 1 mts mts 1013 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14580 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8713 Apr 14 13:03 hgfsBd.c - -open-vm-tools-2008.04.14-87182/lib/hgfsServer: -total 324 --r--r--r-- 1 mts mts 1112 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14827 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 158165 Apr 14 13:03 hgfsServer.c --r--r--r-- 1 mts mts 140786 Apr 14 13:03 hgfsServerLinux.c - -open-vm-tools-2008.04.14-87182/lib/hgfsServerManagerGuest: +-r--r--r-- 1 mts mts 1013 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14654 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8713 May 2 15:25 hgfsBd.c + +open-vm-tools-2008.05.02-90473/lib/hgfsServer: +total 328 +-r--r--r-- 1 mts mts 1112 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14901 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 160457 May 2 15:25 hgfsServer.c +-r--r--r-- 1 mts mts 142329 May 2 15:25 hgfsServerLinux.c + +open-vm-tools-2008.05.02-90473/lib/hgfsServerManagerGuest: total 28 --r--r--r-- 1 mts mts 1077 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14972 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 6635 Apr 14 13:03 hgfsServerManagerGuest.c +-r--r--r-- 1 mts mts 1077 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15046 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 6635 May 2 15:25 hgfsServerManagerGuest.c -open-vm-tools-2008.04.14-87182/lib/hgfsServerPolicyGuest: +open-vm-tools-2008.05.02-90473/lib/hgfsServerPolicyGuest: total 36 --r--r--r-- 1 mts mts 1073 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14948 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 13984 Apr 14 13:03 hgfsServerPolicyGuest.c +-r--r--r-- 1 mts mts 1073 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15022 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 13984 May 2 15:25 hgfsServerPolicyGuest.c -open-vm-tools-2008.04.14-87182/lib/impersonate: +open-vm-tools-2008.05.02-90473/lib/impersonate: total 40 --r--r--r-- 1 mts mts 1118 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14854 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8188 Apr 14 13:03 impersonate.c --r--r--r-- 1 mts mts 11902 Apr 14 13:03 impersonatePosix.c - -open-vm-tools-2008.04.14-87182/lib/include: -total 1212 --r--r--r-- 1 mts mts 1935 Apr 14 13:03 SLPv2.h --r--r--r-- 1 mts mts 12728 Apr 14 13:03 SLPv2Private.h --r--r--r-- 1 mts mts 2232 Apr 14 13:03 auth.h --r--r--r-- 1 mts mts 1361 Apr 14 13:03 backdoor.h --r--r--r-- 1 mts mts 1056 Apr 14 13:03 backdoorInt.h --r--r--r-- 1 mts mts 5864 Apr 14 13:03 backdoor_def.h --r--r--r-- 1 mts mts 3567 Apr 14 13:03 backdoor_types.h --r--r--r-- 1 mts mts 1698 Apr 14 13:03 base64.h --r--r--r-- 1 mts mts 1918 Apr 14 13:03 bsd_output.h --r--r--r-- 1 mts mts 3312 Apr 14 13:03 bsd_output_int.h --r--r--r-- 1 mts mts 5971 Apr 14 13:03 bsdfmt.h --r--r--r-- 1 mts mts 272 Apr 14 13:03 buildNumber.h --r--r--r-- 1 mts mts 10265 Apr 14 13:03 circList.h --r--r--r-- 1 mts mts 14823 Apr 14 13:03 codeset.h -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 compat --r--r--r-- 1 mts mts 3889 Apr 14 13:03 conf.h --r--r--r-- 1 mts mts 4810 Apr 14 13:03 config.h --r--r--r-- 1 mts mts 4198 Apr 14 13:03 cpName.h --r--r--r-- 1 mts mts 1822 Apr 14 13:03 cpNameInt.h --r--r--r-- 1 mts mts 1734 Apr 14 13:03 cpNameLite.h --r--r--r-- 1 mts mts 2621 Apr 14 13:03 cpNameUtil.h --r--r--r-- 1 mts mts 3088 Apr 14 13:03 cpuid_info.h --r--r--r-- 1 mts mts 3428 Apr 14 13:03 cryptoError.h --r--r--r-- 1 mts mts 2374 Apr 14 13:03 dbllnklst.h --r--r--r-- 1 mts mts 1304 Apr 14 13:03 debug.h --r--r--r-- 1 mts mts 1114 Apr 14 13:03 deployPkg.h --r--r--r-- 1 mts mts 1125 Apr 14 13:03 deployPkgLog.h --r--r--r-- 1 mts mts 1740 Apr 14 13:03 dictll.h --r--r--r-- 1 mts mts 7079 Apr 14 13:03 dnd.h --r--r--r-- 1 mts mts 1819 Apr 14 13:03 dndInt.h --r--r--r-- 1 mts mts 8051 Apr 14 13:03 dynarray.h --r--r--r-- 1 mts mts 2632 Apr 14 13:03 dynbuf.h --r--r--r-- 1 mts mts 1709 Apr 14 13:03 embed_version.h --r--r--r-- 1 mts mts 2669 Apr 14 13:03 err.h --r--r--r-- 1 mts mts 3856 Apr 14 13:03 escBitvector.h --r--r--r-- 1 mts mts 1922 Apr 14 13:03 escape.h --r--r--r-- 1 mts mts 1539 Apr 14 13:03 eventManager.h --r--r--r-- 1 mts mts 8680 Apr 14 13:03 file.h --r--r--r-- 1 mts mts 12660 Apr 14 13:03 fileIO.h --r--r--r-- 1 mts mts 6186 Apr 14 13:03 fileInt.h --r--r--r-- 1 mts mts 2408 Apr 14 13:03 fileLock.h --r--r--r-- 1 mts mts 3373 Apr 14 13:03 file_extensions.h --r--r--r-- 1 mts mts 2194 Apr 14 13:03 foundryThreads.h --r--r--r-- 1 mts mts 2271 Apr 14 13:03 ghIntegration.h --r--r--r-- 1 mts mts 4841 Apr 14 13:03 guestApp.h --r--r--r-- 1 mts mts 8794 Apr 14 13:03 guestInfo.h --r--r--r-- 1 mts mts 1954 Apr 14 13:03 guestInfoInt.h --r--r--r-- 1 mts mts 1415 Apr 14 13:03 guestInfoServer.h --r--r--r-- 1 mts mts 2867 Apr 14 13:03 guest_msg_def.h --r--r--r-- 1 mts mts 14546 Apr 14 13:03 guest_os.h --r--r--r-- 1 mts mts 2954 Apr 14 13:03 hashTable.h --r--r--r-- 1 mts mts 7032 Apr 14 13:03 hgfs.h --r--r--r-- 1 mts mts 1474 Apr 14 13:03 hgfsBd.h --r--r--r-- 1 mts mts 2559 Apr 14 13:03 hgfsDevLinux.h --r--r--r-- 1 mts mts 40105 Apr 14 13:03 hgfsProto.h --r--r--r-- 1 mts mts 2072 Apr 14 13:03 hgfsServer.h --r--r--r-- 1 mts mts 26256 Apr 14 13:03 hgfsServerInt.h --r--r--r-- 1 mts mts 2212 Apr 14 13:03 hgfsServerManager.h --r--r--r-- 1 mts mts 2786 Apr 14 13:03 hgfsServerPolicy.h --r--r--r-- 1 mts mts 3761 Apr 14 13:03 hgfsUtil.h --r--r--r-- 1 mts mts 1284 Apr 14 13:03 hgfsVirtualDir.h --r--r--r-- 1 mts mts 1279 Apr 14 13:03 hostType.h --r--r--r-- 1 mts mts 3463 Apr 14 13:03 hostinfo.h --r--r--r-- 1 mts mts 1661 Apr 14 13:03 impersonate.h --r--r--r-- 1 mts mts 2031 Apr 14 13:03 impersonateInt.h --r--r--r-- 1 mts mts 4286 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 4636 Apr 14 13:03 iovector.h --r--r--r-- 1 mts mts 1300 Apr 14 13:03 localconfig.h --r--r--r-- 1 mts mts 3878 Apr 14 13:03 log.h --r--r--r-- 1 mts mts 3887 Apr 14 13:03 loglevel_defs.h --r--r--r-- 1 mts mts 5556 Apr 14 13:03 loglevel_user.h --r--r--r-- 1 mts mts 3553 Apr 14 13:03 message.h --r--r--r-- 1 mts mts 1268 Apr 14 13:03 miscSolaris.h --r--r--r-- 1 mts mts 7467 Apr 14 13:03 mntinfo.h --r--r--r-- 1 mts mts 8398 Apr 14 13:03 msg.h --r--r--r-- 1 mts mts 4235 Apr 14 13:03 msgfmt.h --r--r--r-- 1 mts mts 1751 Apr 14 13:03 netutil.h --r--r--r-- 1 mts mts 2584 Apr 14 13:03 panic.h --r--r--r-- 1 mts mts 6230 Apr 14 13:03 posix.h --r--r--r-- 1 mts mts 2023 Apr 14 13:03 preference.h --r--r--r-- 1 mts mts 1393 Apr 14 13:03 printer.h --r--r--r-- 1 mts mts 4812 Apr 14 13:03 procMgr.h --r--r--r-- 1 mts mts 3166 Apr 14 13:03 productState.h --r--r--r-- 1 mts mts 1344 Apr 14 13:03 random.h --r--r--r-- 1 mts mts 1162 Apr 14 13:03 removable_device.h --r--r--r-- 1 mts mts 2333 Apr 14 13:03 rpcin.h --r--r--r-- 1 mts mts 1987 Apr 14 13:03 rpcout.h --r--r--r-- 1 mts mts 2708 Apr 14 13:03 rpcvmx.h --r--r--r-- 1 mts mts 2148 Apr 14 13:03 runDeployPkgInt.h --r--r--r-- 1 mts mts 4882 Apr 14 13:03 safetime.h --r--r--r-- 1 mts mts 3484 Apr 14 13:03 socketMgr.h --r--r--r-- 1 mts mts 2505 Apr 14 13:03 staticEscape.h --r--r--r-- 1 mts mts 2373 Apr 14 13:03 stats_file.h --r--r--r-- 1 mts mts 3403 Apr 14 13:03 stats_user_defs.h --r--r--r-- 1 mts mts 10734 Apr 14 13:03 stats_user_setup.h --r--r--r-- 1 mts mts 6584 Apr 14 13:03 str.h --r--r--r-- 1 mts mts 2142 Apr 14 13:03 strutil.h --r--r--r-- 1 mts mts 3423 Apr 14 13:03 su.h --r--r--r-- 1 mts mts 2061 Apr 14 13:03 syncDriver.h --r--r--r-- 1 mts mts 1564 Apr 14 13:03 syncDriverIoc.h --r--r--r-- 1 mts mts 2250 Apr 14 13:03 syncEvent.h --r--r--r-- 1 mts mts 1979 Apr 14 13:03 syncMutex.h --r--r--r-- 1 mts mts 3415 Apr 14 13:03 syncWaitQ.h --r--r--r-- 1 mts mts 2797 Apr 14 13:03 system.h --r--r--r-- 1 mts mts 3240 Apr 14 13:03 timeutil.h --r--r--r-- 1 mts mts 1751 Apr 14 13:03 toolsDeployPkg.h --r--r--r-- 1 mts mts 2390 Apr 14 13:03 toolsLogger.h --r--r--r-- 1 mts mts 1528 Apr 14 13:03 toolsLoggerInt.h --r--r--r-- 1 mts mts 1578 Apr 14 13:03 unicode.h --r--r--r-- 1 mts mts 11589 Apr 14 13:03 unicodeBase.h --r--r--r-- 1 mts mts 1600 Apr 14 13:03 unicodeInt.h --r--r--r-- 1 mts mts 20105 Apr 14 13:03 unicodeOperations.h --r--r--r-- 1 mts mts 1853 Apr 14 13:03 unicodeTransforms.h --r--r--r-- 1 mts mts 4787 Apr 14 13:03 unicodeTypes.h --r--r--r-- 1 mts mts 2465 Apr 14 13:03 unity.h --r--r--r-- 1 mts mts 15229 Apr 14 13:03 util.h --r--r--r-- 1 mts mts 2994 Apr 14 13:03 util_shared.h --r--r--r-- 1 mts mts 1832 Apr 14 13:03 uuid.h --r--r--r-- 1 mts mts 38245 Apr 14 13:03 vix.h --r--r--r-- 1 mts mts 60295 Apr 14 13:03 vixCommands.h --r--r--r-- 1 mts mts 14219 Apr 14 13:03 vixOpenSource.h --r--r--r-- 1 mts mts 3995 Apr 14 13:03 vixTools.h --r--r--r-- 1 mts mts 6777 Apr 14 13:03 vmBackup.h --r--r--r-- 1 mts mts 14163 Apr 14 13:03 vmGuestLib.h --r--r--r-- 1 mts mts 1092 Apr 14 13:03 vmSessionId.h --r--r--r-- 1 mts mts 4092 Apr 14 13:03 vm_app.h --r--r--r-- 1 mts mts 9976 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 54313 Apr 14 13:03 vm_atomic.h --r--r--r-- 1 mts mts 17721 Apr 14 13:03 vm_basic_asm.h --r--r--r-- 1 mts mts 16103 Apr 14 13:03 vm_basic_asm_x86.h --r--r--r-- 1 mts mts 8869 Apr 14 13:03 vm_basic_asm_x86_64.h --r--r--r-- 1 mts mts 12206 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 21744 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 2430 Apr 14 13:03 vm_ctype.h --r--r--r-- 1 mts mts 2118 Apr 14 13:03 vm_legal.h --r--r--r-- 1 mts mts 17935 Apr 14 13:03 vm_product.h --r--r--r-- 1 mts mts 29426 Apr 14 13:03 vm_tools_version.h --r--r--r-- 1 mts mts 15783 Apr 14 13:03 vm_version.h --r--r--r-- 1 mts mts 3338 Apr 14 13:03 vmbackup_def.h --r--r--r-- 1 mts mts 4284 Apr 14 13:03 vmblock.h --r--r--r-- 1 mts mts 1275 Apr 14 13:03 vmcheck.h --r--r--r-- 1 mts mts 1270 Apr 14 13:03 vmsignal.h --r--r--r-- 1 mts mts 1336 Apr 14 13:03 vmstdio.h --r--r--r-- 1 mts mts 1913 Apr 14 13:03 vmware.h --r--r--r-- 1 mts mts 1340 Apr 14 13:03 vmware_pack_begin.h --r--r--r-- 1 mts mts 1360 Apr 14 13:03 vmware_pack_end.h --r--r--r-- 1 mts mts 1980 Apr 14 13:03 vmware_pack_init.h --r--r--r-- 1 mts mts 7863 Apr 14 13:03 win32util.h --r--r--r-- 1 mts mts 2751 Apr 14 13:03 wiper.h --r--r--r-- 1 mts mts 37619 Apr 14 13:03 x86cpuid.h - -open-vm-tools-2008.04.14-87182/lib/include/compat: +-r--r--r-- 1 mts mts 1118 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14928 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8188 May 2 15:25 impersonate.c +-r--r--r-- 1 mts mts 11956 May 2 15:25 impersonatePosix.c + +open-vm-tools-2008.05.02-90473/lib/include: +total 1224 +-r--r--r-- 1 mts mts 1935 May 2 15:24 SLPv2.h +-r--r--r-- 1 mts mts 12728 May 2 15:24 SLPv2Private.h +-r--r--r-- 1 mts mts 2232 May 2 15:24 auth.h +-r--r--r-- 1 mts mts 1361 May 2 15:24 backdoor.h +-r--r--r-- 1 mts mts 1056 May 2 15:24 backdoorInt.h +-r--r--r-- 1 mts mts 5907 May 2 15:24 backdoor_def.h +-r--r--r-- 1 mts mts 3567 May 2 15:24 backdoor_types.h +-r--r--r-- 1 mts mts 1698 May 2 15:24 base64.h +-r--r--r-- 1 mts mts 1918 May 2 15:24 bsd_output.h +-r--r--r-- 1 mts mts 3312 May 2 15:24 bsd_output_int.h +-r--r--r-- 1 mts mts 5975 May 2 15:24 bsdfmt.h +-r--r--r-- 1 mts mts 272 May 2 15:24 buildNumber.h +-r--r--r-- 1 mts mts 10265 May 2 15:24 circList.h +-r--r--r-- 1 mts mts 16277 May 2 15:24 codeset.h +drwxr-xr-x 2 mts mts 4096 May 2 15:24 compat +-r--r--r-- 1 mts mts 3889 May 2 15:24 conf.h +-r--r--r-- 1 mts mts 4810 May 2 15:24 config.h +-r--r--r-- 1 mts mts 4198 May 2 15:24 cpName.h +-r--r--r-- 1 mts mts 1822 May 2 15:24 cpNameInt.h +-r--r--r-- 1 mts mts 1734 May 2 15:24 cpNameLite.h +-r--r--r-- 1 mts mts 2621 May 2 15:24 cpNameUtil.h +-r--r--r-- 1 mts mts 3088 May 2 15:24 cpuid_info.h +-r--r--r-- 1 mts mts 3428 May 2 15:24 cryptoError.h +-r--r--r-- 1 mts mts 2374 May 2 15:24 dbllnklst.h +-r--r--r-- 1 mts mts 1304 May 2 15:24 debug.h +-r--r--r-- 1 mts mts 1114 May 2 15:24 deployPkg.h +-r--r--r-- 1 mts mts 1125 May 2 15:24 deployPkgLog.h +-r--r--r-- 1 mts mts 1793 May 2 15:24 dictll.h +-r--r--r-- 1 mts mts 7079 May 2 15:24 dnd.h +-r--r--r-- 1 mts mts 1819 May 2 15:24 dndInt.h +-r--r--r-- 1 mts mts 8051 May 2 15:24 dynarray.h +-r--r--r-- 1 mts mts 2632 May 2 15:24 dynbuf.h +-r--r--r-- 1 mts mts 1709 May 2 15:24 embed_version.h +-r--r--r-- 1 mts mts 2893 May 2 15:24 err.h +-r--r--r-- 1 mts mts 3856 May 2 15:24 escBitvector.h +-r--r--r-- 1 mts mts 1922 May 2 15:24 escape.h +-r--r--r-- 1 mts mts 1539 May 2 15:24 eventManager.h +-r--r--r-- 1 mts mts 8680 May 2 15:24 file.h +-r--r--r-- 1 mts mts 12660 May 2 15:24 fileIO.h +-r--r--r-- 1 mts mts 6186 May 2 15:24 fileInt.h +-r--r--r-- 1 mts mts 2408 May 2 15:24 fileLock.h +-r--r--r-- 1 mts mts 3373 May 2 15:24 file_extensions.h +-r--r--r-- 1 mts mts 2194 May 2 15:24 foundryThreads.h +-r--r--r-- 1 mts mts 2271 May 2 15:24 ghIntegration.h +-r--r--r-- 1 mts mts 5453 May 2 15:24 guestApp.h +-r--r--r-- 1 mts mts 8794 May 2 15:24 guestInfo.h +-r--r--r-- 1 mts mts 1954 May 2 15:24 guestInfoInt.h +-r--r--r-- 1 mts mts 1415 May 2 15:24 guestInfoServer.h +-r--r--r-- 1 mts mts 2867 May 2 15:24 guest_msg_def.h +-r--r--r-- 1 mts mts 14546 May 2 15:24 guest_os.h +-r--r--r-- 1 mts mts 2954 May 2 15:24 hashTable.h +-r--r--r-- 1 mts mts 7032 May 2 15:24 hgfs.h +-r--r--r-- 1 mts mts 1474 May 2 15:24 hgfsBd.h +-r--r--r-- 1 mts mts 2559 May 2 15:24 hgfsDevLinux.h +-r--r--r-- 1 mts mts 39287 May 2 15:24 hgfsProto.h +-r--r--r-- 1 mts mts 2072 May 2 15:24 hgfsServer.h +-r--r--r-- 1 mts mts 26266 May 2 15:24 hgfsServerInt.h +-r--r--r-- 1 mts mts 2212 May 2 15:24 hgfsServerManager.h +-r--r--r-- 1 mts mts 2786 May 2 15:24 hgfsServerPolicy.h +-r--r--r-- 1 mts mts 4185 May 2 15:24 hgfsUtil.h +-r--r--r-- 1 mts mts 1284 May 2 15:24 hgfsVirtualDir.h +-r--r--r-- 1 mts mts 1279 May 2 15:24 hostType.h +-r--r--r-- 1 mts mts 3463 May 2 15:24 hostinfo.h +-r--r--r-- 1 mts mts 1661 May 2 15:24 impersonate.h +-r--r--r-- 1 mts mts 2031 May 2 15:24 impersonateInt.h +-r--r--r-- 1 mts mts 4286 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 4636 May 2 15:24 iovector.h +-r--r--r-- 1 mts mts 1300 May 2 15:24 localconfig.h +-r--r--r-- 1 mts mts 3878 May 2 15:24 log.h +-r--r--r-- 1 mts mts 3887 May 2 15:24 loglevel_defs.h +-r--r--r-- 1 mts mts 5616 May 2 15:24 loglevel_user.h +-r--r--r-- 1 mts mts 3553 May 2 15:24 message.h +-r--r--r-- 1 mts mts 1268 May 2 15:24 miscSolaris.h +-r--r--r-- 1 mts mts 7510 May 2 15:24 mntinfo.h +-r--r--r-- 1 mts mts 8502 May 2 15:24 msg.h +-r--r--r-- 1 mts mts 5195 May 2 15:24 msgfmt.h +-r--r--r-- 1 mts mts 1751 May 2 15:24 netutil.h +-r--r--r-- 1 mts mts 2584 May 2 15:24 panic.h +-r--r--r-- 1 mts mts 7550 May 2 15:24 posix.h +-r--r--r-- 1 mts mts 2023 May 2 15:24 preference.h +-r--r--r-- 1 mts mts 1393 May 2 15:24 printer.h +-r--r--r-- 1 mts mts 4812 May 2 15:24 procMgr.h +-r--r--r-- 1 mts mts 3166 May 2 15:24 productState.h +-r--r--r-- 1 mts mts 1344 May 2 15:24 random.h +-r--r--r-- 1 mts mts 1162 May 2 15:24 removable_device.h +-r--r--r-- 1 mts mts 2333 May 2 15:24 rpcin.h +-r--r--r-- 1 mts mts 1987 May 2 15:24 rpcout.h +-r--r--r-- 1 mts mts 2708 May 2 15:24 rpcvmx.h +-r--r--r-- 1 mts mts 2148 May 2 15:24 runDeployPkgInt.h +-r--r--r-- 1 mts mts 4882 May 2 15:24 safetime.h +-r--r--r-- 1 mts mts 3484 May 2 15:24 socketMgr.h +-r--r--r-- 1 mts mts 2505 May 2 15:24 staticEscape.h +-r--r--r-- 1 mts mts 2373 May 2 15:24 stats_file.h +-r--r--r-- 1 mts mts 3403 May 2 15:24 stats_user_defs.h +-r--r--r-- 1 mts mts 10734 May 2 15:24 stats_user_setup.h +-r--r--r-- 1 mts mts 7043 May 2 15:24 str.h +-r--r--r-- 1 mts mts 2142 May 2 15:24 strutil.h +-r--r--r-- 1 mts mts 3423 May 2 15:24 su.h +-r--r--r-- 1 mts mts 2061 May 2 15:24 syncDriver.h +-r--r--r-- 1 mts mts 1564 May 2 15:24 syncDriverIoc.h +-r--r--r-- 1 mts mts 2250 May 2 15:24 syncEvent.h +-r--r--r-- 1 mts mts 1938 May 2 15:24 syncMutex.h +-r--r--r-- 1 mts mts 3372 May 2 15:24 syncWaitQ.h +-r--r--r-- 1 mts mts 2797 May 2 15:24 system.h +-r--r--r-- 1 mts mts 3240 May 2 15:24 timeutil.h +-r--r--r-- 1 mts mts 1751 May 2 15:24 toolsDeployPkg.h +-r--r--r-- 1 mts mts 2390 May 2 15:24 toolsLogger.h +-r--r--r-- 1 mts mts 1528 May 2 15:24 toolsLoggerInt.h +-r--r--r-- 1 mts mts 1578 May 2 15:24 unicode.h +-r--r--r-- 1 mts mts 10631 May 2 15:24 unicodeBase.h +-r--r--r-- 1 mts mts 2976 May 2 15:24 unicodeICU.h +-r--r--r-- 1 mts mts 1911 May 2 15:24 unicodeInt.h +-r--r--r-- 1 mts mts 20105 May 2 15:24 unicodeOperations.h +-r--r--r-- 1 mts mts 1853 May 2 15:24 unicodeTransforms.h +-r--r--r-- 1 mts mts 5767 May 2 15:24 unicodeTypes.h +-r--r--r-- 1 mts mts 2465 May 2 15:24 unity.h +-r--r--r-- 1 mts mts 16274 May 2 15:24 util.h +-r--r--r-- 1 mts mts 2994 May 2 15:24 util_shared.h +-r--r--r-- 1 mts mts 1999 May 2 15:24 uuid.h +-r--r--r-- 1 mts mts 38679 May 2 15:24 vix.h +-r--r--r-- 1 mts mts 60614 May 2 15:24 vixCommands.h +-r--r--r-- 1 mts mts 14575 May 2 15:24 vixOpenSource.h +-r--r--r-- 1 mts mts 4132 May 2 15:24 vixTools.h +-r--r--r-- 1 mts mts 6676 May 2 15:24 vmBackup.h +-r--r--r-- 1 mts mts 14163 May 2 15:24 vmGuestLib.h +-r--r--r-- 1 mts mts 1092 May 2 15:24 vmSessionId.h +-r--r--r-- 1 mts mts 4092 May 2 15:24 vm_app.h +-r--r--r-- 1 mts mts 9976 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 54313 May 2 15:24 vm_atomic.h +-r--r--r-- 1 mts mts 17721 May 2 15:24 vm_basic_asm.h +-r--r--r-- 1 mts mts 16137 May 2 15:24 vm_basic_asm_x86.h +-r--r--r-- 1 mts mts 8927 May 2 15:24 vm_basic_asm_x86_64.h +-r--r--r-- 1 mts mts 12206 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 21765 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 2430 May 2 15:24 vm_ctype.h +-r--r--r-- 1 mts mts 2118 May 2 15:24 vm_legal.h +-r--r--r-- 1 mts mts 17935 May 2 15:24 vm_product.h +-r--r--r-- 1 mts mts 29860 May 2 15:24 vm_tools_version.h +-r--r--r-- 1 mts mts 15875 May 2 15:24 vm_version.h +-r--r--r-- 1 mts mts 3338 May 2 15:24 vmbackup_def.h +-r--r--r-- 1 mts mts 4284 May 2 15:24 vmblock.h +-r--r--r-- 1 mts mts 1275 May 2 15:24 vmcheck.h +-r--r--r-- 1 mts mts 1270 May 2 15:24 vmsignal.h +-r--r--r-- 1 mts mts 1336 May 2 15:24 vmstdio.h +-r--r--r-- 1 mts mts 1913 May 2 15:24 vmware.h +-r--r--r-- 1 mts mts 1340 May 2 15:24 vmware_pack_begin.h +-r--r--r-- 1 mts mts 1360 May 2 15:24 vmware_pack_end.h +-r--r--r-- 1 mts mts 1980 May 2 15:24 vmware_pack_init.h +-r--r--r-- 1 mts mts 7863 May 2 15:24 win32util.h +-r--r--r-- 1 mts mts 2751 May 2 15:24 wiper.h +-r--r--r-- 1 mts mts 37619 May 2 15:24 x86cpuid.h + +open-vm-tools-2008.05.02-90473/lib/include/compat: total 4 --r--r--r-- 1 mts mts 1906 Apr 14 13:03 compat_stdarg.h +-r--r--r-- 1 mts mts 1906 May 2 15:24 compat_stdarg.h -open-vm-tools-2008.04.14-87182/lib/message: +open-vm-tools-2008.05.02-90473/lib/message: total 68 --r--r--r-- 1 mts mts 1126 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18841 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8278 Apr 14 13:03 message.c --r--r--r-- 1 mts mts 17289 Apr 14 13:03 messageBackdoor.c --r--r--r-- 1 mts mts 4751 Apr 14 13:03 messageStub.c -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 shared - -open-vm-tools-2008.04.14-87182/lib/message/shared: +-r--r--r-- 1 mts mts 1126 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 18915 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8278 May 2 15:25 message.c +-r--r--r-- 1 mts mts 17289 May 2 15:25 messageBackdoor.c +-r--r--r-- 1 mts mts 4751 May 2 15:25 messageStub.c +drwxr-xr-x 2 mts mts 4096 May 2 15:25 shared + +open-vm-tools-2008.05.02-90473/lib/message/shared: total 24 --r--r--r-- 1 mts mts 1113 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 17773 Apr 14 13:03 Makefile.in - -open-vm-tools-2008.04.14-87182/lib/misc: -total 368 --r--r--r-- 1 mts mts 1681 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 20539 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 2146 Apr 14 13:03 atomic.c --r--r--r-- 1 mts mts 15371 Apr 14 13:03 base64.c --r--r--r-- 1 mts mts 48383 Apr 14 13:03 codeset.c --r--r--r-- 1 mts mts 8241 Apr 14 13:03 dbllnklst.c --r--r--r-- 1 mts mts 6500 Apr 14 13:03 dynarray.c --r--r--r-- 1 mts mts 9633 Apr 14 13:03 dynbuf.c --r--r--r-- 1 mts mts 14569 Apr 14 13:03 escape.c --r--r--r-- 1 mts mts 19809 Apr 14 13:03 hashTable.c --r--r--r-- 1 mts mts 5943 Apr 14 13:03 hostinfo_misc.c --r--r--r-- 1 mts mts 6141 Apr 14 13:03 hostname.c --r--r--r-- 1 mts mts 22612 Apr 14 13:03 idLinux.c --r--r--r-- 1 mts mts 24760 Apr 14 13:03 iovector.c --r--r--r-- 1 mts mts 14910 Apr 14 13:03 machineID.c --r--r--r-- 1 mts mts 2017 Apr 14 13:03 miscSolaris.c --r--r--r-- 1 mts mts 1701 Apr 14 13:03 posixDlopen.c --r--r--r-- 1 mts mts 35625 Apr 14 13:03 posixPosix.c --r--r--r-- 1 mts mts 14322 Apr 14 13:03 posixWin32.c --r--r--r-- 1 mts mts 5943 Apr 14 13:03 random.c -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 shared --r--r--r-- 1 mts mts 25871 Apr 14 13:03 timeutil.c --r--r--r-- 1 mts mts 9503 Apr 14 13:03 util_misc.c --r--r--r-- 1 mts mts 6627 Apr 14 13:03 vmstdio.c - -open-vm-tools-2008.04.14-87182/lib/misc/shared: -total 36 --r--r--r-- 1 mts mts 1659 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 32303 Apr 14 13:03 Makefile.in +-r--r--r-- 1 mts mts 1113 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 17847 May 2 15:25 Makefile.in + +open-vm-tools-2008.05.02-90473/lib/misc: +total 436 +-r--r--r-- 1 mts mts 1732 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 21104 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 2146 May 2 15:25 atomic.c +-r--r--r-- 1 mts mts 15371 May 2 15:25 base64.c +-r--r--r-- 1 mts mts 35741 May 2 15:25 codeset.c +-r--r--r-- 1 mts mts 54827 May 2 15:25 codesetOld.c +-r--r--r-- 1 mts mts 6339 May 2 15:25 codesetOld.h +-r--r--r-- 1 mts mts 8241 May 2 15:25 dbllnklst.c +-r--r--r-- 1 mts mts 6500 May 2 15:25 dynarray.c +-r--r--r-- 1 mts mts 9633 May 2 15:25 dynbuf.c +-r--r--r-- 1 mts mts 14569 May 2 15:25 escape.c +-r--r--r-- 1 mts mts 19809 May 2 15:25 hashTable.c +-r--r--r-- 1 mts mts 5943 May 2 15:25 hostinfo_misc.c +-r--r--r-- 1 mts mts 6141 May 2 15:25 hostname.c +-r--r--r-- 1 mts mts 22612 May 2 15:25 idLinux.c +-r--r--r-- 1 mts mts 24760 May 2 15:25 iovector.c +-r--r--r-- 1 mts mts 14910 May 2 15:25 machineID.c +-r--r--r-- 1 mts mts 2017 May 2 15:25 miscSolaris.c +-r--r--r-- 1 mts mts 1701 May 2 15:25 posixDlopen.c +-r--r--r-- 1 mts mts 48102 May 2 15:25 posixPosix.c +-r--r--r-- 1 mts mts 14322 May 2 15:25 posixWin32.c +-r--r--r-- 1 mts mts 5943 May 2 15:25 random.c +drwxr-xr-x 2 mts mts 4096 May 2 15:25 shared +-r--r--r-- 1 mts mts 25871 May 2 15:25 timeutil.c +-r--r--r-- 1 mts mts 9675 May 2 15:25 util_misc.c +-r--r--r-- 1 mts mts 6627 May 2 15:25 vmstdio.c + +open-vm-tools-2008.05.02-90473/lib/misc/shared: +total 40 +-r--r--r-- 1 mts mts 1714 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 33800 May 2 15:25 Makefile.in -open-vm-tools-2008.04.14-87182/lib/netUtil: +open-vm-tools-2008.05.02-90473/lib/netUtil: total 28 --r--r--r-- 1 mts mts 1022 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14619 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 7417 Apr 14 13:03 netUtilLinux.c +-r--r--r-- 1 mts mts 1022 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14693 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 7417 May 2 15:25 netUtilLinux.c -open-vm-tools-2008.04.14-87182/lib/panic: +open-vm-tools-2008.05.02-90473/lib/panic: total 36 --r--r--r-- 1 mts mts 1009 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14556 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 12945 Apr 14 13:03 panic.c +-r--r--r-- 1 mts mts 1009 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14630 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 12986 May 2 15:25 panic.c -open-vm-tools-2008.04.14-87182/lib/panicDefault: +open-vm-tools-2008.05.02-90473/lib/panicDefault: total 24 --r--r--r-- 1 mts mts 1030 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14703 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 1488 Apr 14 13:03 panic.c +-r--r--r-- 1 mts mts 1030 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14777 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 1488 May 2 15:25 panic.c -open-vm-tools-2008.04.14-87182/lib/printer: +open-vm-tools-2008.05.02-90473/lib/printer: total 32 --r--r--r-- 1 mts mts 1017 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14604 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 9666 Apr 14 13:03 printer.c +-r--r--r-- 1 mts mts 1017 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14678 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 9721 May 2 15:25 printer.c -open-vm-tools-2008.04.14-87182/lib/procMgr: +open-vm-tools-2008.05.02-90473/lib/procMgr: total 56 --r--r--r-- 1 mts mts 1057 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14641 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 36619 Apr 14 13:03 procMgrPosix.c +-r--r--r-- 1 mts mts 1057 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14715 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 36619 May 2 15:25 procMgrPosix.c -open-vm-tools-2008.04.14-87182/lib/rpcIn: +open-vm-tools-2008.05.02-90473/lib/rpcIn: total 40 --r--r--r-- 1 mts mts 1009 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14556 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 17356 Apr 14 13:03 rpcin.c +-r--r--r-- 1 mts mts 1009 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14630 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 17356 May 2 15:25 rpcin.c -open-vm-tools-2008.04.14-87182/lib/rpcOut: +open-vm-tools-2008.05.02-90473/lib/rpcOut: total 40 --r--r--r-- 1 mts mts 1042 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18580 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 11694 Apr 14 13:03 rpcout.c -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 shared +-r--r--r-- 1 mts mts 1042 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 18654 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 11694 May 2 15:25 rpcout.c +drwxr-xr-x 2 mts mts 4096 May 2 15:25 shared -open-vm-tools-2008.04.14-87182/lib/rpcOut/shared: +open-vm-tools-2008.05.02-90473/lib/rpcOut/shared: total 20 --r--r--r-- 1 mts mts 1021 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15602 Apr 14 13:03 Makefile.in +-r--r--r-- 1 mts mts 1021 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15676 May 2 15:25 Makefile.in -open-vm-tools-2008.04.14-87182/lib/rpcVmx: +open-vm-tools-2008.05.02-90473/lib/rpcVmx: total 28 --r--r--r-- 1 mts mts 1013 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14580 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 7278 Apr 14 13:03 rpcvmx.c +-r--r--r-- 1 mts mts 1013 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14654 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 7278 May 2 15:25 rpcvmx.c -open-vm-tools-2008.04.14-87182/lib/socketMgr: +open-vm-tools-2008.05.02-90473/lib/socketMgr: total 64 --r--r--r-- 1 mts mts 1025 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14652 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 41905 Apr 14 13:03 socketMgr.c +-r--r--r-- 1 mts mts 1025 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14726 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 41905 May 2 15:25 socketMgr.c -open-vm-tools-2008.04.14-87182/lib/strUtil: +open-vm-tools-2008.05.02-90473/lib/strUtil: total 40 --r--r--r-- 1 mts mts 1017 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14604 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 16861 Apr 14 13:03 strutil.c +-r--r--r-- 1 mts mts 1017 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14678 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 16861 May 2 15:25 strutil.c -open-vm-tools-2008.04.14-87182/lib/string: -total 176 --r--r--r-- 1 mts mts 1194 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18963 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8168 Apr 14 13:03 bsd_output_shared.c --r--r--r-- 1 mts mts 48924 Apr 14 13:03 bsd_vsnprintf.c --r--r--r-- 1 mts mts 50300 Apr 14 13:03 bsd_vsnwprintf.c -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 shared --r--r--r-- 1 mts mts 32823 Apr 14 13:03 str.c - -open-vm-tools-2008.04.14-87182/lib/string/shared: +open-vm-tools-2008.05.02-90473/lib/string: +total 212 +-r--r--r-- 1 mts mts 1230 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 19148 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8168 May 2 15:25 bsd_output_shared.c +-r--r--r-- 1 mts mts 50068 May 2 15:25 bsd_vsnprintf.c +-r--r--r-- 1 mts mts 51480 May 2 15:25 bsd_vsnwprintf.c +-r--r--r-- 1 mts mts 19245 May 2 15:25 convertutf.c +-r--r--r-- 1 mts mts 6119 May 2 15:25 convertutf.h +drwxr-xr-x 2 mts mts 4096 May 2 15:25 shared +-r--r--r-- 1 mts mts 32823 May 2 15:25 str.c + +open-vm-tools-2008.05.02-90473/lib/string/shared: total 24 --r--r--r-- 1 mts mts 1185 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18860 Apr 14 13:03 Makefile.in +-r--r--r-- 1 mts mts 1225 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 19949 May 2 15:25 Makefile.in -open-vm-tools-2008.04.14-87182/lib/sync: +open-vm-tools-2008.05.02-90473/lib/sync: total 60 --r--r--r-- 1 mts mts 1077 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18667 Apr 14 13:03 Makefile.in -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 shared --r--r--r-- 1 mts mts 6533 Apr 14 13:03 syncMutex.c --r--r--r-- 1 mts mts 21340 Apr 14 13:03 syncWaitQPosix.c +-r--r--r-- 1 mts mts 1077 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 18741 May 2 15:25 Makefile.in +drwxr-xr-x 2 mts mts 4096 May 2 15:25 shared +-r--r--r-- 1 mts mts 6533 May 2 15:25 syncMutex.c +-r--r--r-- 1 mts mts 21469 May 2 15:25 syncWaitQPosix.c -open-vm-tools-2008.04.14-87182/lib/sync/shared: +open-vm-tools-2008.05.02-90473/lib/sync/shared: total 24 --r--r--r-- 1 mts mts 1060 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 16704 Apr 14 13:03 Makefile.in +-r--r--r-- 1 mts mts 1060 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 16778 May 2 15:25 Makefile.in -open-vm-tools-2008.04.14-87182/lib/syncDriver: +open-vm-tools-2008.05.02-90473/lib/syncDriver: total 32 --r--r--r-- 1 mts mts 1034 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14691 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 8740 Apr 14 13:03 syncDriverPosix.c +-r--r--r-- 1 mts mts 1034 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14765 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 8740 May 2 15:25 syncDriverPosix.c -open-vm-tools-2008.04.14-87182/lib/system: +open-vm-tools-2008.05.02-90473/lib/system: total 32 --r--r--r-- 1 mts mts 995 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14595 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 9268 Apr 14 13:03 systemLinux.c +-r--r--r-- 1 mts mts 995 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14669 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 9268 May 2 15:25 systemLinux.c -open-vm-tools-2008.04.14-87182/lib/toolsLogger: +open-vm-tools-2008.05.02-90473/lib/toolsLogger: total 36 --r--r--r-- 1 mts mts 1028 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14685 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 15172 Apr 14 13:03 logger.c +-r--r--r-- 1 mts mts 1028 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14759 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 15172 May 2 15:25 logger.c -open-vm-tools-2008.04.14-87182/lib/unicode: -total 212 --r--r--r-- 1 mts mts 1304 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15462 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 11879 Apr 14 13:03 unicodeCommon.c --r--r--r-- 1 mts mts 1600 Apr 14 13:03 unicodeInt.h --r--r--r-- 1 mts mts 19786 Apr 14 13:03 unicodeSimpleBase.c --r--r--r-- 1 mts mts 34559 Apr 14 13:03 unicodeSimpleCaseFolding.c --r--r--r-- 1 mts mts 15794 Apr 14 13:03 unicodeSimpleOperations.c --r--r--r-- 1 mts mts 18115 Apr 14 13:03 unicodeSimpleTransforms.c --r--r--r-- 1 mts mts 73309 Apr 14 13:03 unicodeSimpleTypes.c --r--r--r-- 1 mts mts 5027 Apr 14 13:03 unicodeStatic.c - -open-vm-tools-2008.04.14-87182/lib/unityStub: +open-vm-tools-2008.05.02-90473/lib/unicode: +total 232 +-r--r--r-- 1 mts mts 1358 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15952 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 11673 May 2 15:25 unicodeCommon.c +-r--r--r-- 1 mts mts 13870 May 2 15:25 unicodeICU.c +-r--r--r-- 1 mts mts 23227 May 2 15:25 unicodeSimpleBase.c +-r--r--r-- 1 mts mts 34559 May 2 15:25 unicodeSimpleCaseFolding.c +-r--r--r-- 1 mts mts 15794 May 2 15:25 unicodeSimpleOperations.c +-r--r--r-- 1 mts mts 18115 May 2 15:25 unicodeSimpleTransforms.c +-r--r--r-- 1 mts mts 74267 May 2 15:25 unicodeSimpleTypes.c +-r--r--r-- 1 mts mts 5087 May 2 15:25 unicodeStatic.c + +open-vm-tools-2008.05.02-90473/lib/unityStub: total 24 --r--r--r-- 1 mts mts 1056 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14670 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 1637 Apr 14 13:03 unityStub.c +-r--r--r-- 1 mts mts 1056 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14744 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 1637 May 2 15:25 unityStub.c -open-vm-tools-2008.04.14-87182/lib/user: +open-vm-tools-2008.05.02-90473/lib/user: total 132 --r--r--r-- 1 mts mts 1138 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14877 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 9683 Apr 14 13:03 hostinfo.c --r--r--r-- 1 mts mts 38576 Apr 14 13:03 hostinfoPosix.c --r--r--r-- 1 mts mts 40325 Apr 14 13:03 util.c --r--r--r-- 1 mts mts 18749 Apr 14 13:03 utilPosix.c - -open-vm-tools-2008.04.14-87182/lib/vixTools: +-r--r--r-- 1 mts mts 1138 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14951 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 9683 May 2 15:25 hostinfo.c +-r--r--r-- 1 mts mts 38636 May 2 15:25 hostinfoPosix.c +-r--r--r-- 1 mts mts 39710 May 2 15:25 util.c +-r--r--r-- 1 mts mts 18792 May 2 15:25 utilPosix.c + +open-vm-tools-2008.05.02-90473/lib/vixTools: total 136 --r--r--r-- 1 mts mts 1021 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14628 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 112046 Apr 14 13:03 vixTools.c +-r--r--r-- 1 mts mts 1021 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14702 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 112022 May 2 15:25 vixTools.c -open-vm-tools-2008.04.14-87182/lib/vmBackupLib: +open-vm-tools-2008.05.02-90473/lib/vmBackupLib: total 76 --r--r--r-- 1 mts mts 1118 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14928 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 12378 Apr 14 13:03 scriptOps.c --r--r--r-- 1 mts mts 22182 Apr 14 13:03 stateMachine.c --r--r--r-- 1 mts mts 9036 Apr 14 13:03 syncDriverOps.c --r--r--r-- 1 mts mts 1264 Apr 14 13:03 vmBackupInt.h - -open-vm-tools-2008.04.14-87182/lib/vmCheck: +-r--r--r-- 1 mts mts 1118 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 15002 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 12390 May 2 15:25 scriptOps.c +-r--r--r-- 1 mts mts 20512 May 2 15:25 stateMachine.c +-r--r--r-- 1 mts mts 9036 May 2 15:25 syncDriverOps.c +-r--r--r-- 1 mts mts 1264 May 2 15:25 vmBackupInt.h + +open-vm-tools-2008.05.02-90473/lib/vmCheck: total 28 --r--r--r-- 1 mts mts 1017 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14604 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 5337 Apr 14 13:03 vmcheck.c +-r--r--r-- 1 mts mts 1017 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14678 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 5337 May 2 15:25 vmcheck.c -open-vm-tools-2008.04.14-87182/lib/vmSignal: +open-vm-tools-2008.05.02-90473/lib/vmSignal: total 24 --r--r--r-- 1 mts mts 1021 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14628 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 3080 Apr 14 13:03 vmsignal.c +-r--r--r-- 1 mts mts 1021 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14702 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 3080 May 2 15:25 vmsignal.c -open-vm-tools-2008.04.14-87182/lib/wiper: +open-vm-tools-2008.05.02-90473/lib/wiper: total 44 --r--r--r-- 1 mts mts 1014 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 14571 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 24431 Apr 14 13:03 wiperPosix.c +-r--r--r-- 1 mts mts 1014 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 14645 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 24462 May 2 15:25 wiperPosix.c -open-vm-tools-2008.04.14-87182/libguestlib: +open-vm-tools-2008.05.02-90473/libguestlib: total 100 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1799 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 17141 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 1413 Apr 14 13:03 stubs.c --r--r--r-- 1 mts mts 26218 Apr 14 13:03 vmGuestLib.c --r--r--r-- 1 mts mts 4228 Apr 14 13:03 vmGuestLibInt.h --r--r--r-- 1 mts mts 2436 Apr 14 13:03 vmGuestLibPanic.c --r--r--r-- 1 mts mts 1547 Apr 14 13:03 vmguestlib_version.h - -open-vm-tools-2008.04.14-87182/modules: +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 1799 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 17215 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 1413 May 2 15:25 stubs.c +-r--r--r-- 1 mts mts 26218 May 2 15:25 vmGuestLib.c +-r--r--r-- 1 mts mts 4228 May 2 15:25 vmGuestLibInt.h +-r--r--r-- 1 mts mts 2436 May 2 15:25 vmGuestLibPanic.c +-r--r--r-- 1 mts mts 1547 May 2 15:25 vmguestlib_version.h + +open-vm-tools-2008.05.02-90473/modules: total 24 --rwxr-xr-x 1 mts mts 351 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 9773 Apr 14 13:03 Makefile.in -drwxr-xr-x 6 mts mts 4096 Apr 14 13:03 freebsd -drwxr-xr-x 7 mts mts 4096 Apr 14 13:03 linux +-rwxr-xr-x 1 mts mts 351 May 2 15:24 Makefile.am +-rw-r--r-- 1 mts mts 9847 May 2 15:25 Makefile.in +drwxr-xr-x 6 mts mts 4096 May 2 15:24 freebsd +drwxr-xr-x 7 mts mts 4096 May 2 15:24 linux -open-vm-tools-2008.04.14-87182/modules/freebsd: +open-vm-tools-2008.05.02-90473/modules/freebsd: total 16 -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmblock -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmhgfs -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 vmmemctl -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 vmxnet +drwxr-xr-x 2 mts mts 4096 May 2 15:24 vmblock +drwxr-xr-x 2 mts mts 4096 May 2 15:24 vmhgfs +drwxr-xr-x 2 mts mts 4096 May 2 15:24 vmmemctl +drwxr-xr-x 3 mts mts 4096 May 2 15:24 vmxnet -open-vm-tools-2008.04.14-87182/modules/freebsd/vmblock: +open-vm-tools-2008.05.02-90473/modules/freebsd/vmblock: total 220 --r--r--r-- 1 mts mts 1430 Apr 14 13:03 COPYING.BSD --r--r--r-- 1 mts mts 2151 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 17267 Apr 14 13:03 block.c --r--r--r-- 1 mts mts 2375 Apr 14 13:03 block.h --r--r--r-- 1 mts mts 9048 Apr 14 13:03 dbllnklst.c --r--r--r-- 1 mts mts 3181 Apr 14 13:03 dbllnklst.h --r--r--r-- 1 mts mts 0 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 5980 Apr 14 13:03 os.h --r--r--r-- 1 mts mts 2141 Apr 14 13:03 stubs.c --r--r--r-- 1 mts mts 1888 Apr 14 13:03 stubs.h --r--r--r-- 1 mts mts 19458 Apr 14 13:03 subr.c --r--r--r-- 1 mts mts 13036 Apr 14 13:03 vfsops.c --r--r--r-- 1 mts mts 10783 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 13013 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 22551 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 5091 Apr 14 13:03 vmblock.h --r--r--r-- 1 mts mts 5872 Apr 14 13:03 vmblock_k.h --r--r--r-- 1 mts mts 2720 Apr 14 13:03 vmware.h --r--r--r-- 1 mts mts 45731 Apr 14 13:03 vnops.c - -open-vm-tools-2008.04.14-87182/modules/freebsd/vmhgfs: -total 760 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 2652 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 6383 Apr 14 13:03 backdoor.c --r--r--r-- 1 mts mts 1337 Apr 14 13:03 backdoor.h --r--r--r-- 1 mts mts 6174 Apr 14 13:03 backdoorGcc32.c --r--r--r-- 1 mts mts 5550 Apr 14 13:03 backdoorGcc64.c --r--r--r-- 1 mts mts 1032 Apr 14 13:03 backdoorInt.h --r--r--r-- 1 mts mts 5840 Apr 14 13:03 backdoor_def.h --r--r--r-- 1 mts mts 3543 Apr 14 13:03 backdoor_types.h --r--r--r-- 1 mts mts 12045 Apr 14 13:03 cpName.c --r--r--r-- 1 mts mts 4174 Apr 14 13:03 cpName.h --r--r--r-- 1 mts mts 1798 Apr 14 13:03 cpNameInt.h --r--r--r-- 1 mts mts 5763 Apr 14 13:03 cpNameLinux.c --r--r--r-- 1 mts mts 2642 Apr 14 13:03 cpNameLite.c --r--r--r-- 1 mts mts 1710 Apr 14 13:03 cpNameLite.h --r--r--r-- 1 mts mts 8217 Apr 14 13:03 dbllnklst.c --r--r--r-- 1 mts mts 2350 Apr 14 13:03 dbllnklst.h --r--r--r-- 1 mts mts 4769 Apr 14 13:03 debug.c --r--r--r-- 1 mts mts 3358 Apr 14 13:03 debug.h --r--r--r-- 1 mts mts 3832 Apr 14 13:03 escBitvector.h --r--r--r-- 1 mts mts 25043 Apr 14 13:03 fsutil.c --r--r--r-- 1 mts mts 3506 Apr 14 13:03 fsutil.h --r--r--r-- 1 mts mts 2843 Apr 14 13:03 guest_msg_def.h --r--r--r-- 1 mts mts 7008 Apr 14 13:03 hgfs.h --r--r--r-- 1 mts mts 8689 Apr 14 13:03 hgfsBd.c --r--r--r-- 1 mts mts 1450 Apr 14 13:03 hgfsBd.h --r--r--r-- 1 mts mts 40081 Apr 14 13:03 hgfsProto.h --r--r--r-- 1 mts mts 6822 Apr 14 13:03 hgfsUtil.c --r--r--r-- 1 mts mts 3737 Apr 14 13:03 hgfsUtil.h --r--r--r-- 1 mts mts 5685 Apr 14 13:03 hgfs_kernel.h --r--r--r-- 1 mts mts 4262 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 4774 Apr 14 13:03 kernelStubs.h --r--r--r-- 1 mts mts 6043 Apr 14 13:03 kernelStubsBSD.c --r--r--r-- 1 mts mts 8254 Apr 14 13:03 message.c --r--r--r-- 1 mts mts 3529 Apr 14 13:03 message.h --r--r--r-- 1 mts mts 17265 Apr 14 13:03 messageBackdoor.c --r--r--r-- 1 mts mts 16112 Apr 14 13:03 os.c --r--r--r-- 1 mts mts 4229 Apr 14 13:03 os.h --r--r--r-- 1 mts mts 22550 Apr 14 13:03 request.c --r--r--r-- 1 mts mts 3184 Apr 14 13:03 request.h --r--r--r-- 1 mts mts 6298 Apr 14 13:03 requestInt.h --r--r--r-- 1 mts mts 11670 Apr 14 13:03 rpcout.c --r--r--r-- 1 mts mts 1963 Apr 14 13:03 rpcout.h --r--r--r-- 1 mts mts 6515 Apr 14 13:03 sha1.c --r--r--r-- 1 mts mts 2207 Apr 14 13:03 sha1.h --r--r--r-- 1 mts mts 46819 Apr 14 13:03 state.c --r--r--r-- 1 mts mts 6710 Apr 14 13:03 state.h --r--r--r-- 1 mts mts 8823 Apr 14 13:03 staticEscape.c --r--r--r-- 1 mts mts 2481 Apr 14 13:03 staticEscape.h --r--r--r-- 1 mts mts 9540 Apr 14 13:03 vfsops.c --r--r--r-- 1 mts mts 9952 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 17697 Apr 14 13:03 vm_basic_asm.h --r--r--r-- 1 mts mts 16079 Apr 14 13:03 vm_basic_asm_x86.h --r--r--r-- 1 mts mts 8845 Apr 14 13:03 vm_basic_asm_x86_64.h --r--r--r-- 1 mts mts 12182 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 1889 Apr 14 13:03 vmware.h --r--r--r-- 1 mts mts 1316 Apr 14 13:03 vmware_pack_begin.h --r--r--r-- 1 mts mts 1336 Apr 14 13:03 vmware_pack_end.h --r--r--r-- 1 mts mts 1956 Apr 14 13:03 vmware_pack_init.h --r--r--r-- 1 mts mts 23185 Apr 14 13:03 vnops.c --r--r--r-- 1 mts mts 77726 Apr 14 13:03 vnopscommon.c --r--r--r-- 1 mts mts 3216 Apr 14 13:03 vnopscommon.h --r--r--r-- 1 mts mts 6265 Apr 14 13:03 worker.c --r--r--r-- 1 mts mts 37595 Apr 14 13:03 x86cpuid.h - -open-vm-tools-2008.04.14-87182/modules/freebsd/vmmemctl: +-r--r--r-- 1 mts mts 1430 May 2 15:24 COPYING.BSD +-r--r--r-- 1 mts mts 2151 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 17267 May 2 15:24 block.c +-r--r--r-- 1 mts mts 2375 May 2 15:24 block.h +-r--r--r-- 1 mts mts 9048 May 2 15:24 dbllnklst.c +-r--r--r-- 1 mts mts 3181 May 2 15:24 dbllnklst.h +-r--r--r-- 1 mts mts 0 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 5980 May 2 15:24 os.h +-r--r--r-- 1 mts mts 2141 May 2 15:24 stubs.c +-r--r--r-- 1 mts mts 1888 May 2 15:24 stubs.h +-r--r--r-- 1 mts mts 19458 May 2 15:24 subr.c +-r--r--r-- 1 mts mts 13036 May 2 15:24 vfsops.c +-r--r--r-- 1 mts mts 10783 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 13013 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 22572 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 5091 May 2 15:24 vmblock.h +-r--r--r-- 1 mts mts 5872 May 2 15:24 vmblock_k.h +-r--r--r-- 1 mts mts 2720 May 2 15:24 vmware.h +-r--r--r-- 1 mts mts 45731 May 2 15:24 vnops.c + +open-vm-tools-2008.05.02-90473/modules/freebsd/vmhgfs: +total 764 +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 2652 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 6383 May 2 15:24 backdoor.c +-r--r--r-- 1 mts mts 1337 May 2 15:24 backdoor.h +-r--r--r-- 1 mts mts 6174 May 2 15:24 backdoorGcc32.c +-r--r--r-- 1 mts mts 5550 May 2 15:24 backdoorGcc64.c +-r--r--r-- 1 mts mts 1032 May 2 15:24 backdoorInt.h +-r--r--r-- 1 mts mts 5883 May 2 15:24 backdoor_def.h +-r--r--r-- 1 mts mts 3543 May 2 15:24 backdoor_types.h +-r--r--r-- 1 mts mts 12045 May 2 15:24 cpName.c +-r--r--r-- 1 mts mts 4174 May 2 15:24 cpName.h +-r--r--r-- 1 mts mts 1798 May 2 15:24 cpNameInt.h +-r--r--r-- 1 mts mts 5763 May 2 15:24 cpNameLinux.c +-r--r--r-- 1 mts mts 2642 May 2 15:24 cpNameLite.c +-r--r--r-- 1 mts mts 1710 May 2 15:24 cpNameLite.h +-r--r--r-- 1 mts mts 8217 May 2 15:24 dbllnklst.c +-r--r--r-- 1 mts mts 2350 May 2 15:24 dbllnklst.h +-r--r--r-- 1 mts mts 4769 May 2 15:24 debug.c +-r--r--r-- 1 mts mts 3358 May 2 15:24 debug.h +-r--r--r-- 1 mts mts 3832 May 2 15:24 escBitvector.h +-r--r--r-- 1 mts mts 25043 May 2 15:24 fsutil.c +-r--r--r-- 1 mts mts 3506 May 2 15:24 fsutil.h +-r--r--r-- 1 mts mts 2843 May 2 15:24 guest_msg_def.h +-r--r--r-- 1 mts mts 7008 May 2 15:24 hgfs.h +-r--r--r-- 1 mts mts 8689 May 2 15:24 hgfsBd.c +-r--r--r-- 1 mts mts 1450 May 2 15:24 hgfsBd.h +-r--r--r-- 1 mts mts 39263 May 2 15:24 hgfsProto.h +-r--r--r-- 1 mts mts 6822 May 2 15:24 hgfsUtil.c +-r--r--r-- 1 mts mts 4161 May 2 15:24 hgfsUtil.h +-r--r--r-- 1 mts mts 5685 May 2 15:24 hgfs_kernel.h +-r--r--r-- 1 mts mts 4262 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 4774 May 2 15:24 kernelStubs.h +-r--r--r-- 1 mts mts 6043 May 2 15:24 kernelStubsBSD.c +-r--r--r-- 1 mts mts 8254 May 2 15:24 message.c +-r--r--r-- 1 mts mts 3529 May 2 15:24 message.h +-r--r--r-- 1 mts mts 17265 May 2 15:24 messageBackdoor.c +-r--r--r-- 1 mts mts 16112 May 2 15:24 os.c +-r--r--r-- 1 mts mts 4229 May 2 15:24 os.h +-r--r--r-- 1 mts mts 22550 May 2 15:24 request.c +-r--r--r-- 1 mts mts 3184 May 2 15:24 request.h +-r--r--r-- 1 mts mts 6298 May 2 15:24 requestInt.h +-r--r--r-- 1 mts mts 11670 May 2 15:24 rpcout.c +-r--r--r-- 1 mts mts 1963 May 2 15:24 rpcout.h +-r--r--r-- 1 mts mts 6515 May 2 15:24 sha1.c +-r--r--r-- 1 mts mts 2207 May 2 15:24 sha1.h +-r--r--r-- 1 mts mts 46819 May 2 15:24 state.c +-r--r--r-- 1 mts mts 6710 May 2 15:24 state.h +-r--r--r-- 1 mts mts 8823 May 2 15:24 staticEscape.c +-r--r--r-- 1 mts mts 2481 May 2 15:24 staticEscape.h +-r--r--r-- 1 mts mts 9540 May 2 15:24 vfsops.c +-r--r--r-- 1 mts mts 9952 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 17697 May 2 15:24 vm_basic_asm.h +-r--r--r-- 1 mts mts 16113 May 2 15:24 vm_basic_asm_x86.h +-r--r--r-- 1 mts mts 8903 May 2 15:24 vm_basic_asm_x86_64.h +-r--r--r-- 1 mts mts 12182 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 1889 May 2 15:24 vmware.h +-r--r--r-- 1 mts mts 1316 May 2 15:24 vmware_pack_begin.h +-r--r--r-- 1 mts mts 1336 May 2 15:24 vmware_pack_end.h +-r--r--r-- 1 mts mts 1956 May 2 15:24 vmware_pack_init.h +-r--r--r-- 1 mts mts 23185 May 2 15:24 vnops.c +-r--r--r-- 1 mts mts 77726 May 2 15:24 vnopscommon.c +-r--r--r-- 1 mts mts 3216 May 2 15:24 vnopscommon.h +-r--r--r-- 1 mts mts 6265 May 2 15:24 worker.c +-r--r--r-- 1 mts mts 37595 May 2 15:24 x86cpuid.h + +open-vm-tools-2008.05.02-90473/modules/freebsd/vmmemctl: total 180 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1259 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 430 Apr 14 13:03 README --r--r--r-- 1 mts mts 1337 Apr 14 13:03 backdoor.h --r--r--r-- 1 mts mts 6174 Apr 14 13:03 backdoorGcc32.c --r--r--r-- 1 mts mts 5550 Apr 14 13:03 backdoorGcc64.c --r--r--r-- 1 mts mts 1032 Apr 14 13:03 backdoorInt.h --r--r--r-- 1 mts mts 1338 Apr 14 13:03 backdoor_balloon.h --r--r--r-- 1 mts mts 3543 Apr 14 13:03 backdoor_types.h --r--r--r-- 1 mts mts 2622 Apr 14 13:03 balloon_def.h --r--r--r-- 1 mts mts 4262 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 10240 Apr 14 13:03 os.c --r--r--r-- 1 mts mts 2441 Apr 14 13:03 os.h --r--r--r-- 1 mts mts 9952 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 12182 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 37545 Apr 14 13:03 vmballoon.c --r--r--r-- 1 mts mts 2048 Apr 14 13:03 vmballoon.h - -open-vm-tools-2008.04.14-87182/modules/freebsd/vmxnet: +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 1259 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 430 May 2 15:24 README +-r--r--r-- 1 mts mts 1337 May 2 15:24 backdoor.h +-r--r--r-- 1 mts mts 6174 May 2 15:24 backdoorGcc32.c +-r--r--r-- 1 mts mts 5550 May 2 15:24 backdoorGcc64.c +-r--r--r-- 1 mts mts 1032 May 2 15:24 backdoorInt.h +-r--r--r-- 1 mts mts 1338 May 2 15:24 backdoor_balloon.h +-r--r--r-- 1 mts mts 3543 May 2 15:24 backdoor_types.h +-r--r--r-- 1 mts mts 2622 May 2 15:24 balloon_def.h +-r--r--r-- 1 mts mts 4262 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 10240 May 2 15:24 os.c +-r--r--r-- 1 mts mts 2441 May 2 15:24 os.h +-r--r--r-- 1 mts mts 9952 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 12182 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 37545 May 2 15:24 vmballoon.c +-r--r--r-- 1 mts mts 2048 May 2 15:24 vmballoon.h + +open-vm-tools-2008.05.02-90473/modules/freebsd/vmxnet: total 140 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1222 Apr 14 13:03 Makefile -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autoconf --r--r--r-- 1 mts mts 35544 Apr 14 13:03 if_vxn.c --r--r--r-- 1 mts mts 0 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 2426 Apr 14 13:03 net.h --r--r--r-- 1 mts mts 6515 Apr 14 13:03 net_compat.h --r--r--r-- 1 mts mts 2240 Apr 14 13:03 net_sg.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 7137 Apr 14 13:03 vm_device_version.h --r--r--r-- 1 mts mts 2915 Apr 14 13:03 vmnet_def.h --r--r--r-- 1 mts mts 14595 Apr 14 13:03 vmxnet2_def.h --r--r--r-- 1 mts mts 6793 Apr 14 13:03 vmxnet_def.h - -open-vm-tools-2008.04.14-87182/modules/freebsd/vmxnet/autoconf: +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 1222 May 2 15:24 Makefile +drwxr-xr-x 2 mts mts 4096 May 2 15:24 autoconf +-r--r--r-- 1 mts mts 35544 May 2 15:24 if_vxn.c +-r--r--r-- 1 mts mts 0 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 2426 May 2 15:24 net.h +-r--r--r-- 1 mts mts 6515 May 2 15:24 net_compat.h +-r--r--r-- 1 mts mts 2240 May 2 15:24 net_sg.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 7137 May 2 15:24 vm_device_version.h +-r--r--r-- 1 mts mts 2915 May 2 15:24 vmnet_def.h +-r--r--r-- 1 mts mts 14595 May 2 15:24 vmxnet2_def.h +-r--r--r-- 1 mts mts 6793 May 2 15:24 vmxnet_def.h + +open-vm-tools-2008.05.02-90473/modules/freebsd/vmxnet/autoconf: total 0 -open-vm-tools-2008.04.14-87182/modules/linux: +open-vm-tools-2008.05.02-90473/modules/linux: total 20 -drwxr-xr-x 5 mts mts 4096 Apr 14 13:03 vmblock -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 vmhgfs -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 vmmemctl -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 vmsync -drwxr-xr-x 3 mts mts 4096 Apr 14 13:03 vmxnet +drwxr-xr-x 5 mts mts 4096 May 2 15:24 vmblock +drwxr-xr-x 3 mts mts 4096 May 2 15:24 vmhgfs +drwxr-xr-x 3 mts mts 4096 May 2 15:24 vmmemctl +drwxr-xr-x 3 mts mts 4096 May 2 15:24 vmsync +drwxr-xr-x 3 mts mts 4096 May 2 15:24 vmxnet -open-vm-tools-2008.04.14-87182/modules/linux/vmblock: +open-vm-tools-2008.05.02-90473/modules/linux/vmblock: total 52 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3761 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 2009 Apr 14 13:03 Makefile.kernel --r--r--r-- 1 mts mts 4136 Apr 14 13:03 Makefile.normal --r--r--r-- 1 mts mts 481 Apr 14 13:03 README -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autoconf -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 include -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 linux - -open-vm-tools-2008.04.14-87182/modules/linux/vmblock/autoconf: +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 3761 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 2009 May 2 15:24 Makefile.kernel +-r--r--r-- 1 mts mts 4136 May 2 15:24 Makefile.normal +-r--r--r-- 1 mts mts 481 May 2 15:24 README +drwxr-xr-x 2 mts mts 4096 May 2 15:24 autoconf +drwxr-xr-x 2 mts mts 4096 May 2 15:24 include +drwxr-xr-x 2 mts mts 4096 May 2 15:24 linux + +open-vm-tools-2008.05.02-90473/modules/linux/vmblock/autoconf: total 36 --r--r--r-- 1 mts mts 1670 Apr 14 13:03 cachecreate.c --r--r--r-- 1 mts mts 1718 Apr 14 13:03 cachector.c --r--r--r-- 1 mts mts 1261 Apr 14 13:03 epoll.c --r--r--r-- 1 mts mts 1710 Apr 14 13:03 filldir1.c --r--r--r-- 1 mts mts 1204 Apr 14 13:03 geninclude.c --r--r--r-- 1 mts mts 1596 Apr 14 13:03 getsb1.c --r--r--r-- 1 mts mts 1139 Apr 14 13:03 setnice.c --r--r--r-- 1 mts mts 1259 Apr 14 13:03 skas1.c --r--r--r-- 1 mts mts 1463 Apr 14 13:03 statfs1.c - -open-vm-tools-2008.04.14-87182/modules/linux/vmblock/include: +-r--r--r-- 1 mts mts 1670 May 2 15:24 cachecreate.c +-r--r--r-- 1 mts mts 1718 May 2 15:24 cachector.c +-r--r--r-- 1 mts mts 1261 May 2 15:24 epoll.c +-r--r--r-- 1 mts mts 1710 May 2 15:24 filldir1.c +-r--r--r-- 1 mts mts 1204 May 2 15:24 geninclude.c +-r--r--r-- 1 mts mts 1596 May 2 15:24 getsb1.c +-r--r--r-- 1 mts mts 1139 May 2 15:24 setnice.c +-r--r--r-- 1 mts mts 1259 May 2 15:24 skas1.c +-r--r--r-- 1 mts mts 1463 May 2 15:24 statfs1.c + +open-vm-tools-2008.05.02-90473/modules/linux/vmblock/include: total 168 --r--r--r-- 1 mts mts 6088 Apr 14 13:03 compat_completion.h --r--r--r-- 1 mts mts 1875 Apr 14 13:03 compat_file.h --r--r--r-- 1 mts mts 9850 Apr 14 13:03 compat_fs.h --r--r--r-- 1 mts mts 1261 Apr 14 13:03 compat_init.h --r--r--r-- 1 mts mts 2659 Apr 14 13:03 compat_kernel.h --r--r--r-- 1 mts mts 1917 Apr 14 13:03 compat_list.h --r--r--r-- 1 mts mts 4231 Apr 14 13:03 compat_mm.h --r--r--r-- 1 mts mts 2298 Apr 14 13:03 compat_module.h --r--r--r-- 1 mts mts 2118 Apr 14 13:03 compat_namei.h --r--r--r-- 1 mts mts 2483 Apr 14 13:03 compat_page.h --r--r--r-- 1 mts mts 9843 Apr 14 13:03 compat_sched.h --r--r--r-- 1 mts mts 1456 Apr 14 13:03 compat_semaphore.h --r--r--r-- 1 mts mts 2764 Apr 14 13:03 compat_slab.h --r--r--r-- 1 mts mts 2438 Apr 14 13:03 compat_spinlock.h --r--r--r-- 1 mts mts 1222 Apr 14 13:03 compat_statfs.h --r--r--r-- 1 mts mts 1907 Apr 14 13:03 compat_string.h --r--r--r-- 1 mts mts 3122 Apr 14 13:03 compat_uaccess.h --r--r--r-- 1 mts mts 3189 Apr 14 13:03 compat_version.h --r--r--r-- 1 mts mts 6854 Apr 14 13:03 compat_wait.h --r--r--r-- 1 mts mts 2216 Apr 14 13:03 driver-config.h --r--r--r-- 1 mts mts 0 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 9952 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 12182 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 4260 Apr 14 13:03 vmblock.h --r--r--r-- 1 mts mts 1889 Apr 14 13:03 vmware.h - -open-vm-tools-2008.04.14-87182/modules/linux/vmblock/linux: +-r--r--r-- 1 mts mts 6088 May 2 15:24 compat_completion.h +-r--r--r-- 1 mts mts 1875 May 2 15:24 compat_file.h +-r--r--r-- 1 mts mts 9850 May 2 15:24 compat_fs.h +-r--r--r-- 1 mts mts 1261 May 2 15:24 compat_init.h +-r--r--r-- 1 mts mts 2659 May 2 15:24 compat_kernel.h +-r--r--r-- 1 mts mts 1917 May 2 15:24 compat_list.h +-r--r--r-- 1 mts mts 4231 May 2 15:24 compat_mm.h +-r--r--r-- 1 mts mts 2298 May 2 15:24 compat_module.h +-r--r--r-- 1 mts mts 2118 May 2 15:24 compat_namei.h +-r--r--r-- 1 mts mts 2483 May 2 15:24 compat_page.h +-r--r--r-- 1 mts mts 9843 May 2 15:24 compat_sched.h +-r--r--r-- 1 mts mts 1456 May 2 15:24 compat_semaphore.h +-r--r--r-- 1 mts mts 2764 May 2 15:24 compat_slab.h +-r--r--r-- 1 mts mts 2438 May 2 15:24 compat_spinlock.h +-r--r--r-- 1 mts mts 1222 May 2 15:24 compat_statfs.h +-r--r--r-- 1 mts mts 1907 May 2 15:24 compat_string.h +-r--r--r-- 1 mts mts 3122 May 2 15:24 compat_uaccess.h +-r--r--r-- 1 mts mts 3189 May 2 15:24 compat_version.h +-r--r--r-- 1 mts mts 6854 May 2 15:24 compat_wait.h +-r--r--r-- 1 mts mts 2216 May 2 15:24 driver-config.h +-r--r--r-- 1 mts mts 0 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 9952 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 12182 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 4260 May 2 15:24 vmblock.h +-r--r--r-- 1 mts mts 1889 May 2 15:24 vmware.h + +open-vm-tools-2008.05.02-90473/modules/linux/vmblock/linux: total 140 --r--r--r-- 1 mts mts 16436 Apr 14 13:03 block.c --r--r--r-- 1 mts mts 1544 Apr 14 13:03 block.h --r--r--r-- 1 mts mts 8894 Apr 14 13:03 control.c --r--r--r-- 1 mts mts 8217 Apr 14 13:03 dbllnklst.c --r--r--r-- 1 mts mts 2350 Apr 14 13:03 dbllnklst.h --r--r--r-- 1 mts mts 3749 Apr 14 13:03 dentry.c --r--r--r-- 1 mts mts 8089 Apr 14 13:03 file.c --r--r--r-- 1 mts mts 20088 Apr 14 13:03 filesystem.c --r--r--r-- 1 mts mts 4856 Apr 14 13:03 filesystem.h --r--r--r-- 1 mts mts 6794 Apr 14 13:03 inode.c --r--r--r-- 1 mts mts 4286 Apr 14 13:03 module.c --r--r--r-- 1 mts mts 4292 Apr 14 13:03 os.h --r--r--r-- 1 mts mts 1310 Apr 14 13:03 stubs.c --r--r--r-- 1 mts mts 1057 Apr 14 13:03 stubs.h --r--r--r-- 1 mts mts 5026 Apr 14 13:03 super.c --r--r--r-- 1 mts mts 3399 Apr 14 13:03 vmblockInt.h --r--r--r-- 1 mts mts 1176 Apr 14 13:03 vmblock_version.h - -open-vm-tools-2008.04.14-87182/modules/linux/vmhgfs: -total 916 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3760 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 2291 Apr 14 13:03 Makefile.kernel --r--r--r-- 1 mts mts 3429 Apr 14 13:03 Makefile.normal -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autoconf --r--r--r-- 1 mts mts 6383 Apr 14 13:03 backdoor.c --r--r--r-- 1 mts mts 1337 Apr 14 13:03 backdoor.h --r--r--r-- 1 mts mts 6174 Apr 14 13:03 backdoorGcc32.c --r--r--r-- 1 mts mts 5550 Apr 14 13:03 backdoorGcc64.c --r--r--r-- 1 mts mts 1032 Apr 14 13:03 backdoorInt.h --r--r--r-- 1 mts mts 5840 Apr 14 13:03 backdoor_def.h --r--r--r-- 1 mts mts 3543 Apr 14 13:03 backdoor_types.h --r--r--r-- 1 mts mts 8759 Apr 14 13:03 bdhandler.c --r--r--r-- 1 mts mts 1167 Apr 14 13:03 bdhandler.h --r--r--r-- 1 mts mts 6088 Apr 14 13:03 compat_completion.h --r--r--r-- 1 mts mts 2052 Apr 14 13:03 compat_dcache.h --r--r--r-- 1 mts mts 1875 Apr 14 13:03 compat_file.h --r--r--r-- 1 mts mts 9850 Apr 14 13:03 compat_fs.h --r--r--r-- 1 mts mts 1391 Apr 14 13:03 compat_highmem.h --r--r--r-- 1 mts mts 2659 Apr 14 13:03 compat_kernel.h --r--r--r-- 1 mts mts 8066 Apr 14 13:03 compat_kthread.h --r--r--r-- 1 mts mts 1917 Apr 14 13:03 compat_list.h --r--r--r-- 1 mts mts 4231 Apr 14 13:03 compat_mm.h --r--r--r-- 1 mts mts 2298 Apr 14 13:03 compat_module.h --r--r--r-- 1 mts mts 2118 Apr 14 13:03 compat_namei.h --r--r--r-- 1 mts mts 2591 Apr 14 13:03 compat_page-flags.h --r--r--r-- 1 mts mts 2483 Apr 14 13:03 compat_page.h --r--r--r-- 1 mts mts 9843 Apr 14 13:03 compat_sched.h --r--r--r-- 1 mts mts 1456 Apr 14 13:03 compat_semaphore.h --r--r--r-- 1 mts mts 2764 Apr 14 13:03 compat_slab.h --r--r--r-- 1 mts mts 2438 Apr 14 13:03 compat_spinlock.h --r--r--r-- 1 mts mts 1222 Apr 14 13:03 compat_statfs.h --r--r--r-- 1 mts mts 1907 Apr 14 13:03 compat_string.h --r--r--r-- 1 mts mts 3122 Apr 14 13:03 compat_uaccess.h --r--r--r-- 1 mts mts 3189 Apr 14 13:03 compat_version.h --r--r--r-- 1 mts mts 6854 Apr 14 13:03 compat_wait.h --r--r--r-- 1 mts mts 12045 Apr 14 13:03 cpName.c --r--r--r-- 1 mts mts 4174 Apr 14 13:03 cpName.h --r--r--r-- 1 mts mts 1798 Apr 14 13:03 cpNameInt.h --r--r--r-- 1 mts mts 5763 Apr 14 13:03 cpNameLinux.c --r--r--r-- 1 mts mts 2642 Apr 14 13:03 cpNameLite.c --r--r--r-- 1 mts mts 1710 Apr 14 13:03 cpNameLite.h --r--r--r-- 1 mts mts 2350 Apr 14 13:03 dbllnklst.h --r--r--r-- 1 mts mts 3112 Apr 14 13:03 dentry.c --r--r--r-- 1 mts mts 27830 Apr 14 13:03 dir.c --r--r--r-- 1 mts mts 2216 Apr 14 13:03 driver-config.h --r--r--r-- 1 mts mts 3832 Apr 14 13:03 escBitvector.h --r--r--r-- 1 mts mts 36564 Apr 14 13:03 file.c --r--r--r-- 1 mts mts 20296 Apr 14 13:03 filesystem.c --r--r--r-- 1 mts mts 1233 Apr 14 13:03 filesystem.h --r--r--r-- 1 mts mts 57085 Apr 14 13:03 fsutil.c --r--r--r-- 1 mts mts 3981 Apr 14 13:03 fsutil.h --r--r--r-- 1 mts mts 2843 Apr 14 13:03 guest_msg_def.h --r--r--r-- 1 mts mts 7008 Apr 14 13:03 hgfs.h --r--r--r-- 1 mts mts 8689 Apr 14 13:03 hgfsBd.c --r--r--r-- 1 mts mts 1450 Apr 14 13:03 hgfsBd.h --r--r--r-- 1 mts mts 2535 Apr 14 13:03 hgfsDevLinux.h --r--r--r-- 1 mts mts 40081 Apr 14 13:03 hgfsProto.h --r--r--r-- 1 mts mts 6822 Apr 14 13:03 hgfsUtil.c --r--r--r-- 1 mts mts 3737 Apr 14 13:03 hgfsUtil.h --r--r--r-- 1 mts mts 4262 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 62568 Apr 14 13:03 inode.c --r--r--r-- 1 mts mts 1318 Apr 14 13:03 inode.h --r--r--r-- 1 mts mts 4774 Apr 14 13:03 kernelStubs.h --r--r--r-- 1 mts mts 9629 Apr 14 13:03 kernelStubsLinux.c --r--r--r-- 1 mts mts 5304 Apr 14 13:03 link.c --r--r--r-- 1 mts mts 8254 Apr 14 13:03 message.c --r--r--r-- 1 mts mts 3529 Apr 14 13:03 message.h --r--r--r-- 1 mts mts 17265 Apr 14 13:03 messageBackdoor.c --r--r--r-- 1 mts mts 2677 Apr 14 13:03 module.c --r--r--r-- 1 mts mts 8784 Apr 14 13:03 module.h --r--r--r-- 1 mts mts 27169 Apr 14 13:03 page.c --r--r--r-- 1 mts mts 7040 Apr 14 13:03 request.c --r--r--r-- 1 mts mts 3959 Apr 14 13:03 request.h --r--r--r-- 1 mts mts 11670 Apr 14 13:03 rpcout.c --r--r--r-- 1 mts mts 1963 Apr 14 13:03 rpcout.h --r--r--r-- 1 mts mts 8823 Apr 14 13:03 staticEscape.c --r--r--r-- 1 mts mts 2481 Apr 14 13:03 staticEscape.h --r--r--r-- 1 mts mts 1985 Apr 14 13:03 stubs.c --r--r--r-- 1 mts mts 12757 Apr 14 13:03 super.c --r--r--r-- 1 mts mts 9952 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 17697 Apr 14 13:03 vm_basic_asm.h --r--r--r-- 1 mts mts 16079 Apr 14 13:03 vm_basic_asm_x86.h --r--r--r-- 1 mts mts 8845 Apr 14 13:03 vm_basic_asm_x86_64.h --r--r--r-- 1 mts mts 12182 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 1168 Apr 14 13:03 vmhgfs_version.h --r--r--r-- 1 mts mts 1889 Apr 14 13:03 vmware.h --r--r--r-- 1 mts mts 1316 Apr 14 13:03 vmware_pack_begin.h --r--r--r-- 1 mts mts 1336 Apr 14 13:03 vmware_pack_end.h --r--r--r-- 1 mts mts 1956 Apr 14 13:03 vmware_pack_init.h --r--r--r-- 1 mts mts 37595 Apr 14 13:03 x86cpuid.h - -open-vm-tools-2008.04.14-87182/modules/linux/vmhgfs/autoconf: +-r--r--r-- 1 mts mts 16436 May 2 15:24 block.c +-r--r--r-- 1 mts mts 1544 May 2 15:24 block.h +-r--r--r-- 1 mts mts 8894 May 2 15:24 control.c +-r--r--r-- 1 mts mts 8217 May 2 15:24 dbllnklst.c +-r--r--r-- 1 mts mts 2350 May 2 15:24 dbllnklst.h +-r--r--r-- 1 mts mts 3749 May 2 15:24 dentry.c +-r--r--r-- 1 mts mts 8089 May 2 15:24 file.c +-r--r--r-- 1 mts mts 20088 May 2 15:24 filesystem.c +-r--r--r-- 1 mts mts 4856 May 2 15:24 filesystem.h +-r--r--r-- 1 mts mts 6794 May 2 15:24 inode.c +-r--r--r-- 1 mts mts 4286 May 2 15:24 module.c +-r--r--r-- 1 mts mts 4292 May 2 15:24 os.h +-r--r--r-- 1 mts mts 1310 May 2 15:24 stubs.c +-r--r--r-- 1 mts mts 1057 May 2 15:24 stubs.h +-r--r--r-- 1 mts mts 5026 May 2 15:24 super.c +-r--r--r-- 1 mts mts 3399 May 2 15:24 vmblockInt.h +-r--r--r-- 1 mts mts 1176 May 2 15:24 vmblock_version.h + +open-vm-tools-2008.05.02-90473/modules/linux/vmhgfs: +total 920 +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 3760 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 2291 May 2 15:24 Makefile.kernel +-r--r--r-- 1 mts mts 3429 May 2 15:24 Makefile.normal +drwxr-xr-x 2 mts mts 4096 May 2 15:24 autoconf +-r--r--r-- 1 mts mts 6383 May 2 15:24 backdoor.c +-r--r--r-- 1 mts mts 1337 May 2 15:24 backdoor.h +-r--r--r-- 1 mts mts 6174 May 2 15:24 backdoorGcc32.c +-r--r--r-- 1 mts mts 5550 May 2 15:24 backdoorGcc64.c +-r--r--r-- 1 mts mts 1032 May 2 15:24 backdoorInt.h +-r--r--r-- 1 mts mts 5883 May 2 15:24 backdoor_def.h +-r--r--r-- 1 mts mts 3543 May 2 15:24 backdoor_types.h +-r--r--r-- 1 mts mts 8759 May 2 15:24 bdhandler.c +-r--r--r-- 1 mts mts 1167 May 2 15:24 bdhandler.h +-r--r--r-- 1 mts mts 6088 May 2 15:24 compat_completion.h +-r--r--r-- 1 mts mts 2052 May 2 15:24 compat_dcache.h +-r--r--r-- 1 mts mts 1875 May 2 15:24 compat_file.h +-r--r--r-- 1 mts mts 9850 May 2 15:24 compat_fs.h +-r--r--r-- 1 mts mts 1391 May 2 15:24 compat_highmem.h +-r--r--r-- 1 mts mts 2659 May 2 15:24 compat_kernel.h +-r--r--r-- 1 mts mts 8066 May 2 15:24 compat_kthread.h +-r--r--r-- 1 mts mts 1917 May 2 15:24 compat_list.h +-r--r--r-- 1 mts mts 4231 May 2 15:24 compat_mm.h +-r--r--r-- 1 mts mts 2298 May 2 15:24 compat_module.h +-r--r--r-- 1 mts mts 2118 May 2 15:24 compat_namei.h +-r--r--r-- 1 mts mts 2591 May 2 15:24 compat_page-flags.h +-r--r--r-- 1 mts mts 2483 May 2 15:24 compat_page.h +-r--r--r-- 1 mts mts 9843 May 2 15:24 compat_sched.h +-r--r--r-- 1 mts mts 1456 May 2 15:24 compat_semaphore.h +-r--r--r-- 1 mts mts 2764 May 2 15:24 compat_slab.h +-r--r--r-- 1 mts mts 2438 May 2 15:24 compat_spinlock.h +-r--r--r-- 1 mts mts 1222 May 2 15:24 compat_statfs.h +-r--r--r-- 1 mts mts 1907 May 2 15:24 compat_string.h +-r--r--r-- 1 mts mts 3122 May 2 15:24 compat_uaccess.h +-r--r--r-- 1 mts mts 3189 May 2 15:24 compat_version.h +-r--r--r-- 1 mts mts 6854 May 2 15:24 compat_wait.h +-r--r--r-- 1 mts mts 12045 May 2 15:24 cpName.c +-r--r--r-- 1 mts mts 4174 May 2 15:24 cpName.h +-r--r--r-- 1 mts mts 1798 May 2 15:24 cpNameInt.h +-r--r--r-- 1 mts mts 5763 May 2 15:24 cpNameLinux.c +-r--r--r-- 1 mts mts 2642 May 2 15:24 cpNameLite.c +-r--r--r-- 1 mts mts 1710 May 2 15:24 cpNameLite.h +-r--r--r-- 1 mts mts 2350 May 2 15:24 dbllnklst.h +-r--r--r-- 1 mts mts 3112 May 2 15:24 dentry.c +-r--r--r-- 1 mts mts 27897 May 2 15:24 dir.c +-r--r--r-- 1 mts mts 2216 May 2 15:24 driver-config.h +-r--r--r-- 1 mts mts 3832 May 2 15:24 escBitvector.h +-r--r--r-- 1 mts mts 36841 May 2 15:24 file.c +-r--r--r-- 1 mts mts 20296 May 2 15:24 filesystem.c +-r--r--r-- 1 mts mts 1233 May 2 15:24 filesystem.h +-r--r--r-- 1 mts mts 57268 May 2 15:24 fsutil.c +-r--r--r-- 1 mts mts 3981 May 2 15:24 fsutil.h +-r--r--r-- 1 mts mts 2843 May 2 15:24 guest_msg_def.h +-r--r--r-- 1 mts mts 7008 May 2 15:24 hgfs.h +-r--r--r-- 1 mts mts 8689 May 2 15:24 hgfsBd.c +-r--r--r-- 1 mts mts 1450 May 2 15:24 hgfsBd.h +-r--r--r-- 1 mts mts 2535 May 2 15:24 hgfsDevLinux.h +-r--r--r-- 1 mts mts 39263 May 2 15:24 hgfsProto.h +-r--r--r-- 1 mts mts 6822 May 2 15:24 hgfsUtil.c +-r--r--r-- 1 mts mts 4161 May 2 15:24 hgfsUtil.h +-r--r--r-- 1 mts mts 4262 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 64072 May 2 15:24 inode.c +-r--r--r-- 1 mts mts 1318 May 2 15:24 inode.h +-r--r--r-- 1 mts mts 4774 May 2 15:24 kernelStubs.h +-r--r--r-- 1 mts mts 9629 May 2 15:24 kernelStubsLinux.c +-r--r--r-- 1 mts mts 5304 May 2 15:24 link.c +-r--r--r-- 1 mts mts 8254 May 2 15:24 message.c +-r--r--r-- 1 mts mts 3529 May 2 15:24 message.h +-r--r--r-- 1 mts mts 17265 May 2 15:24 messageBackdoor.c +-r--r--r-- 1 mts mts 2677 May 2 15:24 module.c +-r--r--r-- 1 mts mts 8784 May 2 15:24 module.h +-r--r--r-- 1 mts mts 27195 May 2 15:24 page.c +-r--r--r-- 1 mts mts 7040 May 2 15:24 request.c +-r--r--r-- 1 mts mts 3959 May 2 15:24 request.h +-r--r--r-- 1 mts mts 11670 May 2 15:24 rpcout.c +-r--r--r-- 1 mts mts 1963 May 2 15:24 rpcout.h +-r--r--r-- 1 mts mts 8823 May 2 15:24 staticEscape.c +-r--r--r-- 1 mts mts 2481 May 2 15:24 staticEscape.h +-r--r--r-- 1 mts mts 1985 May 2 15:24 stubs.c +-r--r--r-- 1 mts mts 12791 May 2 15:24 super.c +-r--r--r-- 1 mts mts 9952 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 17697 May 2 15:24 vm_basic_asm.h +-r--r--r-- 1 mts mts 16113 May 2 15:24 vm_basic_asm_x86.h +-r--r--r-- 1 mts mts 8903 May 2 15:24 vm_basic_asm_x86_64.h +-r--r--r-- 1 mts mts 12182 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 1168 May 2 15:24 vmhgfs_version.h +-r--r--r-- 1 mts mts 1889 May 2 15:24 vmware.h +-r--r--r-- 1 mts mts 1316 May 2 15:24 vmware_pack_begin.h +-r--r--r-- 1 mts mts 1336 May 2 15:24 vmware_pack_end.h +-r--r--r-- 1 mts mts 1956 May 2 15:24 vmware_pack_init.h +-r--r--r-- 1 mts mts 37595 May 2 15:24 x86cpuid.h + +open-vm-tools-2008.05.02-90473/modules/linux/vmhgfs/autoconf: total 36 --r--r--r-- 1 mts mts 1670 Apr 14 13:03 cachecreate.c --r--r--r-- 1 mts mts 1718 Apr 14 13:03 cachector.c --r--r--r-- 1 mts mts 1261 Apr 14 13:03 epoll.c --r--r--r-- 1 mts mts 1204 Apr 14 13:03 geninclude.c --r--r--r-- 1 mts mts 1596 Apr 14 13:03 getsb1.c --r--r--r-- 1 mts mts 1473 Apr 14 13:03 inode1.c --r--r--r-- 1 mts mts 1345 Apr 14 13:03 maxbytes.c --r--r--r-- 1 mts mts 1139 Apr 14 13:03 setnice.c --r--r--r-- 1 mts mts 1463 Apr 14 13:03 statfs1.c - -open-vm-tools-2008.04.14-87182/modules/linux/vmmemctl: -total 280 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3762 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 1696 Apr 14 13:03 Makefile.kernel --r--r--r-- 1 mts mts 2868 Apr 14 13:03 Makefile.normal --r--r--r-- 1 mts mts 453 Apr 14 13:03 README -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autoconf --r--r--r-- 1 mts mts 1337 Apr 14 13:03 backdoor.h --r--r--r-- 1 mts mts 6174 Apr 14 13:03 backdoorGcc32.c --r--r--r-- 1 mts mts 5550 Apr 14 13:03 backdoorGcc64.c --r--r--r-- 1 mts mts 1032 Apr 14 13:03 backdoorInt.h --r--r--r-- 1 mts mts 1338 Apr 14 13:03 backdoor_balloon.h --r--r--r-- 1 mts mts 5840 Apr 14 13:03 backdoor_def.h --r--r--r-- 1 mts mts 3543 Apr 14 13:03 backdoor_types.h --r--r--r-- 1 mts mts 2622 Apr 14 13:03 balloon_def.h --r--r--r-- 1 mts mts 6088 Apr 14 13:03 compat_completion.h --r--r--r-- 1 mts mts 1875 Apr 14 13:03 compat_file.h --r--r--r-- 1 mts mts 2659 Apr 14 13:03 compat_kernel.h --r--r--r-- 1 mts mts 1917 Apr 14 13:03 compat_list.h --r--r--r-- 1 mts mts 4231 Apr 14 13:03 compat_mm.h --r--r--r-- 1 mts mts 2298 Apr 14 13:03 compat_module.h --r--r--r-- 1 mts mts 2483 Apr 14 13:03 compat_page.h --r--r--r-- 1 mts mts 9843 Apr 14 13:03 compat_sched.h --r--r--r-- 1 mts mts 1456 Apr 14 13:03 compat_semaphore.h --r--r--r-- 1 mts mts 2438 Apr 14 13:03 compat_spinlock.h --r--r--r-- 1 mts mts 3189 Apr 14 13:03 compat_version.h --r--r--r-- 1 mts mts 6854 Apr 14 13:03 compat_wait.h --r--r--r-- 1 mts mts 2216 Apr 14 13:03 driver-config.h --r--r--r-- 1 mts mts 4262 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 14180 Apr 14 13:03 os.c --r--r--r-- 1 mts mts 2441 Apr 14 13:03 os.h --r--r--r-- 1 mts mts 9952 Apr 14 13:03 vm_assert.h --r--r--r-- 1 mts mts 12182 Apr 14 13:03 vm_basic_defs.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 37545 Apr 14 13:03 vmballoon.c --r--r--r-- 1 mts mts 2048 Apr 14 13:03 vmballoon.h --r--r--r-- 1 mts mts 1193 Apr 14 13:03 vmmemctl_version.h - -open-vm-tools-2008.04.14-87182/modules/linux/vmmemctl/autoconf: +-r--r--r-- 1 mts mts 1670 May 2 15:24 cachecreate.c +-r--r--r-- 1 mts mts 1718 May 2 15:24 cachector.c +-r--r--r-- 1 mts mts 1261 May 2 15:24 epoll.c +-r--r--r-- 1 mts mts 1204 May 2 15:24 geninclude.c +-r--r--r-- 1 mts mts 1596 May 2 15:24 getsb1.c +-r--r--r-- 1 mts mts 1473 May 2 15:24 inode1.c +-r--r--r-- 1 mts mts 1345 May 2 15:24 maxbytes.c +-r--r--r-- 1 mts mts 1139 May 2 15:24 setnice.c +-r--r--r-- 1 mts mts 1463 May 2 15:24 statfs1.c + +open-vm-tools-2008.05.02-90473/modules/linux/vmmemctl: +total 288 +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 3762 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 1696 May 2 15:24 Makefile.kernel +-r--r--r-- 1 mts mts 2868 May 2 15:24 Makefile.normal +-r--r--r-- 1 mts mts 453 May 2 15:24 README +drwxr-xr-x 2 mts mts 4096 May 2 15:24 autoconf +-r--r--r-- 1 mts mts 1337 May 2 15:24 backdoor.h +-r--r--r-- 1 mts mts 6174 May 2 15:24 backdoorGcc32.c +-r--r--r-- 1 mts mts 5550 May 2 15:24 backdoorGcc64.c +-r--r--r-- 1 mts mts 1032 May 2 15:24 backdoorInt.h +-r--r--r-- 1 mts mts 1338 May 2 15:24 backdoor_balloon.h +-r--r--r-- 1 mts mts 5883 May 2 15:24 backdoor_def.h +-r--r--r-- 1 mts mts 3543 May 2 15:24 backdoor_types.h +-r--r--r-- 1 mts mts 2622 May 2 15:24 balloon_def.h +-r--r--r-- 1 mts mts 6088 May 2 15:24 compat_completion.h +-r--r--r-- 1 mts mts 1875 May 2 15:24 compat_file.h +-r--r--r-- 1 mts mts 2659 May 2 15:24 compat_kernel.h +-r--r--r-- 1 mts mts 8066 May 2 15:24 compat_kthread.h +-r--r--r-- 1 mts mts 1917 May 2 15:24 compat_list.h +-r--r--r-- 1 mts mts 4231 May 2 15:24 compat_mm.h +-r--r--r-- 1 mts mts 2298 May 2 15:24 compat_module.h +-r--r--r-- 1 mts mts 2483 May 2 15:24 compat_page.h +-r--r--r-- 1 mts mts 9843 May 2 15:24 compat_sched.h +-r--r--r-- 1 mts mts 1456 May 2 15:24 compat_semaphore.h +-r--r--r-- 1 mts mts 2438 May 2 15:24 compat_spinlock.h +-r--r--r-- 1 mts mts 3189 May 2 15:24 compat_version.h +-r--r--r-- 1 mts mts 6854 May 2 15:24 compat_wait.h +-r--r--r-- 1 mts mts 2216 May 2 15:24 driver-config.h +-r--r--r-- 1 mts mts 4262 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 13341 May 2 15:24 os.c +-r--r--r-- 1 mts mts 2441 May 2 15:24 os.h +-r--r--r-- 1 mts mts 9952 May 2 15:24 vm_assert.h +-r--r--r-- 1 mts mts 12182 May 2 15:24 vm_basic_defs.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 37545 May 2 15:24 vmballoon.c +-r--r--r-- 1 mts mts 2048 May 2 15:24 vmballoon.h +-r--r--r-- 1 mts mts 1193 May 2 15:24 vmmemctl_version.h + +open-vm-tools-2008.05.02-90473/modules/linux/vmmemctl/autoconf: total 12 --r--r--r-- 1 mts mts 1261 Apr 14 13:03 epoll.c --r--r--r-- 1 mts mts 1204 Apr 14 13:03 geninclude.c --r--r--r-- 1 mts mts 1139 Apr 14 13:03 setnice.c +-r--r--r-- 1 mts mts 1261 May 2 15:24 epoll.c +-r--r--r-- 1 mts mts 1204 May 2 15:24 geninclude.c +-r--r--r-- 1 mts mts 1139 May 2 15:24 setnice.c -open-vm-tools-2008.04.14-87182/modules/linux/vmsync: +open-vm-tools-2008.05.02-90473/modules/linux/vmsync: total 108 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3760 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 1473 Apr 14 13:03 Makefile.kernel -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autoconf --r--r--r-- 1 mts mts 9850 Apr 14 13:03 compat_fs.h --r--r--r-- 1 mts mts 2298 Apr 14 13:03 compat_module.h --r--r--r-- 1 mts mts 2118 Apr 14 13:03 compat_namei.h --r--r--r-- 1 mts mts 2764 Apr 14 13:03 compat_slab.h --r--r--r-- 1 mts mts 3189 Apr 14 13:03 compat_version.h --r--r--r-- 1 mts mts 6345 Apr 14 13:03 compat_workqueue.h --r--r--r-- 1 mts mts 2216 Apr 14 13:03 driver-config.h --r--r--r-- 1 mts mts 4262 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 18797 Apr 14 13:03 sync.c --r--r--r-- 1 mts mts 1540 Apr 14 13:03 syncDriverIoc.h --r--r--r-- 1 mts mts 1168 Apr 14 13:03 vmsync_version.h - -open-vm-tools-2008.04.14-87182/modules/linux/vmsync/autoconf: +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 3760 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 1473 May 2 15:24 Makefile.kernel +drwxr-xr-x 2 mts mts 4096 May 2 15:24 autoconf +-r--r--r-- 1 mts mts 9850 May 2 15:24 compat_fs.h +-r--r--r-- 1 mts mts 2298 May 2 15:24 compat_module.h +-r--r--r-- 1 mts mts 2118 May 2 15:24 compat_namei.h +-r--r--r-- 1 mts mts 2764 May 2 15:24 compat_slab.h +-r--r--r-- 1 mts mts 3189 May 2 15:24 compat_version.h +-r--r--r-- 1 mts mts 6345 May 2 15:24 compat_workqueue.h +-r--r--r-- 1 mts mts 2216 May 2 15:24 driver-config.h +-r--r--r-- 1 mts mts 4262 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 18797 May 2 15:24 sync.c +-r--r--r-- 1 mts mts 1540 May 2 15:24 syncDriverIoc.h +-r--r--r-- 1 mts mts 1168 May 2 15:24 vmsync_version.h + +open-vm-tools-2008.05.02-90473/modules/linux/vmsync/autoconf: total 8 --r--r--r-- 1 mts mts 1670 Apr 14 13:03 cachecreate.c --r--r--r-- 1 mts mts 1718 Apr 14 13:03 cachector.c +-r--r--r-- 1 mts mts 1670 May 2 15:24 cachecreate.c +-r--r--r-- 1 mts mts 1718 May 2 15:24 cachector.c -open-vm-tools-2008.04.14-87182/modules/linux/vmxnet: +open-vm-tools-2008.05.02-90473/modules/linux/vmxnet: total 280 --r--r--r-- 1 mts mts 17987 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3760 Apr 14 13:03 Makefile --r--r--r-- 1 mts mts 1279 Apr 14 13:03 Makefile.kernel --r--r--r-- 1 mts mts 2665 Apr 14 13:03 Makefile.normal --r--r--r-- 1 mts mts 460 Apr 14 13:03 README -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 autoconf --r--r--r-- 1 mts mts 1966 Apr 14 13:03 bpf_meta.h --r--r--r-- 1 mts mts 1734 Apr 14 13:03 compat_ethtool.h --r--r--r-- 1 mts mts 1391 Apr 14 13:03 compat_highmem.h --r--r--r-- 1 mts mts 1261 Apr 14 13:03 compat_init.h --r--r--r-- 1 mts mts 1700 Apr 14 13:03 compat_interrupt.h --r--r--r-- 1 mts mts 2081 Apr 14 13:03 compat_ioport.h --r--r--r-- 1 mts mts 2298 Apr 14 13:03 compat_module.h --r--r--r-- 1 mts mts 6772 Apr 14 13:03 compat_netdevice.h --r--r--r-- 1 mts mts 16725 Apr 14 13:03 compat_pci.h --r--r--r-- 1 mts mts 6453 Apr 14 13:03 compat_skbuff.h --r--r--r-- 1 mts mts 2764 Apr 14 13:03 compat_slab.h --r--r--r-- 1 mts mts 2438 Apr 14 13:03 compat_spinlock.h --r--r--r-- 1 mts mts 2795 Apr 14 13:03 compat_timer.h --r--r--r-- 1 mts mts 3189 Apr 14 13:03 compat_version.h --r--r--r-- 1 mts mts 2216 Apr 14 13:03 driver-config.h --r--r--r-- 1 mts mts 4262 Apr 14 13:03 includeCheck.h --r--r--r-- 1 mts mts 2426 Apr 14 13:03 net.h --r--r--r-- 1 mts mts 2240 Apr 14 13:03 net_sg.h --r--r--r-- 1 mts mts 21720 Apr 14 13:03 vm_basic_types.h --r--r--r-- 1 mts mts 7137 Apr 14 13:03 vm_device_version.h --r--r--r-- 1 mts mts 2915 Apr 14 13:03 vmnet_def.h --r--r--r-- 1 mts mts 68841 Apr 14 13:03 vmxnet.c --r--r--r-- 1 mts mts 14595 Apr 14 13:03 vmxnet2_def.h --r--r--r-- 1 mts mts 3735 Apr 14 13:03 vmxnetInt.h --r--r--r-- 1 mts mts 6793 Apr 14 13:03 vmxnet_def.h --r--r--r-- 1 mts mts 1168 Apr 14 13:03 vmxnet_version.h - -open-vm-tools-2008.04.14-87182/modules/linux/vmxnet/autoconf: +-r--r--r-- 1 mts mts 17987 May 2 15:24 COPYING +-r--r--r-- 1 mts mts 3760 May 2 15:24 Makefile +-r--r--r-- 1 mts mts 1279 May 2 15:24 Makefile.kernel +-r--r--r-- 1 mts mts 2665 May 2 15:24 Makefile.normal +-r--r--r-- 1 mts mts 460 May 2 15:24 README +drwxr-xr-x 2 mts mts 4096 May 2 15:24 autoconf +-r--r--r-- 1 mts mts 1966 May 2 15:24 bpf_meta.h +-r--r--r-- 1 mts mts 1734 May 2 15:24 compat_ethtool.h +-r--r--r-- 1 mts mts 1391 May 2 15:24 compat_highmem.h +-r--r--r-- 1 mts mts 1261 May 2 15:24 compat_init.h +-r--r--r-- 1 mts mts 1700 May 2 15:24 compat_interrupt.h +-r--r--r-- 1 mts mts 2081 May 2 15:24 compat_ioport.h +-r--r--r-- 1 mts mts 2298 May 2 15:24 compat_module.h +-r--r--r-- 1 mts mts 8121 May 2 15:24 compat_netdevice.h +-r--r--r-- 1 mts mts 16725 May 2 15:24 compat_pci.h +-r--r--r-- 1 mts mts 6453 May 2 15:24 compat_skbuff.h +-r--r--r-- 1 mts mts 2764 May 2 15:24 compat_slab.h +-r--r--r-- 1 mts mts 2438 May 2 15:24 compat_spinlock.h +-r--r--r-- 1 mts mts 2795 May 2 15:24 compat_timer.h +-r--r--r-- 1 mts mts 3189 May 2 15:24 compat_version.h +-r--r--r-- 1 mts mts 2216 May 2 15:24 driver-config.h +-r--r--r-- 1 mts mts 4262 May 2 15:24 includeCheck.h +-r--r--r-- 1 mts mts 2426 May 2 15:24 net.h +-r--r--r-- 1 mts mts 2240 May 2 15:24 net_sg.h +-r--r--r-- 1 mts mts 21741 May 2 15:24 vm_basic_types.h +-r--r--r-- 1 mts mts 7137 May 2 15:24 vm_device_version.h +-r--r--r-- 1 mts mts 2915 May 2 15:24 vmnet_def.h +-r--r--r-- 1 mts mts 68841 May 2 15:24 vmxnet.c +-r--r--r-- 1 mts mts 14595 May 2 15:24 vmxnet2_def.h +-r--r--r-- 1 mts mts 3735 May 2 15:24 vmxnetInt.h +-r--r--r-- 1 mts mts 6793 May 2 15:24 vmxnet_def.h +-r--r--r-- 1 mts mts 1168 May 2 15:24 vmxnet_version.h + +open-vm-tools-2008.05.02-90473/modules/linux/vmxnet/autoconf: total 8 --r--r--r-- 1 mts mts 1204 Apr 14 13:03 geninclude.c --r--r--r-- 1 mts mts 1400 Apr 14 13:03 skblin.c +-r--r--r-- 1 mts mts 1204 May 2 15:24 geninclude.c +-r--r--r-- 1 mts mts 1400 May 2 15:24 skblin.c -open-vm-tools-2008.04.14-87182/scripts: +open-vm-tools-2008.05.02-90473/scripts: total 44 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 common -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 freebsd -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 linux -drwxr-xr-x 2 mts mts 4096 Apr 14 13:03 solaris +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +drwxr-xr-x 2 mts mts 4096 May 2 15:25 common +drwxr-xr-x 2 mts mts 4096 May 2 15:25 freebsd +drwxr-xr-x 2 mts mts 4096 May 2 15:25 linux +drwxr-xr-x 2 mts mts 4096 May 2 15:25 solaris -open-vm-tools-2008.04.14-87182/scripts/common: +open-vm-tools-2008.05.02-90473/scripts/common: total 8 --r--r--r-- 1 mts mts 7452 Apr 14 13:03 vm-support +-r--r--r-- 1 mts mts 7452 May 2 15:25 vm-support -open-vm-tools-2008.04.14-87182/scripts/freebsd: +open-vm-tools-2008.05.02-90473/scripts/freebsd: total 16 --r--r--r-- 1 mts mts 1354 Apr 14 13:03 poweroff-vm-default --r--r--r-- 1 mts mts 1353 Apr 14 13:03 poweron-vm-default --r--r--r-- 1 mts mts 1393 Apr 14 13:03 resume-vm-default --r--r--r-- 1 mts mts 1750 Apr 14 13:03 suspend-vm-default +-r--r--r-- 1 mts mts 1354 May 2 15:25 poweroff-vm-default +-r--r--r-- 1 mts mts 1353 May 2 15:25 poweron-vm-default +-r--r--r-- 1 mts mts 1393 May 2 15:25 resume-vm-default +-r--r--r-- 1 mts mts 1750 May 2 15:25 suspend-vm-default -open-vm-tools-2008.04.14-87182/scripts/linux: +open-vm-tools-2008.05.02-90473/scripts/linux: total 16 --r--r--r-- 1 mts mts 1351 Apr 14 13:03 poweroff-vm-default --r--r--r-- 1 mts mts 1351 Apr 14 13:03 poweron-vm-default --r--r--r-- 1 mts mts 3042 Apr 14 13:03 resume-vm-default --r--r--r-- 1 mts mts 2638 Apr 14 13:03 suspend-vm-default +-r--r--r-- 1 mts mts 1351 May 2 15:25 poweroff-vm-default +-r--r--r-- 1 mts mts 1351 May 2 15:25 poweron-vm-default +-r--r--r-- 1 mts mts 3042 May 2 15:25 resume-vm-default +-r--r--r-- 1 mts mts 2638 May 2 15:25 suspend-vm-default -open-vm-tools-2008.04.14-87182/scripts/solaris: +open-vm-tools-2008.05.02-90473/scripts/solaris: total 16 --r--r--r-- 1 mts mts 1354 Apr 14 13:03 poweroff-vm-default --r--r--r-- 1 mts mts 1353 Apr 14 13:03 poweron-vm-default --r--r--r-- 1 mts mts 1553 Apr 14 13:03 resume-vm-default --r--r--r-- 1 mts mts 1904 Apr 14 13:03 suspend-vm-default +-r--r--r-- 1 mts mts 1354 May 2 15:25 poweroff-vm-default +-r--r--r-- 1 mts mts 1353 May 2 15:25 poweron-vm-default +-r--r--r-- 1 mts mts 1553 May 2 15:25 resume-vm-default +-r--r--r-- 1 mts mts 1904 May 2 15:25 suspend-vm-default -open-vm-tools-2008.04.14-87182/toolbox: +open-vm-tools-2008.05.02-90473/toolbox: total 176 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 2587 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 16961 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 2696 Apr 14 13:03 bigIcon.xpm --r--r--r-- 1 mts mts 6258 Apr 14 13:03 debugStdio.c --r--r--r-- 1 mts mts 458 Apr 14 13:03 smallIcon.xpm --r--r--r-- 1 mts mts 4731 Apr 14 13:03 stub.c --r--r--r-- 1 mts mts 29581 Apr 14 13:03 toolbox-gtk.c --r--r--r-- 1 mts mts 6323 Apr 14 13:03 toolboxAbout.c --r--r--r-- 1 mts mts 7085 Apr 14 13:03 toolboxDevices.c --r--r--r-- 1 mts mts 2835 Apr 14 13:03 toolboxInt.h --r--r--r-- 1 mts mts 3898 Apr 14 13:03 toolboxOptions.c --r--r--r-- 1 mts mts 24460 Apr 14 13:03 toolboxScripts.c --r--r--r-- 1 mts mts 14826 Apr 14 13:03 toolboxShrink.c --r--r--r-- 1 mts mts 1557 Apr 14 13:03 toolboxgtk_version.h - -open-vm-tools-2008.04.14-87182/vmware-user: -total 452 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 3906 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 18680 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 65156 Apr 14 13:03 copyPaste.c --r--r--r-- 1 mts mts 6258 Apr 14 13:03 debugStdio.c --r--r--r-- 1 mts mts 83230 Apr 14 13:03 dnd.c --r--r--r-- 1 mts mts 37366 Apr 14 13:03 foreignVMToolsDaemon.c --r--r--r-- 1 mts mts 6210 Apr 14 13:03 foreignVMToolsDaemon.h --r--r--r-- 1 mts mts 37055 Apr 14 13:03 foreignVMToolsNetworking.c --r--r--r-- 1 mts mts 54646 Apr 14 13:03 foundryToolsDaemon.c --r--r--r-- 1 mts mts 1766 Apr 14 13:03 foundryToolsDaemon.h --r--r--r-- 1 mts mts 7478 Apr 14 13:03 libvmwarectrl.c --r--r--r-- 1 mts mts 2031 Apr 14 13:03 libvmwarectrl.h --r--r--r-- 1 mts mts 5868 Apr 14 13:03 pointer.c --r--r--r-- 1 mts mts 16123 Apr 14 13:03 resolution.c --r--r--r-- 1 mts mts 4731 Apr 14 13:03 stub.c --r--r--r-- 1 mts mts 24364 Apr 14 13:03 vmware-user.c --r--r--r-- 1 mts mts 1868 Apr 14 13:03 vmwarectrl.h --r--r--r-- 1 mts mts 3636 Apr 14 13:03 vmwarectrlproto.h --r--r--r-- 1 mts mts 2857 Apr 14 13:03 vmwareuserInt.h --r--r--r-- 1 mts mts 1564 Apr 14 13:03 vmwareuser_version.h - -open-vm-tools-2008.04.14-87182/xferlogs: +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 2615 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 17046 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 2696 May 2 15:25 bigIcon.xpm +-r--r--r-- 1 mts mts 6258 May 2 15:25 debugStdio.c +-r--r--r-- 1 mts mts 458 May 2 15:25 smallIcon.xpm +-r--r--r-- 1 mts mts 4731 May 2 15:25 stub.c +-r--r--r-- 1 mts mts 29581 May 2 15:25 toolbox-gtk.c +-r--r--r-- 1 mts mts 6323 May 2 15:25 toolboxAbout.c +-r--r--r-- 1 mts mts 7085 May 2 15:25 toolboxDevices.c +-r--r--r-- 1 mts mts 2835 May 2 15:25 toolboxInt.h +-r--r--r-- 1 mts mts 3898 May 2 15:25 toolboxOptions.c +-r--r--r-- 1 mts mts 24460 May 2 15:25 toolboxScripts.c +-r--r--r-- 1 mts mts 14826 May 2 15:25 toolboxShrink.c +-r--r--r-- 1 mts mts 1557 May 2 15:25 toolboxgtk_version.h + +open-vm-tools-2008.05.02-90473/vmware-user: +total 456 +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 3938 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 18781 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 65610 May 2 15:25 copyPaste.c +-r--r--r-- 1 mts mts 6258 May 2 15:25 debugStdio.c +-r--r--r-- 1 mts mts 83230 May 2 15:25 dnd.c +-r--r--r-- 1 mts mts 37366 May 2 15:25 foreignVMToolsDaemon.c +-r--r--r-- 1 mts mts 6210 May 2 15:25 foreignVMToolsDaemon.h +-r--r--r-- 1 mts mts 37059 May 2 15:25 foreignVMToolsNetworking.c +-r--r--r-- 1 mts mts 54676 May 2 15:25 foundryToolsDaemon.c +-r--r--r-- 1 mts mts 1766 May 2 15:25 foundryToolsDaemon.h +-r--r--r-- 1 mts mts 7478 May 2 15:25 libvmwarectrl.c +-r--r--r-- 1 mts mts 2031 May 2 15:25 libvmwarectrl.h +-r--r--r-- 1 mts mts 6157 May 2 15:25 pointer.c +-r--r--r-- 1 mts mts 16123 May 2 15:25 resolution.c +-r--r--r-- 1 mts mts 4731 May 2 15:25 stub.c +-r--r--r-- 1 mts mts 24364 May 2 15:25 vmware-user.c +-r--r--r-- 1 mts mts 1868 May 2 15:25 vmwarectrl.h +-r--r--r-- 1 mts mts 3636 May 2 15:25 vmwarectrlproto.h +-r--r--r-- 1 mts mts 2896 May 2 15:25 vmwareuserInt.h +-r--r--r-- 1 mts mts 1564 May 2 15:25 vmwareuser_version.h + +open-vm-tools-2008.05.02-90473/xferlogs: total 64 --r--r--r-- 1 mts mts 26425 Apr 14 13:03 COPYING --r--r--r-- 1 mts mts 1504 Apr 14 13:03 Makefile.am --rw-r--r-- 1 mts mts 15135 Apr 14 13:03 Makefile.in --r--r--r-- 1 mts mts 9211 Apr 14 13:03 xferlogs.c --r--r--r-- 1 mts mts 1554 Apr 14 13:03 xferlogs_version.h +-r--r--r-- 1 mts mts 26425 May 2 15:25 COPYING +-r--r--r-- 1 mts mts 1533 May 2 15:25 Makefile.am +-rw-r--r-- 1 mts mts 15220 May 2 15:25 Makefile.in +-r--r--r-- 1 mts mts 9303 May 2 15:25 xferlogs.c +-r--r--r-- 1 mts mts 1554 May 2 15:25 xferlogs_version.h diff --git a/open-vm-tools/Makefile.in b/open-vm-tools/Makefile.in index 01941bf86..978edbee1 100644 --- a/open-vm-tools/Makefile.in +++ b/open-vm-tools/Makefile.in @@ -130,6 +130,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/NEWS b/open-vm-tools/NEWS index 89efafa33..e7c617016 100755 --- a/open-vm-tools/NEWS +++ b/open-vm-tools/NEWS @@ -1,3 +1,13 @@ +open-vm-tools 2008.05.02 changes: + * Continued Unicode support. + + * open-vm-tools now depends on libicu for codeset conversions. If you + wish to build open-vm-tools without libicu, pass "--without--icu" when + configuring the package. Without libicu, codeset conversions will be + done as before, via calls to iconv. + + * A few more bug fixes. + open-vm-tools 2008.04.14 changes: * Update the license stamp on all LGPL files. diff --git a/open-vm-tools/checkvm/Makefile.in b/open-vm-tools/checkvm/Makefile.in index f206db1b6..a76826c2a 100644 --- a/open-vm-tools/checkvm/Makefile.in +++ b/open-vm-tools/checkvm/Makefile.in @@ -117,6 +117,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/configure b/open-vm-tools/configure index f2c4afbb8..60c261256 100755 --- a/open-vm-tools/configure +++ b/open-vm-tools/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for open-vm-tools 2008.04.14-87182. +# Generated by GNU Autoconf 2.61 for open-vm-tools 2008.05.02-90473. # # Report bugs to . # @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='open-vm-tools' PACKAGE_TARNAME='open-vm-tools' -PACKAGE_VERSION='2008.04.14-87182' -PACKAGE_STRING='open-vm-tools 2008.04.14-87182' +PACKAGE_VERSION='2008.05.02-90473' +PACKAGE_STRING='open-vm-tools 2008.05.02-90473' PACKAGE_BUGREPORT='open-vm-tools-devel@lists.sourceforge.net' ac_unique_file="checkvm/checkvm.c" @@ -878,6 +878,7 @@ X_PRE_LIBS X_LIBS X_EXTRA_LIBS DNET_CONFIG +ICU_CONFIG BUILD_HGFSMOUNTER_TRUE BUILD_HGFSMOUNTER_FALSE LINUX_TRUE @@ -888,6 +889,8 @@ THIRTY_TWO_BIT_USERSPACE_TRUE THIRTY_TWO_BIT_USERSPACE_FALSE HAVE_X11_TRUE HAVE_X11_FALSE +NO_ICU_TRUE +NO_ICU_FALSE MODULES_OS MODULES COMMON_CFLAGS @@ -899,6 +902,8 @@ DNET_CFLAGS DNET_LIBS PROCPS_CFLAGS PROCPS_LIBS +ICU_CFLAGS +ICU_LIBS LIB_AUTH_CFLAGS LIB_FILE_CFLAGS LIB_HGFS_SERVER_CFLAGS @@ -1431,7 +1436,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures open-vm-tools 2008.04.14-87182 to adapt to many kinds of systems. +\`configure' configures open-vm-tools 2008.05.02-90473 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1505,7 +1510,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of open-vm-tools 2008.04.14-87182:";; + short | recursive ) echo "Configuration of open-vm-tools 2008.05.02-90473:";; esac cat <<\_ACEOF @@ -1533,6 +1538,7 @@ Optional Packages: meminfo) --without-dnet compile without libdnet (disables support for nicinfo) + --without-icu disable support for ICU Some influential environment variables: CC C compiler command @@ -1614,7 +1620,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -open-vm-tools configure 2008.04.14-87182 +open-vm-tools configure 2008.05.02-90473 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1628,7 +1634,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by open-vm-tools $as_me 2008.04.14-87182, which was +It was created by open-vm-tools $as_me 2008.05.02-90473, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2518,7 +2524,7 @@ fi # Define the identity of the package. PACKAGE='open-vm-tools' - VERSION='2008.04.14-87182' + VERSION='2008.05.02-90473' cat >>confdefs.h <<_ACEOF @@ -5578,7 +5584,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5581 "configure"' > conftest.$ac_ext + echo '#line 5587 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8079,11 +8085,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8082: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8088: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8086: \$? = $ac_status" >&5 + echo "$as_me:8092: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8347,11 +8353,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8350: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8356: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8354: \$? = $ac_status" >&5 + echo "$as_me:8360: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8451,11 +8457,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8454: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8460: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8458: \$? = $ac_status" >&5 + echo "$as_me:8464: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9916,7 +9922,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 9919 "configure"' > conftest.$ac_ext + echo '#line 9925 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10780,7 +10786,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13228: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13226: \$? = $ac_status" >&5 + echo "$as_me:13232: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13323,11 +13329,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13326: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13332: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13330: \$? = $ac_status" >&5 + echo "$as_me:13336: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13859,7 +13865,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 13862 "configure"' > conftest.$ac_ext + echo '#line 13868 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14917,11 +14923,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14920: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14926: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14924: \$? = $ac_status" >&5 + echo "$as_me:14930: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15021,11 +15027,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15024: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15030: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15028: \$? = $ac_status" >&5 + echo "$as_me:15034: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16466,7 +16472,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 16469 "configure"' > conftest.$ac_ext + echo '#line 16475 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -17243,11 +17249,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17246: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17252: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17250: \$? = $ac_status" >&5 + echo "$as_me:17256: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17511,11 +17517,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17514: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17520: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17518: \$? = $ac_status" >&5 + echo "$as_me:17524: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17615,11 +17621,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17618: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17624: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17622: \$? = $ac_status" >&5 + echo "$as_me:17628: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19080,7 +19086,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 19083 "configure"' > conftest.$ac_ext + echo '#line 19089 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -22945,6 +22951,142 @@ _ACEOF fi + +# Check whether --with-icu was given. +if test "${with_icu+set}" = set; then + withval=$with_icu; +else + with_icu=yes +fi + + +if test "$with_icu" = "yes"; then + + # Extract the first word of "icu-config", so it can be a program name with args. +set dummy icu-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_ICU_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ICU_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ICU_CONFIG="$ICU_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ICU_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_ICU_CONFIG" && ac_cv_path_ICU_CONFIG="no" + ;; +esac +fi +ICU_CONFIG=$ac_cv_path_ICU_CONFIG +if test -n "$ICU_CONFIG"; then + { echo "$as_me:$LINENO: result: $ICU_CONFIG" >&5 +echo "${ECHO_T}$ICU_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + + if test "$ICU_CONFIG" != no; then + ICU_CFLAGS="`$ICU_CONFIG --cppflags` -DUSE_ICU" + ICU_LIBS="`$ICU_CONFIG --ldflags`" + + { echo "$as_me:$LINENO: checking for ucasemap_utf8ToTitle_3_8 in -licuuc" >&5 +echo $ECHO_N "checking for ucasemap_utf8ToTitle_3_8 in -licuuc... $ECHO_C" >&6; } +if test "${ac_cv_lib_icuuc_ucasemap_utf8ToTitle_3_8+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-licuuc $ICU_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ucasemap_utf8ToTitle_3_8 (); +int +main () +{ +return ucasemap_utf8ToTitle_3_8 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_icuuc_ucasemap_utf8ToTitle_3_8=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_icuuc_ucasemap_utf8ToTitle_3_8=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_icuuc_ucasemap_utf8ToTitle_3_8" >&5 +echo "${ECHO_T}$ac_cv_lib_icuuc_ucasemap_utf8ToTitle_3_8" >&6; } +if test $ac_cv_lib_icuuc_ucasemap_utf8ToTitle_3_8 = yes; then + have_ICU_38="yes" +fi + + + if test "$have_ICU_38" = "yes"; then + ICU_CFLAGS="$ICU_CFLAGS -DHAVE_ICU_38" + fi + + # Easier to give all modules the ICU defines/includes... + COMMON_CFLAGS="$COMMON_CFLAGS $ICU_CFLAGS" + else + { { echo "$as_me:$LINENO: error: icu-config was not found on your PATH. Please configure without ICU (using --without-icu) or install ICU - http://www.icu-project.org" >&5 +echo "$as_me: error: icu-config was not found on your PATH. Please configure without ICU (using --without-icu) or install ICU - http://www.icu-project.org" >&2;} + { (exit 1); exit 1; }; } + fi +fi + ### ### Headers ### @@ -26362,6 +26504,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$ORIGINAL_CFLAGS" done COMMON_CFLAGS="$COMMON_CFLAGS -DVMX86_TOOLS" +COMMON_CFLAGS="$COMMON_CFLAGS -DNO_CORE_ICU" INCLUDE_DIR="`cd $srcdir; pwd`/lib/include" COMMON_CFLAGS="$COMMON_CFLAGS -I$INCLUDE_DIR" @@ -26463,6 +26606,14 @@ else HAVE_X11_FALSE= fi + if test "$with_icu" = "yes"; then + NO_ICU_TRUE= + NO_ICU_FALSE='#' +else + NO_ICU_TRUE='#' + NO_ICU_FALSE= +fi + ### Feature-specific flags / actions # Combine where possible @@ -26516,6 +26667,8 @@ fi + + ### Lib substs @@ -26732,6 +26885,13 @@ echo "$as_me: error: conditional \"HAVE_X11\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${NO_ICU_TRUE}" && test -z "${NO_ICU_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"NO_ICU\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"NO_ICU\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -27032,7 +27192,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by open-vm-tools $as_me 2008.04.14-87182, which was +This file was extended by open-vm-tools $as_me 2008.05.02-90473, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -27079,7 +27239,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -open-vm-tools config.status 2008.04.14-87182 +open-vm-tools config.status 2008.05.02-90473 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -27458,6 +27618,7 @@ X_PRE_LIBS!$X_PRE_LIBS$ac_delim X_LIBS!$X_LIBS$ac_delim X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim DNET_CONFIG!$DNET_CONFIG$ac_delim +ICU_CONFIG!$ICU_CONFIG$ac_delim BUILD_HGFSMOUNTER_TRUE!$BUILD_HGFSMOUNTER_TRUE$ac_delim BUILD_HGFSMOUNTER_FALSE!$BUILD_HGFSMOUNTER_FALSE$ac_delim LINUX_TRUE!$LINUX_TRUE$ac_delim @@ -27468,6 +27629,8 @@ THIRTY_TWO_BIT_USERSPACE_TRUE!$THIRTY_TWO_BIT_USERSPACE_TRUE$ac_delim THIRTY_TWO_BIT_USERSPACE_FALSE!$THIRTY_TWO_BIT_USERSPACE_FALSE$ac_delim HAVE_X11_TRUE!$HAVE_X11_TRUE$ac_delim HAVE_X11_FALSE!$HAVE_X11_FALSE$ac_delim +NO_ICU_TRUE!$NO_ICU_TRUE$ac_delim +NO_ICU_FALSE!$NO_ICU_FALSE$ac_delim MODULES_OS!$MODULES_OS$ac_delim MODULES!$MODULES$ac_delim COMMON_CFLAGS!$COMMON_CFLAGS$ac_delim @@ -27479,6 +27642,8 @@ DNET_CFLAGS!$DNET_CFLAGS$ac_delim DNET_LIBS!$DNET_LIBS$ac_delim PROCPS_CFLAGS!$PROCPS_CFLAGS$ac_delim PROCPS_LIBS!$PROCPS_LIBS$ac_delim +ICU_CFLAGS!$ICU_CFLAGS$ac_delim +ICU_LIBS!$ICU_LIBS$ac_delim LIB_AUTH_CFLAGS!$LIB_AUTH_CFLAGS$ac_delim LIB_FILE_CFLAGS!$LIB_FILE_CFLAGS$ac_delim LIB_HGFS_SERVER_CFLAGS!$LIB_HGFS_SERVER_CFLAGS$ac_delim @@ -27494,7 +27659,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 46; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 51; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index 92761bcc5..9085a1a7a 100755 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -24,7 +24,7 @@ AC_INIT( [open-vm-tools], - [2008.04.14-87182], + [2008.05.02-90473], [open-vm-tools-devel@lists.sourceforge.net]) # In order to make this configure script auto-detect situations where @@ -371,6 +371,39 @@ if test "$with_dnet" != "yes"; then AC_DEFINE([NO_DNET], 1) fi +AC_ARG_WITH([icu], + [AS_HELP_STRING([--without-icu], + [disable support for ICU])], + [], + [with_icu=yes]) + +if test "$with_icu" = "yes"; then + + AC_PATH_PROG([ICU_CONFIG], + [icu-config], + [no]) + + if test "$ICU_CONFIG" != no; then + ICU_CFLAGS="`$ICU_CONFIG --cppflags` -DUSE_ICU" + ICU_LIBS="`$ICU_CONFIG --ldflags`" + + AC_CHECK_LIB([icuuc], + [ucasemap_utf8ToTitle_3_8], + [have_ICU_38="yes"],, + [$ICU_LIBS]) + + if test "$have_ICU_38" = "yes"; then + ICU_CFLAGS="$ICU_CFLAGS -DHAVE_ICU_38" + fi + + # Easier to give all modules the ICU defines/includes... + COMMON_CFLAGS="$COMMON_CFLAGS $ICU_CFLAGS" + else + AC_MSG_ERROR( + [icu-config was not found on your PATH. Please configure without ICU (using --without-icu) or install ICU - http://www.icu-project.org]) + fi +fi + ### ### Headers ### @@ -514,6 +547,7 @@ for TEST_CFLAG in -Wno-pointer-sign -Wno-unused-value -fno-strict-aliasing \ CFLAGS="$ORIGINAL_CFLAGS" done COMMON_CFLAGS="$COMMON_CFLAGS -DVMX86_TOOLS" +COMMON_CFLAGS="$COMMON_CFLAGS -DNO_CORE_ICU" INCLUDE_DIR="`cd $srcdir; pwd`/lib/include" COMMON_CFLAGS="$COMMON_CFLAGS -I$INCLUDE_DIR" @@ -580,6 +614,7 @@ AM_CONDITIONAL(LINUX, test "$os" = "linux") AM_CONDITIONAL(SOLARIS, test "$os" = "solaris") AM_CONDITIONAL(THIRTY_TWO_BIT_USERSPACE, test "$userSpaceBitness" = "32") AM_CONDITIONAL(HAVE_X11, test "$have_x" = "yes") +AM_CONDITIONAL(NO_ICU, test "$with_icu" = "yes") ### Feature-specific flags / actions # Combine where possible @@ -629,6 +664,8 @@ AC_SUBST([DNET_CFLAGS]) AC_SUBST([DNET_LIBS]) AC_SUBST([PROCPS_CFLAGS]) AC_SUBST([PROCPS_LIBS]) +AC_SUBST([ICU_CFLAGS]) +AC_SUBST([ICU_LIBS]) ### Lib substs diff --git a/open-vm-tools/guestd/Makefile.am b/open-vm-tools/guestd/Makefile.am index 65e3be5b9..09b2a436b 100644 --- a/open-vm-tools/guestd/Makefile.am +++ b/open-vm-tools/guestd/Makefile.am @@ -75,6 +75,7 @@ else HGFS_BD = endif guestd_LDADD += $(HGFS_BD) +guestd_LDADD += @ICU_LIBS@ guestd_LDADD += @GUESTD_LDADD@ guestd_SOURCES = diff --git a/open-vm-tools/guestd/Makefile.in b/open-vm-tools/guestd/Makefile.in index 08ccc2405..84bc2aef2 100644 --- a/open-vm-tools/guestd/Makefile.in +++ b/open-vm-tools/guestd/Makefile.in @@ -150,6 +150,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -275,7 +278,7 @@ guestd_LDADD = ../lib/backdoor/libBackdoor.a ../lib/conf/libConf.a \ ../lib/unicode/libUnicode.a ../lib/misc/libMisc.a \ ../lib/foundryMsg/libFoundryMsg.a ../lib/auth/libAuth.a \ ../lib/panicDefault/libPanicDefault.a ../lib/panic/libPanic.a \ - $(HGFS_BD) @GUESTD_LDADD@ + $(HGFS_BD) @ICU_LIBS@ @GUESTD_LDADD@ @SOLARIS_FALSE@HGFS_BD = @SOLARIS_TRUE@HGFS_BD = ../lib/hgfsBd/libHgfsBd.a guestd_SOURCES = debugStdio.c foreignVMToolsDaemon.c \ diff --git a/open-vm-tools/guestd/foreignVMToolsNetworking.c b/open-vm-tools/guestd/foreignVMToolsNetworking.c index e1524284c..d675a1b2f 100644 --- a/open-vm-tools/guestd/foreignVMToolsNetworking.c +++ b/open-vm-tools/guestd/foreignVMToolsNetworking.c @@ -281,7 +281,7 @@ ForeignTools_InitializeNetworking(void) } #ifdef _WIN32 - hWs2_32 = LoadLibrary("ws2_32.dll"); + hWs2_32 = LoadLibrary(_T("ws2_32.dll")); if (NULL == hWs2_32) { goto abort; } diff --git a/open-vm-tools/guestd/foundryToolsDaemon.c b/open-vm-tools/guestd/foundryToolsDaemon.c index d4d587e37..fc83697ef 100644 --- a/open-vm-tools/guestd/foundryToolsDaemon.c +++ b/open-vm-tools/guestd/foundryToolsDaemon.c @@ -39,6 +39,7 @@ # include # include # include +# include "win32u.h" #elif _WIN32 # include "win95.h" #endif @@ -838,7 +839,7 @@ ToolsDaemonTcloSetPrinter(char const **result, // OUT /* Set this printer as the default if requested. */ if (defaultInt != 0) { - if (!SetDefaultPrinter(printerName)) { + if (!Win32U_SetDefaultPrinter(printerName)) { /* * We couldn't set this printer as default. Oh well. We'll * still report success or failure based purely on whether diff --git a/open-vm-tools/guestd/main.c b/open-vm-tools/guestd/main.c index 9b566cdcc..894483065 100644 --- a/open-vm-tools/guestd/main.c +++ b/open-vm-tools/guestd/main.c @@ -1764,6 +1764,7 @@ static Bool GuestdDaemon(GuestApp_Dict **pConfDict, // IN/OUT int *gDaemonSignalPtr) // IN/OUT { + Bool guestInfoEnabled = FALSE; #if !defined(__FreeBSD__) && !defined(sun) pid_t vmwareuserPid = 0; #endif @@ -1812,13 +1813,11 @@ GuestdDaemon(GuestApp_Dict **pConfDict, // IN/OUT ASSERT(data->in); - /* - * Set up the guest info 'server'. On Linux, a separate event loop thread - * is not spawned. - */ + /* Set up the guest info 'server'. */ if (!GuestInfoServer_Init(ToolsDaemonEventQueue)) { Warning("Unable to start guest info server.\n"); } else { + guestInfoEnabled = TRUE; GuestInfoServer_DisableDiskInfoQuery( GuestApp_GetDictEntryBool(*pConfDict, CONFNAME_DISABLEQUERYDISKINFO)); } @@ -1896,6 +1895,9 @@ GuestdDaemon(GuestApp_Dict **pConfDict, // IN/OUT NOT_REACHED(); out: + if (guestInfoEnabled) { + GuestInfoServer_Cleanup(); + } #if defined(VM_GUESTD_RUNS_HGFS_PSERVER) HgfsPserver_Cleanup(&globalHgfsState); #elif defined(VM_GUESTD_MOUNTS_HGFS) diff --git a/open-vm-tools/guestd/toolsDaemon.c b/open-vm-tools/guestd/toolsDaemon.c index d0c24385b..c843660f1 100644 --- a/open-vm-tools/guestd/toolsDaemon.c +++ b/open-vm-tools/guestd/toolsDaemon.c @@ -948,7 +948,15 @@ ToolsDaemonTcloCapReg(char const **result, // OUT TOOLS_DAEMON_NAME)) { Debug("ToolsDaemonTcloCapReg: Unable to register resolution server capability\n"); } - if (!RpcOut_sendOne(NULL, NULL, "tools.capability.display_topology_set 1")) { + /* + * Bug 149541: Windows 2000 does not currently support multimon. + * + * In addition, NT will never support multimon. 9x guests have + * frozen tools, and will report this capability set to 1, which + * current UIs will treat as unsupported. + */ + if (!RpcOut_sendOne(NULL, NULL, "tools.capability.display_topology_set %s", + System_GetOSType() >= OS_WINXP ? "2" : "0")) { Debug("ToolsDaemonTcloCapReg: Unable to register display topology set " "capability\n"); } diff --git a/open-vm-tools/hgfsclient/Makefile.am b/open-vm-tools/hgfsclient/Makefile.am index 151412dfd..cc1379017 100644 --- a/open-vm-tools/hgfsclient/Makefile.am +++ b/open-vm-tools/hgfsclient/Makefile.am @@ -43,6 +43,7 @@ hgfsclient_LDADD += ../lib/rpcVmx/libRpcVmx.a hgfsclient_LDADD += ../lib/unicode/libUnicode.a hgfsclient_LDADD += ../lib/sync/libSync.a hgfsclient_LDADD += ../lib/misc/libMisc.a +hgfsclient_LDADD += @ICU_LIBS@ hgfsclient_SOURCES = hgfsclient_SOURCES += hgfsclient.c diff --git a/open-vm-tools/hgfsclient/Makefile.in b/open-vm-tools/hgfsclient/Makefile.in index b6fed83e1..2f6d7ea63 100644 --- a/open-vm-tools/hgfsclient/Makefile.in +++ b/open-vm-tools/hgfsclient/Makefile.in @@ -127,6 +127,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -237,7 +240,7 @@ hgfsclient_LDADD = ../lib/conf/libConf.a ../lib/guestApp/libGuestApp.a \ ../lib/err/libErr.a ../lib/file/libFile.a \ ../lib/message/libMessage.a ../lib/rpcVmx/libRpcVmx.a \ ../lib/unicode/libUnicode.a ../lib/sync/libSync.a \ - ../lib/misc/libMisc.a + ../lib/misc/libMisc.a @ICU_LIBS@ hgfsclient_SOURCES = hgfsclient.c stub.c all: all-am diff --git a/open-vm-tools/hgfsmounter/Makefile.in b/open-vm-tools/hgfsmounter/Makefile.in index a44875692..6b3841f95 100644 --- a/open-vm-tools/hgfsmounter/Makefile.in +++ b/open-vm-tools/hgfsmounter/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/Makefile.in b/open-vm-tools/lib/Makefile.in index d8273e9a0..5326b3a77 100644 --- a/open-vm-tools/lib/Makefile.in +++ b/open-vm-tools/lib/Makefile.in @@ -109,6 +109,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/SLPv2Parser/Makefile.in b/open-vm-tools/lib/SLPv2Parser/Makefile.in index 7dfc7e9d7..c26d07c9c 100644 --- a/open-vm-tools/lib/SLPv2Parser/Makefile.in +++ b/open-vm-tools/lib/SLPv2Parser/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/atomic/Makefile.am b/open-vm-tools/lib/atomic/Makefile.am deleted file mode 100644 index 714ed73ac..000000000 --- a/open-vm-tools/lib/atomic/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -################################################################################ -### Copyright 2007 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU General Public License for more details. -### -### You should have received a copy of the GNU General Public License -### along with this program; if not, write to the Free Software -### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -noinst_LIBRARIES = libAtomic.a - -libAtomic_a_SOURCES = -libAtomic_a_SOURCES += atomic.c - -AM_CFLAGS = -AM_CFLAGS += @COMMON_CFLAGS@ - -SUBDIRS = -SUBDIRS += shared diff --git a/open-vm-tools/lib/atomic/Makefile.in b/open-vm-tools/lib/atomic/Makefile.in deleted file mode 100644 index 7781bea7f..000000000 --- a/open-vm-tools/lib/atomic/Makefile.in +++ /dev/null @@ -1,589 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -################################################################################ -### Copyright 2007 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU General Public License for more details. -### -### You should have received a copy of the GNU General Public License -### along with this program; if not, write to the Free Software -### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = lib/atomic -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -libAtomic_a_AR = $(AR) $(ARFLAGS) -libAtomic_a_LIBADD = -am_libAtomic_a_OBJECTS = atomic.$(OBJEXT) -libAtomic_a_OBJECTS = $(am_libAtomic_a_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libAtomic_a_SOURCES) -DIST_SOURCES = $(libAtomic_a_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COMMON_CFLAGS = @COMMON_CFLAGS@ -COMMON_PROG_CFLAGS = @COMMON_PROG_CFLAGS@ -COMMON_XLIBS = @COMMON_XLIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DNET_CFLAGS = @DNET_CFLAGS@ -DNET_CONFIG = @DNET_CONFIG@ -DNET_LIBS = @DNET_LIBS@ -DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -GUESTD_LDFLAGS = @GUESTD_LDFLAGS@ -HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIB_AUTH_CFLAGS = @LIB_AUTH_CFLAGS@ -LIB_FILE_CFLAGS = @LIB_FILE_CFLAGS@ -LIB_HGFS_SERVER_CFLAGS = @LIB_HGFS_SERVER_CFLAGS@ -LIB_IMPERSONATE_CFLAGS = @LIB_IMPERSONATE_CFLAGS@ -LIB_MISC_CFLAGS = @LIB_MISC_CFLAGS@ -LIB_PROC_MGR_CFLAGS = @LIB_PROC_MGR_CFLAGS@ -LIB_STRING_CFLAGS = @LIB_STRING_CFLAGS@ -LIB_USER_CFLAGS = @LIB_USER_CFLAGS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MODULES = @MODULES@ -MODULES_OS = @MODULES_OS@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -VMWARE_USER_CFLAGS = @VMWARE_USER_CFLAGS@ -VMWARE_USER_LDFLAGS = @VMWARE_USER_LDFLAGS@ -XMKMF = @XMKMF@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LIBRARIES = libAtomic.a -libAtomic_a_SOURCES = atomic.c -AM_CFLAGS = @COMMON_CFLAGS@ -SUBDIRS = shared -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/atomic/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu lib/atomic/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libAtomic.a: $(libAtomic_a_OBJECTS) $(libAtomic_a_DEPENDENCIES) - -rm -f libAtomic.a - $(libAtomic_a_AR) libAtomic.a $(libAtomic_a_OBJECTS) $(libAtomic_a_LIBADD) - $(RANLIB) libAtomic.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(LIBRARIES) -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - clean-noinstLIBRARIES ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/open-vm-tools/lib/atomic/shared/Makefile.am b/open-vm-tools/lib/atomic/shared/Makefile.am deleted file mode 100644 index 339905626..000000000 --- a/open-vm-tools/lib/atomic/shared/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -### Copyright 2007 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU General Public License for more details. -### -### You should have received a copy of the GNU General Public License -### along with this program; if not, write to the Free Software -### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -noinst_LTLIBRARIES = libAtomic.la - -libAtomic_la_SOURCES = -libAtomic_la_SOURCES += ../atomic.c - -AM_CFLAGS = -AM_CFLAGS += @COMMON_CFLAGS@ \ No newline at end of file diff --git a/open-vm-tools/lib/atomic/shared/Makefile.in b/open-vm-tools/lib/atomic/shared/Makefile.in deleted file mode 100644 index 4f1279bdd..000000000 --- a/open-vm-tools/lib/atomic/shared/Makefile.in +++ /dev/null @@ -1,483 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -################################################################################ -### Copyright 2007 VMware, Inc. All rights reserved. -### -### This program is free software; you can redistribute it and/or modify -### it under the terms of version 2 of the GNU General Public License as -### published by the Free Software Foundation. -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU General Public License for more details. -### -### You should have received a copy of the GNU General Public License -### along with this program; if not, write to the Free Software -### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -################################################################################ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = lib/atomic/shared -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libAtomic_la_LIBADD = -am_libAtomic_la_OBJECTS = atomic.lo -libAtomic_la_OBJECTS = $(am_libAtomic_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libAtomic_la_SOURCES) -DIST_SOURCES = $(libAtomic_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COMMON_CFLAGS = @COMMON_CFLAGS@ -COMMON_PROG_CFLAGS = @COMMON_PROG_CFLAGS@ -COMMON_XLIBS = @COMMON_XLIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DNET_CFLAGS = @DNET_CFLAGS@ -DNET_CONFIG = @DNET_CONFIG@ -DNET_LIBS = @DNET_LIBS@ -DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -GUESTD_LDFLAGS = @GUESTD_LDFLAGS@ -HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIB_AUTH_CFLAGS = @LIB_AUTH_CFLAGS@ -LIB_FILE_CFLAGS = @LIB_FILE_CFLAGS@ -LIB_HGFS_SERVER_CFLAGS = @LIB_HGFS_SERVER_CFLAGS@ -LIB_IMPERSONATE_CFLAGS = @LIB_IMPERSONATE_CFLAGS@ -LIB_MISC_CFLAGS = @LIB_MISC_CFLAGS@ -LIB_PROC_MGR_CFLAGS = @LIB_PROC_MGR_CFLAGS@ -LIB_STRING_CFLAGS = @LIB_STRING_CFLAGS@ -LIB_USER_CFLAGS = @LIB_USER_CFLAGS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MODULES = @MODULES@ -MODULES_OS = @MODULES_OS@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -VMWARE_USER_CFLAGS = @VMWARE_USER_CFLAGS@ -VMWARE_USER_LDFLAGS = @VMWARE_USER_LDFLAGS@ -XMKMF = @XMKMF@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libAtomic.la -libAtomic_la_SOURCES = ../atomic.c -AM_CFLAGS = @COMMON_CFLAGS@ -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/atomic/shared/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu lib/atomic/shared/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libAtomic.la: $(libAtomic_la_OBJECTS) $(libAtomic_la_DEPENDENCIES) - $(LINK) $(libAtomic_la_OBJECTS) $(libAtomic_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -atomic.lo: ../atomic.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT atomic.lo -MD -MP -MF $(DEPDIR)/atomic.Tpo -c -o atomic.lo `test -f '../atomic.c' || echo '$(srcdir)/'`../atomic.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/atomic.Tpo $(DEPDIR)/atomic.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../atomic.c' object='atomic.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o atomic.lo `test -f '../atomic.c' || echo '$(srcdir)/'`../atomic.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/open-vm-tools/lib/auth/Makefile.in b/open-vm-tools/lib/auth/Makefile.in index a26d16e2b..3d35e3512 100644 --- a/open-vm-tools/lib/auth/Makefile.in +++ b/open-vm-tools/lib/auth/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/auth/authPosix.c b/open-vm-tools/lib/auth/authPosix.c index 293d59c71..e747c7c4f 100644 --- a/open-vm-tools/lib/auth/authPosix.c +++ b/open-vm-tools/lib/auth/authPosix.c @@ -104,7 +104,7 @@ AuthLoadPAM(void) if (authPamLibraryHandle) { return TRUE; } - pam_library = dlopen(CURRENT_PAM_LIBRARY, RTLD_LAZY | RTLD_GLOBAL); + pam_library = Posix_Dlopen(CURRENT_PAM_LIBRARY, RTLD_LAZY | RTLD_GLOBAL); if (!pam_library) { #if !defined(VMX86_TOOLS) char liblocation[FILE_MAXPATH]; @@ -117,7 +117,9 @@ AuthLoadPAM(void) } snprintf(liblocation, sizeof liblocation, "%s/lib/%s/%s", libdir, CURRENT_PAM_LIBRARY, CURRENT_PAM_LIBRARY); - pam_library = dlopen(liblocation, RTLD_LAZY | RTLD_GLOBAL); + free(libdir); + + pam_library = Posix_Dlopen(liblocation, RTLD_LAZY | RTLD_GLOBAL); if (!pam_library) { Log("Neither system nor bundled (%s) PAM libraries usable: %s\n", liblocation, dlerror()); diff --git a/open-vm-tools/lib/backdoor/Makefile.in b/open-vm-tools/lib/backdoor/Makefile.in index 4bf4f0aa8..137c2bf8a 100644 --- a/open-vm-tools/lib/backdoor/Makefile.in +++ b/open-vm-tools/lib/backdoor/Makefile.in @@ -137,6 +137,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/backdoor/shared/Makefile.in b/open-vm-tools/lib/backdoor/shared/Makefile.in index 64fc1bdd6..5c2a3708e 100644 --- a/open-vm-tools/lib/backdoor/shared/Makefile.in +++ b/open-vm-tools/lib/backdoor/shared/Makefile.in @@ -123,6 +123,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/conf/Makefile.in b/open-vm-tools/lib/conf/Makefile.in index 7ae51f7d8..319877613 100644 --- a/open-vm-tools/lib/conf/Makefile.in +++ b/open-vm-tools/lib/conf/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/deployPkg/Makefile.in b/open-vm-tools/lib/deployPkg/Makefile.in index 7a3eadff3..f1b8d510d 100644 --- a/open-vm-tools/lib/deployPkg/Makefile.in +++ b/open-vm-tools/lib/deployPkg/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/dict/Makefile.in b/open-vm-tools/lib/dict/Makefile.in index d3911ca79..b976a1551 100644 --- a/open-vm-tools/lib/dict/Makefile.in +++ b/open-vm-tools/lib/dict/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/dict/dictll.c b/open-vm-tools/lib/dict/dictll.c index fc03654ac..cd1730ae7 100644 --- a/open-vm-tools/lib/dict/dictll.c +++ b/open-vm-tools/lib/dict/dictll.c @@ -34,6 +34,8 @@ #include "dictll.h" #include "util.h" +#define UTF8_BOM "\xEF\xBB\xBF" + /* Duplicate a buffer --hpreg. The result is NUL-terminated */ static void * @@ -330,6 +332,11 @@ DictLL_ReadLine(FILE *stream, // IN: stream to read char *myLine; size_t myLineLen; + if (stream != stdin && ftell(stream) == 0) { + // Tolerate UTF-8 files from Windows Notepad that start with funny bytes. + DictLL_ReadUTF8BOM(stream); + } + ASSERT(stream); ASSERT(line); ASSERT(name); @@ -380,7 +387,7 @@ DictLL_ReadLine(FILE *stream, // IN: stream to read */ Bool -DictLL_MarshalLine(DynBuf *output, // IN: output buffer +DictLL_MarshalLine(DynBuf *output, // IN/OUT: output buffer char const *name, // IN: name to marshal char const *value) // IN: value to marshal { @@ -485,3 +492,45 @@ DictLL_WriteLine(FILE *stream, // IN: stream to write DynBuf_Destroy(&buf); return TRUE; } + + +/* + *----------------------------------------------------------------------------- + * + * DictLL_ReadUTF8BOM -- + * + * Reads a UTF-8 BOM from a file. + * + * Results: + * If successful, returns TRUE and updates the file position. + * Returns FALSE if a UTF-8 BOM was not found. + * + * Side effects: + * Might clears the error indicator of the file stream. + * + *----------------------------------------------------------------------------- + */ + +Bool +DictLL_ReadUTF8BOM(FILE *file) // IN/OUT +{ + Bool found; + + // sizeof on a string literal counts NUL. Exclude it. + char buf[sizeof UTF8_BOM - 1] = { 0 }; + + if (file == stdin) { + return FALSE; + } + + ASSERT(ftell(file) == 0); + + found = fread(buf, sizeof buf, 1, file) == 1 + && memcmp(UTF8_BOM, buf, sizeof buf) == 0; + + if (!found) { + rewind(file); + } + + return found; +} diff --git a/open-vm-tools/lib/dnd/Makefile.in b/open-vm-tools/lib/dnd/Makefile.in index 703e2b1ce..2460b1ce0 100644 --- a/open-vm-tools/lib/dnd/Makefile.in +++ b/open-vm-tools/lib/dnd/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/dnd/dndLinux.c b/open-vm-tools/lib/dnd/dndLinux.c index d4442b308..fe19be031 100644 --- a/open-vm-tools/lib/dnd/dndLinux.c +++ b/open-vm-tools/lib/dnd/dndLinux.c @@ -346,7 +346,7 @@ DnD_InitializeBlocking(void) } /* Open device node for communication with vmblock. */ - blockFd = open(VMBLOCK_DEVICE, VMBLOCK_DEVICE_MODE); + blockFd = Posix_Open(VMBLOCK_DEVICE, VMBLOCK_DEVICE_MODE); if (blockFd < 0) { LOG(1, ("DnD_InitializeBlocking: Can not open blocker device (%s)\n", strerror(errno))); diff --git a/open-vm-tools/lib/err/Makefile.in b/open-vm-tools/lib/err/Makefile.in index 55be3939d..ccb0d847a 100644 --- a/open-vm-tools/lib/err/Makefile.in +++ b/open-vm-tools/lib/err/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/err/err.c b/open-vm-tools/lib/err/err.c index 3388518d3..799aada64 100644 --- a/open-vm-tools/lib/err/err.c +++ b/open-vm-tools/lib/err/err.c @@ -23,11 +23,49 @@ * */ -#ifdef _WIN32 -# include "win32util.h" -#endif +#include "vmware.h" +#include "errInt.h" +#include "str.h" +#include "vm_atomic.h" +#include "hashTable.h" +#include "util.h" +#include "codeset.h" + + +/* + * Constants + */ + +#define HASHTABLE_SIZE 2048 -#include "err.h" + +/* + * Types + */ + +typedef struct ErrInfo { + Err_Number number; + char *string; +} ErrInfo; + + +/* + * Variables + */ + +static Atomic_Ptr errNumTable; +static Atomic_Ptr errPtrTable; + +#define NUMTABLE() HashTable_AllocOnce(&errNumTable, HASHTABLE_SIZE, \ + HASH_INT_KEY | HASH_FLAG_ATOMIC, NULL) +#define PTRTABLE() HashTable_AllocOnce(&errPtrTable, HASHTABLE_SIZE, \ + HASH_INT_KEY | HASH_FLAG_ATOMIC, NULL) +#ifdef VMX86_DEBUG +Atomic_Ptr errStrTable; +#define STRTABLE() HashTable_AllocOnce(&errStrTable, HASHTABLE_SIZE, \ + HASH_STRING_KEY | HASH_FLAG_ATOMIC, \ + NULL) +#endif /* @@ -37,13 +75,12 @@ * * Returns a string that corresponds to the last error message. * - * TODO: Return UTF8 or a Unicode object. - * * Results: * Error message string. * * Side effects: * None. + * Current error number is preserved. * *---------------------------------------------------------------------- */ @@ -53,3 +90,185 @@ Err_ErrString(void) { return Err_Errno2String(Err_Errno()); } + + +/* + *---------------------------------------------------------------------- + * + * Err_Errno2String -- + * + * Return a string that corresponds to the passed error number. + * + * The string is in English in UTF-8, has indefinite lifetime, + * and need not be freed. + * + * Results: + * Error message string in UTF-8. + * + * Side effects: + * None. + * Current error number is preserved. + * + *---------------------------------------------------------------------- + */ + +const char * +Err_Errno2String(Err_Number errorNumber) // IN +{ + HashTable *numTable; + HashTable *ptrTable; + ErrInfo *info; + ErrInfo *oldInfo; + Err_Number oldErrno = Err_Errno(); + + ASSERT(errorNumber != ERR_INVALID); + + /* + * Look up the error in numTable. + * Or insert it if it's not there. + */ + + numTable = NUMTABLE(); + if (!HashTable_Lookup(numTable, (void *) (uintptr_t) errorNumber, + (void **) &info)) { + char buf[2048]; + const char *p; + size_t n; + + /* + * Convert number to string and build the info structure. + */ + + p = ErrErrno2String(errorNumber, buf, sizeof buf); + + info = Util_SafeMalloc(sizeof *info); + info->number = errorNumber; + info->string = Util_SafeStrdup(p); + + /* + * To be safe, make sure the end of the string is at + * a UTF-8 boundary, but we can only do this when the + * string is in our buffer (it may not be). + */ + + n = strlen(info->string); + n = CodeSet_Utf8FindCodePointBoundary(info->string, n); + info->string[n] = '\0'; + + /* + * Try to insert new info into numTable. + * If that fails, then we must have lost out to someone else. + * Use theirs in that case. + */ + + oldInfo = HashTable_LookupOrInsert(numTable, + (void *) (uintptr_t) errorNumber, + info); + if (oldInfo != info) { + ASSERT(oldInfo->number == info->number); + ASSERT(Str_Strcmp(oldInfo->string, info->string) == 0); + free(info->string); + free(info); + info = oldInfo; + } + } + + /* + * Try to insert info into ptrTable. + * We need to do it even if we didn't create this entry, + * because we may get here before the other guy (who created + * the entry and inserted it into numTable). + */ + + ptrTable = PTRTABLE(); + oldInfo = HashTable_LookupOrInsert(ptrTable, info->string, info); + ASSERT(oldInfo == info); + +#ifdef VMX86_DEBUG + { + HashTable *strTable = STRTABLE(); + ErrInfo *i = HashTable_LookupOrInsert(strTable, info->string, info); + ASSERT(i == info); + } +#endif + + Err_SetErrno(oldErrno); + return info->string; +} + + +/* + *---------------------------------------------------------------------- + * + * Err_String2Errno -- + * + * Return an error number that corresponds to the passed string. + * + * To be recognized, the string must be one previously returned + * by Err_Errno2String. Any other string (even a copy of + * a valid error string) returns ERR_INVALID. + * + * Results: + * Error number or ERR_INVALID. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Err_Number +Err_String2Errno(const char *string) // IN +{ + HashTable *ptrTable = PTRTABLE(); + ErrInfo *info; + + if (!HashTable_Lookup(ptrTable, string, (void **) &info)) { + return ERR_INVALID; + } + + ASSERT(info->string == string); + ASSERT(info->number != ERR_INVALID); + return info->number; +} + + +#ifdef VMX86_DEBUG +/* + *---------------------------------------------------------------------- + * + * Err_String2ErrnoDebug -- + * + * Return an error number that corresponds to the passed string. + * + * This is the debug version that uses the whole string as key, + * instead of just the address. + * + * Results: + * Error number or ERR_INVALID. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Err_Number +Err_String2ErrnoDebug(const char *string) // IN +{ + HashTable *strTable = STRTABLE(); + ErrInfo *info; + + if (!HashTable_Lookup(strTable, string, (void **) &info)) { + return ERR_INVALID; + } + + ASSERT(Str_Strcmp(info->string, string) == 0); + ASSERT(info->number != ERR_INVALID); + if (info->string != string) { + Log("%s: errno %d, string \"%s\" at %p, originally at %p.\n", + __FUNCTION__, info->number, string, string, info->string); + } + return info->number; +} +#endif diff --git a/open-vm-tools/lib/atomic/atomic.c b/open-vm-tools/lib/err/errInt.h similarity index 54% rename from open-vm-tools/lib/atomic/atomic.c rename to open-vm-tools/lib/err/errInt.h index 6ec91f970..b562b2108 100644 --- a/open-vm-tools/lib/atomic/atomic.c +++ b/open-vm-tools/lib/err/errInt.h @@ -7,19 +7,31 @@ * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public + * License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * *********************************************************/ -#include "vm_atomic.h" - /* - * Global flag for using fence after interlocked instructions. - * Please see PR107024 for details. + * errInt.h -- + * + * Internal definitions for the Err module. */ -Bool AtomicUseFence = FALSE; + +#ifndef _ERRINT_H_ +#define _ERRINT_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#include "includeCheck.h" + +#include "err.h" + + +const char *ErrErrno2String(Err_Number errorNumber, char *buf, size_t bufSize); + + +#endif // ifndef _ERRINT_H_ diff --git a/open-vm-tools/lib/err/errPosix.c b/open-vm-tools/lib/err/errPosix.c index f26c4ebec..84a916969 100644 --- a/open-vm-tools/lib/err/errPosix.c +++ b/open-vm-tools/lib/err/errPosix.c @@ -25,31 +25,95 @@ #include #include +#include +#include "vmware.h" +#include "errInt.h" +#include "util.h" #include "str.h" -#include "err.h" /* *---------------------------------------------------------------------- * - * Err_Errno2String -- + * ErrErrno2String -- * - * Returns a string that corresponds to the passed error number. + * Convert an error number to a string in English. + * The returned string may use the supplied buffer or may be + * a static string. * * Results: - * Error message string. + * The error string. * * Side effects: * None. * - * The result should be printed or copied before calling again. - * *---------------------------------------------------------------------- */ const char * -Err_Errno2String(Err_Number errorNumber) // IN +ErrErrno2String(Err_Number errorNumber, // IN + char *buf, // OUT: return buffer + size_t bufSize) // IN: size of buffer +{ + char *p; + +#if defined(linux) && !defined(N_PLAT_NLM) + p = strerror_r(errorNumber, buf, bufSize); +#else + p = strerror(errorNumber); +#endif + ASSERT(p != NULL); + return p; +} + + +/* + *---------------------------------------------------------------------- + * + * Err_Errno2LocalString -- + * + * Returns a localized string in UTF-8 that corresponds to the + * passed error number. + * + * XXX doesn't actually work + * + * Results: + * Allocated error message string, caller must free. + * NULL on failure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Err_Errno2LocalString(Err_Number errorNumber) // IN { - return strerror(errorNumber); + /* + * XXX The version of glibc (2.2.x) we use doesn't support + * uselocal() or strerror_l(), and we can't set LC_MESSAGES + * globally, so we can't implement this function. + * Instead, we return NULL and the upper level code + * (Msg_LocalizeList1) generates some sort of message. + * We can't do that here because it would require using + * Msg_Format, which is a layer violation (and a linking + * problem). + */ + +#if 0 + // XXX need to cache newLocale if we ever actually use this code + locale_t newLocale = newlocale(1 << LC_MESSAGES, NULL, NULL); + locale_t oldLocale = uselocale(newLocale); + char buf[2048]; + char *p; + + p = strerror_r(errorNumber, buf, sizeof buf); + ASSERT_NOT_IMPLEMENTED(p != NULL); + uselocale(oldLocale); + return Util_SafeStrdup(p); +#else + return NULL; +#endif } diff --git a/open-vm-tools/lib/eventManager/Makefile.in b/open-vm-tools/lib/eventManager/Makefile.in index 39dab38d6..7ab32c695 100644 --- a/open-vm-tools/lib/eventManager/Makefile.in +++ b/open-vm-tools/lib/eventManager/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/file/Makefile.in b/open-vm-tools/lib/file/Makefile.in index 305e5875c..42aaaf8ed 100644 --- a/open-vm-tools/lib/file/Makefile.in +++ b/open-vm-tools/lib/file/Makefile.in @@ -120,6 +120,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c index a06af040f..10764e9a9 100644 --- a/open-vm-tools/lib/file/file.c +++ b/open-vm-tools/lib/file/file.c @@ -401,7 +401,7 @@ FileLockGetMachineID(void) if (q == NULL) { p = (char *) GetOldMachineID(); } else { - p = Str_Asprintf(NULL, "uuid=%s", q); + p = Str_SafeAsprintf(NULL, "uuid=%s", q); free(q); /* Surpress any whitespace. */ @@ -1808,9 +1808,8 @@ File_PrependToPath(const char *searchPath, // IN ASSERT(searchPath); ASSERT(elem); - newPath = Str_Asprintf(NULL, "%s" FILE_SEARCHPATHTOKEN "%s", + newPath = Str_SafeAsprintf(NULL, "%s" FILE_SEARCHPATHTOKEN "%s", elem, searchPath); - ASSERT_MEM_ALLOC(newPath); n = strlen(elem); path = newPath + n + 1; @@ -1877,7 +1876,7 @@ File_FindFileInSearchPath(const char *fileIn, // IN if (File_IsFullPath(fileIn)) { cur = Util_SafeStrdup(fileIn); } else { - cur = Str_Asprintf(NULL, "%s"DIRSEPS"%s", cwd, fileIn); + cur = Str_SafeAsprintf(NULL, "%s"DIRSEPS"%s", cwd, fileIn); } if (File_Exists(cur)) { @@ -1897,15 +1896,15 @@ File_FindFileInSearchPath(const char *fileIn, // IN while (tok) { if (File_IsFullPath(tok)) { /* Fully Qualified Path. Use it. */ - cur = Str_Asprintf(NULL, "%s%s%s", tok, DIRSEPS, file); + cur = Str_SafeAsprintf(NULL, "%s%s%s", tok, DIRSEPS, file); } else { /* Relative Path. Prepend the cwd. */ if (Str_Strcasecmp(tok, ".") == 0) { /* Don't append "." */ - cur = Str_Asprintf(NULL, "%s"DIRSEPS"%s", cwd, file); + cur = Str_SafeAsprintf(NULL, "%s"DIRSEPS"%s", cwd, file); } else { - cur = Str_Asprintf(NULL, "%s"DIRSEPS"%s"DIRSEPS"%s", cwd, - tok, file); + cur = Str_SafeAsprintf(NULL, "%s"DIRSEPS"%s"DIRSEPS"%s", cwd, + tok, file); } } diff --git a/open-vm-tools/lib/file/fileIOPosix.c b/open-vm-tools/lib/file/fileIOPosix.c index 47c738f32..6807e6167 100644 --- a/open-vm-tools/lib/file/fileIOPosix.c +++ b/open-vm-tools/lib/file/fileIOPosix.c @@ -703,7 +703,6 @@ FileIO_Create(FileIODescriptor *file, // OUT: int flags = 0; int error; FileIOResult ret; - char *path = NULL; ASSERT(file); @@ -795,15 +794,13 @@ FileIO_Create(FileIODescriptor *file, // OUT: SuperUser(TRUE); } - path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); - flags |= #if defined(linux) && !defined(N_PLAT_NLM) ((access & FILEIO_OPEN_SYNC) ? O_SYNC : 0) | #endif FileIO_OpenActions[action]; - fd = PosixFileOpener(path, flags, mode); + fd = PosixFileOpener(pathName, flags, mode); error = errno; @@ -857,14 +854,12 @@ FileIO_Create(FileIODescriptor *file, // OUT: * Remove the name from the name space. The file remains laid out on the * disk and accessible through the file descriptor until it is closed. */ - if (unlink(path) == -1) { + if (Posix_Unlink(pathName) == -1) { ret = FileIOErrno2Result(errno); goto error; } } - free(path); - file->posix = fd; FileIO_StatsInit(file); @@ -874,8 +869,6 @@ FileIO_Create(FileIODescriptor *file, // OUT: error: error = errno; - free(path); - if (fd != -1) { close(fd); } @@ -1320,8 +1313,7 @@ FileIOCoalesce(struct iovec *inVec, // IN: Vector to coalesce from // XXX: Wouldn't it be nice if we could log from here! //LOG(5, ("FILE: Coalescing %s of %d elements and %d size\n", // isWrite ? "write" : "read", inCount, inTotalSize)); - cBuf = malloc(sizeof(uint8) * inTotalSize); - ASSERT_MEM_ALLOC(cBuf); + cBuf = Util_SafeMalloc(sizeof(uint8) * inTotalSize); if (isWrite) { IOV_WriteIovToBuf(inVec, inCount, cBuf, inTotalSize); @@ -1872,9 +1864,7 @@ FileIOResult FileIO_Access(ConstUnicode pathName, // IN: path name to be tested int accessMode) // IN: access modes to be asserted { - FileIOResult err; int mode; - char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); mode = 0; if (accessMode & FILEIO_ACCESS_READ) { @@ -1890,10 +1880,7 @@ FileIO_Access(ConstUnicode pathName, // IN: path name to be tested mode |= F_OK; } - err = access(path, mode) == -1 ? FILEIO_ERROR : FILEIO_SUCCESS; - - free(path); - return err; + return (Posix_Access(pathName, mode) == -1) ? FILEIO_ERROR : FILEIO_SUCCESS; } diff --git a/open-vm-tools/lib/file/fileLockPosix.c b/open-vm-tools/lib/file/fileLockPosix.c index 374ec74a6..4c14491cf 100644 --- a/open-vm-tools/lib/file/fileLockPosix.c +++ b/open-vm-tools/lib/file/fileLockPosix.c @@ -564,18 +564,18 @@ FileLock_LockDevice(const char *deviceName) // IN: { const char *hostID; char uniqueID[1000]; - char lockFileName[FILE_MAXPATH]; - char lockFileLink[FILE_MAXPATH]; + char *lockFileName; + char *lockFileLink; int status = -1; ASSERT(deviceName); - Str_Sprintf(lockFileName, sizeof lockFileName, "%s/LCK..%s", - DEVICE_LOCK_DIR, deviceName); + lockFileName = Str_SafeAsprintf(NULL, "%s/LCK..%s", DEVICE_LOCK_DIR, + deviceName); - Str_Sprintf(lockFileLink, sizeof lockFileLink, "%s/LTMP..%s.t%05d", - DEVICE_LOCK_DIR, deviceName, FileLockGetPid()); + lockFileLink = Str_SafeAsprintf(NULL, "%s/LTMP..%s.t%05d", DEVICE_LOCK_DIR, + deviceName, FileLockGetPid()); LOG(1, ("Requesting lock %s (temp = %s).\n", lockFileName, lockFileLink)); @@ -627,6 +627,8 @@ FileLock_LockDevice(const char *deviceName) // IN: } exit: + free(lockFileName); + free(lockFileLink); return status; } @@ -653,12 +655,11 @@ FileLock_UnlockDevice(const char *deviceName) // IN: Bool su; int ret; int saveErrno; - char path[FILE_MAXPATH]; + char *path; ASSERT(deviceName); - Str_Sprintf(path, sizeof path, "%s/LCK..%s", - DEVICE_LOCK_DIR, deviceName); + path = Str_SafeAsprintf(NULL, "%s/LCK..%s", DEVICE_LOCK_DIR, deviceName); LOG(1, ("Releasing lock %s.\n", path)); @@ -671,10 +672,13 @@ FileLock_UnlockDevice(const char *deviceName) // IN: if (ret < 0) { Log(LGPFX" Cannot remove lock file %s (%s).\n", path, strerror(saveErrno)); + free(path); return FALSE; } + free(path); + return TRUE; } diff --git a/open-vm-tools/lib/file/fileLockPrimitive.c b/open-vm-tools/lib/file/fileLockPrimitive.c index c1d3fbb9c..d3b3dfb8d 100644 --- a/open-vm-tools/lib/file/fileLockPrimitive.c +++ b/open-vm-tools/lib/file/fileLockPrimitive.c @@ -399,11 +399,7 @@ ActivateLockList(ConstUnicode dirName, // IN: /* No entry? Attempt to add one. */ if (ptr == NULL) { - ptr = malloc(sizeof *ptr); - - if (ptr == NULL) { - return ENOMEM; - } + ptr = Util_SafeMalloc(sizeof *ptr); ptr->next = myValues->lockList; myValues->lockList = ptr; diff --git a/open-vm-tools/lib/file/filePosix.c b/open-vm-tools/lib/file/filePosix.c index ef2734c0d..799ae0096 100644 --- a/open-vm-tools/lib/file/filePosix.c +++ b/open-vm-tools/lib/file/filePosix.c @@ -111,11 +111,7 @@ static Bool FileIsGroupsMember(gid_t gid); int FileRemoveDirectory(ConstUnicode pathName) // IN: { - char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); - int err = rmdir(path) == -1 ? errno : 0; - - free(path); - return err; + return (Posix_Rmdir(pathName) == -1) ? errno : 0; } @@ -140,13 +136,7 @@ int FileRename(ConstUnicode oldName, // IN: ConstUnicode newName) // IN: { - char *newPath = Unicode_GetAllocBytes(newName, STRING_ENCODING_DEFAULT); - char *oldPath = Unicode_GetAllocBytes(oldName, STRING_ENCODING_DEFAULT); - int err = rename(oldPath, newPath) == -1 ? errno : 0; - - free(newPath); - free(oldPath); - return err; + return (Posix_Rename(oldName, newName) == -1) ? errno : 0; } @@ -1306,9 +1296,13 @@ char * File_GetUniqueFileSystemID(char const *path) // IN: File path { #if defined(VMX86_SERVER) - char canPath[FILE_MAXPATH]; + char *canPath; - realpath(path, canPath); + canPath = Posix_RealPath(path); + + if (canPath == NULL) { + return NULL; + } /* * VCFS doesn't have real mount points, so the mount point lookup below @@ -1320,9 +1314,14 @@ File_GetUniqueFileSystemID(char const *path) // IN: File path char vmfsVolumeName[FILE_MAXPATH]; if (sscanf(canPath, VCFS_MOUNT_PATH "%[^/]%*s", vmfsVolumeName) == 1) { - return Str_Asprintf(NULL, "%s/%s", VCFS_MOUNT_POINT, vmfsVolumeName); + free(canPath); + + return Str_SafeAsprintf(NULL, "%s/%s", VCFS_MOUNT_POINT, + vmfsVolumeName); } } + + free(canPath); #endif return FilePosixGetBlockDevice(path); @@ -1577,10 +1576,7 @@ FilePosixNearestExistingAncestor(char const *path) // IN: File path char *result; resultSize = MAX(strlen(path), 1) + 1; - result = malloc(resultSize); - if (!result) { - return NULL; - } + result = Util_SafeMalloc(resultSize); Str_Strcpy(result, path, resultSize); for (;;) { @@ -1646,35 +1642,30 @@ File_IsSameFile(ConstUnicode path1, // IN: #if defined(VMX86_SERVER) { - char *p1; - char *p2; - char *fs1; - char *fs2; - char realpath1[FILE_MAXPATH]; - char realpath2[FILE_MAXPATH]; + Unicode fs1; + Unicode fs2; - p1 = Unicode_GetAllocBytes(path1, STRING_ENCODING_DEFAULT); - p2 = Unicode_GetAllocBytes(path2, STRING_ENCODING_DEFAULT); - - fs1 = realpath(p1, realpath1); - fs2 = realpath(p2, realpath2); - - free(p1); - free(p2); + fs1 = Posix_RealPath(path1); + fs2 = Posix_RealPath(path2); /* * ESX doesn't have real inodes for VMFS disks in User Worlds. So only * way to check if a file is the same is using real path. So said Satyam. */ - if (fs1 && - strncmp(fs1, VCFS_MOUNT_POINT, strlen(VCFS_MOUNT_POINT)) == 0) { - if (!fs2 || strcmp(realpath1, realpath2) != 0) { - return FALSE; - } else { - return TRUE; - } + if (fs1 && Unicode_StartsWith(fs1, U(VCFS_MOUNT_POINT))) { + Bool res; + + res = (!fs2 || Unicode_Compare(fs1, fs2) != 0) ? FALSE : TRUE; + + Unicode_Free(fs1); + Unicode_Free(fs2); + + return res; } + + Unicode_Free(fs1); + Unicode_Free(fs2); } #endif @@ -2118,13 +2109,8 @@ FileCreateDirectory(ConstUnicode pathName) // IN: if (pathName == NULL) { err = errno = EFAULT; } else { - char *path; - - path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); - - err = (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) == -1) ? errno : 0; - - free(path); + err = (Posix_Mkdir(pathName, + S_IRWXU | S_IRWXG | S_IRWXO) == -1) ? errno : 0; } return err; @@ -2469,25 +2455,11 @@ end: Bool File_MakeCfgFileExecutable(ConstUnicode pathName) { - char *path; - Bool result; - - if (pathName == NULL) { - errno = EFAULT; - return FALSE; - } - - path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); - - result = chmod(path, - S_IRUSR | S_IWUSR | S_IXUSR | // rwx by user - S_IRGRP | S_IXGRP | // rx by group - S_IROTH | S_IXOTH // rx by others - ) == 0; - - free(path); - - return result; + return Posix_Chmod(pathName, + S_IRUSR | S_IWUSR | S_IXUSR | // rwx by user + S_IRGRP | S_IXGRP | // rx by group + S_IROTH | S_IXOTH // rx by others + ) == 0; } diff --git a/open-vm-tools/lib/foundryMsg/Makefile.in b/open-vm-tools/lib/foundryMsg/Makefile.in index 451bef47d..3cb23bbda 100644 --- a/open-vm-tools/lib/foundryMsg/Makefile.in +++ b/open-vm-tools/lib/foundryMsg/Makefile.in @@ -120,6 +120,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/foundryMsg/foundryThreads.c b/open-vm-tools/lib/foundryMsg/foundryThreads.c index 934cba398..645b081fe 100644 --- a/open-vm-tools/lib/foundryMsg/foundryThreads.c +++ b/open-vm-tools/lib/foundryMsg/foundryThreads.c @@ -84,7 +84,7 @@ FoundryThreads_StartThread(FoundryThreadProc proc, // IN FoundryThreadWrapperProc, threadState, 0, - &(threadState->threadId)); + (LPDWORD)&(threadState->threadId)); if (NULL == threadState->threadHandle) { err = VIX_E_OUT_OF_MEMORY; goto abort; @@ -146,7 +146,7 @@ FoundryThreads_StopThread(FoundryWorkerThread *threadState) // IN #ifdef _WIN32 DWORD waitResult; - ASSERT(threadState->threadId != Util_GetCurrentThreadId()); + ASSERT(threadState->threadId != ((uintptr_t)GetCurrentThreadId())); waitResult = WaitForSingleObject(threadState->threadHandle, 30000); if (WAIT_OBJECT_0 != waitResult) { @@ -218,7 +218,7 @@ FoundryThreads_IsCurrentThread(struct FoundryWorkerThread *threadState) // I } #ifdef _WIN32 { - DWORD id = GetCurrentThreadId(); + uintptr_t id = (uintptr_t)GetCurrentThreadId(); if (id == threadState->threadId) { return TRUE; } diff --git a/open-vm-tools/lib/foundryMsg/vixTranslateErrOpenSource.c b/open-vm-tools/lib/foundryMsg/vixTranslateErrOpenSource.c index d1317b913..9d8ab7b87 100644 --- a/open-vm-tools/lib/foundryMsg/vixTranslateErrOpenSource.c +++ b/open-vm-tools/lib/foundryMsg/vixTranslateErrOpenSource.c @@ -37,6 +37,8 @@ #ifndef _WIN32 #include #include +#else +#include "win32u.h" #endif @@ -110,7 +112,7 @@ Vix_TranslateSystemError(int systemError) // IN default: err = VIX_E_FAIL; } - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + Win32U_FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, systemError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); diff --git a/open-vm-tools/lib/ghIntegrationStub/Makefile.in b/open-vm-tools/lib/ghIntegrationStub/Makefile.in index 0446dffc4..6f6b7140b 100644 --- a/open-vm-tools/lib/ghIntegrationStub/Makefile.in +++ b/open-vm-tools/lib/ghIntegrationStub/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/guestApp/Makefile.in b/open-vm-tools/lib/guestApp/Makefile.in index ee3444a5a..157b63202 100644 --- a/open-vm-tools/lib/guestApp/Makefile.in +++ b/open-vm-tools/lib/guestApp/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/guestInfo/Makefile.in b/open-vm-tools/lib/guestInfo/Makefile.in index 9f8fead3c..aa0ac4bf5 100644 --- a/open-vm-tools/lib/guestInfo/Makefile.in +++ b/open-vm-tools/lib/guestInfo/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/guestInfo/guestInfoServer.c b/open-vm-tools/lib/guestInfo/guestInfoServer.c index 6dbbc2521..2e9f8e2b4 100644 --- a/open-vm-tools/lib/guestInfo/guestInfoServer.c +++ b/open-vm-tools/lib/guestInfo/guestInfoServer.c @@ -21,33 +21,18 @@ * * This is the implementation of the common code in the guest tools * to send out guest information to the host. The guest info server - * is currently a thread spawned by the tools daemon which periodically + * runs in the context of the tools daemon's event loop and periodically * gathers all guest information and sends updates to the host if required. * This file implements the platform independent framework for this. - * A separate thread is only spawned for Windows guests, currently. */ -#ifndef VMX86_DEVEL - -#endif - #include #include #include #include #include -#ifdef _WIN32 -#include -#include /* For Sleep() */ -#include -#define SleepFunction(x) Sleep((uint32)ceil((double)(x) / 1000)) -#else -/* SleepFunction() for Posix defined below; these includes are needed. */ -#include -#endif - #include "vmware.h" #include "eventManager.h" #include "debug.h" @@ -83,7 +68,6 @@ typedef struct _GuestInfoCache{ static uint32 gDisableQueryDiskInfo = FALSE; static DblLnkLst_Links *gGuestInfoEventQueue; -static uint32 gTimerInterval; /* Local cache of the guest information that was last sent to vmx. */ static GuestInfoCache gInfoCache; @@ -95,32 +79,6 @@ static GuestInfoCache gInfoCache; static Bool vmResumed; -/* - * The Windows Guest Info Server runs in a separate thread, - * so we have to synchronize access to 'vmResumed' variable. - * Non-windows guest info server does not run in a separate - * thread, so no locking is needed. - */ - -#if defined(_WIN32) -typedef CRITICAL_SECTION vmResumedLockType; -#define GUESTINFO_DELETE_LOCK(lockPtr) DeleteCriticalSection(lockPtr) -#define GUESTINFO_ENTER_LOCK(lockPtr) EnterCriticalSection(lockPtr) -#define GUESTINFO_LEAVE_LOCK(lockPtr) LeaveCriticalSection(lockPtr) -#define GUESTINFO_INIT_LOCK(lockPtr) InitializeCriticalSection(lockPtr) - -vmResumedLockType vmResumedLock; - -#else // #if LINUX - -typedef int vmResumedLockType; -#define GUESTINFO_DELETE_LOCK(lockPtr) -#define GUESTINFO_ENTER_LOCK(lockPtr) -#define GUESTINFO_LEAVE_LOCK(lockPtr) -#define GUESTINFO_INIT_LOCK(lockPtr) - -#endif // #if LINUX - static Bool GuestInfoGather(void * clientData); static Bool GuestInfoUpdateVmdb(GuestInfoType infoType, void* info); static Bool SetGuestInfo(GuestInfoType key, const char* value, char delimiter); @@ -133,76 +91,7 @@ static Bool GuestInfoSerializeNicInfo(NicInfo *nicInfo, static int PrintNicInfo(NicInfo *nicInfo, int (*PrintFunc)(const char *, ...)); #ifdef _WIN32 - -static Bool GuestInfoConvertNicInfoToNicInfoV1(NicInfo *info, NicInfoV1 *infoV1); - - -/* - *----------------------------------------------------------------------------- - * - * GuestInfoServer_Main -- - * - * The main event loop for the guest info server. - * GuestInfoServer_Init() much be called prior to calling this function. - * - * Result - * None - * - * Side-effects - * Events are processed, information gathered and updates sent. - * - *----------------------------------------------------------------------------- - */ - -void -GuestInfoServer_Main(void *data) // IN -{ - int retVal; - uint64 sleepUsecs; - HANDLE *events = (HANDLE *) data; - HANDLE quitEvent; - HANDLE finishedEvent; - - ASSERT(data); - ASSERT(events[0]); - ASSERT(events[1]); - - quitEvent = events[0]; - finishedEvent = events[1]; - - Debug("Starting GuestInfoServer for Windows.\n"); - for(;;) { - DWORD dwError; - - retVal = EventManager_ProcessNext(gGuestInfoEventQueue, &sleepUsecs); - if (retVal != 1) { - Debug("Unexpected end of the guest info loop.\n"); - break; - } - - /* - * The number of micro seconds to sleep should not overflow a long. This - * corresponds to a maximum sleep time of around 4295 seconds (~ 71 minutes) - * which should be more than enough. - */ - - Debug("Sleeping for %"FMT64"u msecs...\n", sleepUsecs / 1000); - dwError = WaitForSingleObject(quitEvent, sleepUsecs / 1000); - if (dwError == WAIT_OBJECT_0) { - GuestApp_Log("GuestInfoServer received quit event.\n"); - Debug("GuestInfoServer received quit event.\n"); - break; - } else if (dwError == WAIT_TIMEOUT) { - Debug("GuestInfoServer woke up.\n"); - } else if (dwError == WAIT_FAILED) { - Debug("GuestInfoServer error waiting on exit event: %d %d\n", - dwError, GetLastError()); - break; - } - } - SetEvent(finishedEvent); - GuestApp_Log("GuestInfoServer exiting.\n"); -} +static Bool GuestInfoConvertNicInfoToNicInfoV1(NicInfo *info, NicInfoV1 *infoV1); #endif @@ -211,23 +100,15 @@ GuestInfoServer_Main(void *data) // IN * * GuestInfoServer_Init -- * - * This function must be called before the guest info thread is running. - * Initialize the event queue. If an event queue has been supplied, just - * add the first event to it. If not, create an event queue and then add - * an event to this queue. Initialize vmResumedLock. Even if the function - * fails, the lock is initialized anyway since the main thread calls - * GuestInfoServer_VMResumedNotify() regardless of whether the guest info - * thread was started successfully. + * Initialize some variables and add the first event to the queue. * - * Call GuestInfoServer_Cleanup() to do the necessary cleanup after the - * guest info thread has finished running. + * Call GuestInfoServer_Cleanup() to do the necessary cleanup. * * Result * TRUE on success, FALSE on failure. * * Side-effects - * The timer event queue is initialized and populated with the first event. - * Lock is created for synchronized access to vmResumed variable. + * The timer event queue is populated with the first event. * *----------------------------------------------------------------------------- */ @@ -236,30 +117,15 @@ Bool GuestInfoServer_Init(DblLnkLst_Links *eventQueue) // IN: queue for event loop { Debug("Entered guest info init.\n"); + ASSERT(eventQueue); memset(&gInfoCache, 0, sizeof gInfoCache); - - GUESTINFO_INIT_LOCK(&vmResumedLock); - GUESTINFO_ENTER_LOCK(&vmResumedLock); vmResumed = FALSE; - GUESTINFO_LEAVE_LOCK(&vmResumedLock); - - gGuestInfoEventQueue = eventQueue ? eventQueue: EventManager_Init(); - if(!gGuestInfoEventQueue) { - Debug("Unable to create the event queue.\n"); - return FALSE; - } - - /* - * Get the timer interval. - * XXX: A default value of 30 seconds is acceptable to the VPX team - * This value should however be made configurable. - */ - - gTimerInterval = GUESTINFO_TIME_INTERVAL_MSEC; + gGuestInfoEventQueue = eventQueue; /* Add the first timer event. */ - if (!EventManager_Add(gGuestInfoEventQueue, gTimerInterval, GuestInfoGather, NULL)) { + if (!EventManager_Add(gGuestInfoEventQueue, GUESTINFO_TIME_INTERVAL_MSEC, + GuestInfoGather, NULL)) { Debug("Unable to add initial event.\n"); return FALSE; } @@ -307,9 +173,7 @@ GuestInfoServer_DisableDiskInfoQuery(Bool disable) * None. * * Side-effects - * Timer event queue is destroyed. - * Deallocate any memory allocated in gInfoCache. - * vmResumedLock is deleted. + * Deallocates any memory allocated in gInfoCache. * *----------------------------------------------------------------------------- */ @@ -318,10 +182,6 @@ void GuestInfoServer_Cleanup(void) { GuestInfoClearCache(); - if (gGuestInfoEventQueue) { - EventManager_Destroy(gGuestInfoEventQueue); - } - GUESTINFO_DELETE_LOCK(&vmResumedLock); } @@ -345,41 +205,8 @@ GuestInfoServer_Cleanup(void) void GuestInfoServer_VMResumedNotify(void) { - GUESTINFO_ENTER_LOCK(&vmResumedLock); vmResumed = TRUE; - GUESTINFO_LEAVE_LOCK(&vmResumedLock); -} - - -#ifndef _WIN32 -/* - *---------------------------------------------------------------------------- - * - * SleepFunction -- - * - * Sleeps in milliseconds. (Posix) - * - * Results: - * None. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------------- - */ - -static inline void -SleepFunction(uint64 tmout) -{ - if (tmout >= INT_MAX * CONST64U(1000)) { - tmout = INT_MAX; - } else { - tmout = (tmout + 999) / 1000; - } - - poll(NULL, 0, tmout); } -#endif /* @@ -493,7 +320,8 @@ GuestInfoGather(void *clientData) // IN: unused * still be passed to the host. * */ - if (!EventManager_Add(gGuestInfoEventQueue, gTimerInterval, GuestInfoGather, NULL)) { + if (!EventManager_Add(gGuestInfoEventQueue, GUESTINFO_TIME_INTERVAL_MSEC, + GuestInfoGather, NULL)) { Debug("GuestInfoGather: Unable to add next event.\n"); } @@ -617,19 +445,11 @@ Bool GuestInfoUpdateVmdb(GuestInfoType infoType, // IN: guest information type void *info) // IN: type specific information { - Bool resumed = FALSE; - ASSERT(info); Debug("Entered update vmdb.\n"); - GUESTINFO_ENTER_LOCK(&vmResumedLock); if (vmResumed) { - resumed = vmResumed; vmResumed = FALSE; - } - GUESTINFO_LEAVE_LOCK(&vmResumedLock); - - if (resumed) { GuestInfoClearCache(); } diff --git a/open-vm-tools/lib/hgfs/Makefile.in b/open-vm-tools/lib/hgfs/Makefile.in index 3b06f6d36..5a0380f56 100644 --- a/open-vm-tools/lib/hgfs/Makefile.in +++ b/open-vm-tools/lib/hgfs/Makefile.in @@ -121,6 +121,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/hgfsBd/Makefile.in b/open-vm-tools/lib/hgfsBd/Makefile.in index 71b6cd409..3d7fc72ea 100644 --- a/open-vm-tools/lib/hgfsBd/Makefile.in +++ b/open-vm-tools/lib/hgfsBd/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/hgfsServer/Makefile.in b/open-vm-tools/lib/hgfsServer/Makefile.in index 2c9f3836d..452ca505b 100644 --- a/open-vm-tools/lib/hgfsServer/Makefile.in +++ b/open-vm-tools/lib/hgfsServer/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index 1f8f6b6bd..36ad34fe4 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -36,7 +36,7 @@ #if defined(_WIN32) #include -#else +#else #include #define stricmp strcasecmp #endif // _WIN32 @@ -93,7 +93,7 @@ static unsigned int numCachedLockedNodes; /* Value of config option to require using host timestamps */ Bool alwaysUseHostTime = FALSE; -/* +/* * Monotonically increasing handle counter used to dish out HgfsHandles. Not * static so that it can be used in the VMX checkpointing code. */ @@ -237,7 +237,7 @@ HgfsDumpAllNodes(void) * * HgfsHandle2FileDesc -- * - * Retrieve the file descriptor (host OS file handle) based on the hgfs + * Retrieve the file descriptor (host OS file handle) based on the hgfs * handle. * * Results: @@ -304,7 +304,7 @@ HgfsHandle2AppendFlag(HgfsHandle handle, // IN: Hgfs file handle goto exit; } - *appendFlag = fileNode->flags & FILE_NODE_APPEND_FL; + *appendFlag = fileNode->flags & HGFS_FILE_NODE_APPEND_FL; found = TRUE; exit: @@ -432,7 +432,7 @@ HgfsFileDesc2Handle(fileDesc fd, // IN: OS handle (file descriptor) unsigned int i; Bool found = FALSE; HgfsFileNode *existingFileNode = NULL; - + SyncMutex_Lock(&hgfsNodeArrayLock); for (i = 0; i < numNodes; i++) { existingFileNode = &nodeArray[i]; @@ -446,7 +446,7 @@ HgfsFileDesc2Handle(fileDesc fd, // IN: OS handle (file descriptor) SyncMutex_Unlock(&hgfsNodeArrayLock); - return found; + return found; } @@ -484,7 +484,7 @@ HgfsHandle2ShareMode(HgfsHandle handle, // IN: Hgfs file handle if (existingFileNode == NULL) { goto exit_unlock; } - + nameStatus = HgfsServerPolicy_GetShareMode(existingFileNode->shareName, existingFileNode->shareNameLen, shareMode); @@ -492,7 +492,7 @@ HgfsHandle2ShareMode(HgfsHandle handle, // IN: Hgfs file handle exit_unlock: SyncMutex_Unlock(&hgfsNodeArrayLock); - return found; + return found; } @@ -537,7 +537,7 @@ HgfsHandle2FileName(HgfsHandle handle, // IN: Hgfs file handle if (name == NULL) { goto exit_unlock; } - nameSize = existingFileNode->utf8NameLen; + nameSize = existingFileNode->utf8NameLen; memcpy(name, existingFileNode->utf8Name, nameSize); name[nameSize] = '\0'; found = TRUE; @@ -546,7 +546,7 @@ exit_unlock: SyncMutex_Unlock(&hgfsNodeArrayLock); *fileName = name; *fileNameSize = nameSize; - return found; + return found; } @@ -606,7 +606,7 @@ HgfsFileHasServerLock(const char *utf8Name, // IN: Name in UTF8 * * HgfsGetNodeCopy -- * - * Make a copy of the node. The node should not be kept around for long, as + * Make a copy of the node. The node should not be kept around for long, as * the data might become stale. This is mostly a convenience function to get * node fields more efficiently. * @@ -696,7 +696,7 @@ HgfsHandleIsSequentialOpen(HgfsHandle handle, // IN: Hgfs file handle goto exit; } - *sequentialOpen = node->flags & FILE_NODE_SEQUENTIAL_FL; + *sequentialOpen = node->flags & HGFS_FILE_NODE_SEQUENTIAL_FL; success = TRUE; exit: @@ -737,7 +737,7 @@ HgfsHandleIsSharedFolderOpen(HgfsHandle handle, // IN: Hgfs file handle goto exit; } - *sharedFolderOpen = node->flags & FILE_NODE_SHARED_FOLDER_OPEN_FL; + *sharedFolderOpen = node->flags & HGFS_FILE_NODE_SHARED_FOLDER_OPEN_FL; success = TRUE; exit: @@ -791,7 +791,7 @@ exit: * * HgfsUpdateNodeServerLock -- * - * Given a file desc (OS handle), update the node with the new oplock + * Given a file desc (OS handle), update the node with the new oplock * information. * * Results: @@ -825,7 +825,7 @@ HgfsUpdateNodeServerLock(fileDesc fd, // IN: OS handle } SyncMutex_Unlock(&hgfsNodeArrayLock); - return updated; + return updated; } @@ -860,7 +860,7 @@ HgfsUpdateNodeAppendFlag(HgfsHandle handle, // IN: Hgfs file handle } if (appendFlag) { - node->flags |= FILE_NODE_APPEND_FL; + node->flags |= HGFS_FILE_NODE_APPEND_FL; } updated = TRUE; @@ -895,9 +895,9 @@ HgfsDumpAllSearches(void) Log("Dumping all searches\n"); for (i = 0; i < numSearches; i++) { - Log("handle %u, baseDir \"%s\"\n", - searchArray[i].handle, - searchArray[i].utf8Dir ? + Log("handle %u, baseDir \"%s\"\n", + searchArray[i].handle, + searchArray[i].utf8Dir ? searchArray[i].utf8Dir : "(NULL)"); } Log("Done\n"); @@ -948,7 +948,7 @@ HgfsGetNewNode(void) /* Try to get twice as much memory as we had */ newNumNodes = 2 * numNodes; - newMem = (HgfsFileNode *)realloc(nodeArray, + newMem = (HgfsFileNode *)realloc(nodeArray, newNumNodes * sizeof *nodeArray); if (!newMem) { LOG(4, ("HgfsGetNewNode: can't realloc more nodes\n")); @@ -1129,9 +1129,9 @@ HgfsFreeFileNode(HgfsHandle handle) // IN: Handle to free * * HgfsAddNewFileNode -- * - * Gets a free node off the free list, sets its name, localId info, + * Gets a free node off the free list, sets its name, localId info, * file descriptor and permissions. - * + * * hgfsNodeArrayLock should be acquired prior to calling this function. * * Results: @@ -1174,7 +1174,7 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct return NULL; } - /* + /* * Save a copy of the share name so we can look up its * access mode at various times over the node's lifecycle. */ @@ -1205,13 +1205,13 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct openInfo->shareAccess : HGFS_DEFAULT_SHARE_ACCESS; newNode->flags = 0; if (append) { - newNode->flags |= FILE_NODE_APPEND_FL; + newNode->flags |= HGFS_FILE_NODE_APPEND_FL; } if (sharedFolderOpen) { - newNode->flags |= FILE_NODE_SHARED_FOLDER_OPEN_FL; + newNode->flags |= HGFS_FILE_NODE_SHARED_FOLDER_OPEN_FL; } if (HGFS_OPEN_MODE_FLAGS(openInfo->mode) & HGFS_OPEN_SEQUENTIAL) { - newNode->flags |= FILE_NODE_SEQUENTIAL_FL; + newNode->flags |= HGFS_FILE_NODE_SEQUENTIAL_FL; } newNode->serverLock = openInfo->acquiredLock; @@ -1251,7 +1251,7 @@ HgfsAddToCacheInternal(HgfsHandle handle) // IN: HGFS file handle /* Check if the node is already cached. */ if (HgfsIsCachedInternal(handle)) { - ASSERT((node = HgfsHandle2FileNode(handle)) && + ASSERT((node = HgfsHandle2FileNode(handle)) && node->state == FILENODE_STATE_IN_USE_CACHED); return TRUE; } @@ -1274,7 +1274,7 @@ HgfsAddToCacheInternal(HgfsHandle handle) // IN: HGFS file handle node->state = FILENODE_STATE_IN_USE_CACHED; numCachedOpenNodes++; - /* + /* * Keep track of how many open nodes we have with * server locks on them. The locked file should * always be present in the node cache. So we keep @@ -1297,7 +1297,7 @@ HgfsAddToCacheInternal(HgfsHandle handle) // IN: HGFS file handle * HgfsRemoveFromCacheInternal -- * * Remove the specified node from the cache and close the associated - * file descriptor. If the node was not already in the cache then nothing + * file descriptor. If the node was not already in the cache then nothing * is done. * * hgfsNodeArrayLock should be acquired prior to calling this function. @@ -1329,19 +1329,19 @@ HgfsRemoveFromCacheInternal(HgfsHandle handle) // IN: Hgfs handle to the node node->state = FILENODE_STATE_IN_USE_NOT_CACHED; numCachedOpenNodes--; - /* - * XXX: From this point and up in the call chain (i.e. this function and - * all callers), Bool is returned instead of the HgfsInternalStatus. - * HgfsCloseFile returns HgfsInternalStatus, which is far more granular, - * but modifying this stack to use HgfsInternalStatus instead of Bool is - * not worth it, as we'd have to #define per-platform error codes for + /* + * XXX: From this point and up in the call chain (i.e. this function and + * all callers), Bool is returned instead of the HgfsInternalStatus. + * HgfsCloseFile returns HgfsInternalStatus, which is far more granular, + * but modifying this stack to use HgfsInternalStatus instead of Bool is + * not worth it, as we'd have to #define per-platform error codes for * things like "ran out of memory", "bad file handle", etc. * * Instead, we'll just await the lobotomization of the node cache to * really fix this. */ if (HgfsCloseFile(node->fileDesc)) { - LOG(4, ("HgfsRemoveFromCacheInternal: Could not close fd %u\n", + LOG(4, ("HgfsRemoveFromCacheInternal: Could not close fd %u\n", node->fileDesc)); return FALSE; } @@ -1429,7 +1429,7 @@ Bool HgfsIsServerLockAllowed() { Bool allowed; - + SyncMutex_Lock(&hgfsNodeArrayLock); allowed = numCachedLockedNodes < MAX_LOCKED_FILENODES; SyncMutex_Unlock(&hgfsNodeArrayLock); @@ -1481,7 +1481,7 @@ HgfsGetNewSearch(void) /* Try to get twice as much memory as we had */ newNumSearches = 2 * numSearches; - newMem = (HgfsSearch *)realloc(searchArray, + newMem = (HgfsSearch *)realloc(searchArray, newNumSearches * sizeof *searchArray); if (!newMem) { LOG(4, ("HgfsGetNewSearch: can't realloc more searches\n")); @@ -1645,7 +1645,7 @@ exit: * * HgfsAddNewSearch -- * - * Gets a free search off the free list, sets its base directory, dents, + * Gets a free search off the free list, sets its base directory, dents, * and type. * * Caller should hold hgfsSearchArrayLock. @@ -1744,7 +1744,7 @@ HgfsRemoveSearchInternal(HgfsSearch *search) // IN * * HgfsRemoveSearch -- * - * Wrapper around HgfsRemoveSearchInternal that first takes the lock and + * Wrapper around HgfsRemoveSearchInternal that first takes the lock and * converts the handle to the search itself. * * Results: @@ -1802,20 +1802,20 @@ HgfsGetSearchResult(HgfsHandle handle, // IN: Handle to search HgfsSearch *search; DirectoryEntry *dent = NULL; - SyncMutex_Lock(&hgfsSearchArrayLock); + SyncMutex_Lock(&hgfsSearchArrayLock); search = HgfsSearchHandle2Search(handle); if (search == NULL || search->dents == NULL) { goto out; } - + if (offset >= search->numDents) { goto out; } /* If we're not removing the result, we need to make a copy of it. */ if (remove) { - /* - * We're going to shift the dents array, overwriting the dent pointer at + /* + * We're going to shift the dents array, overwriting the dent pointer at * offset, so first we need to save said pointer so that we can return it * later to the caller. */ @@ -1824,7 +1824,7 @@ HgfsGetSearchResult(HgfsHandle handle, // IN: Handle to search /* Shift up the remaining results */ memmove(&search->dents[offset], &search->dents[offset + 1], (search->numDents - (offset + 1)) * sizeof search->dents[0]); - + /* Decrement the number of results */ search->numDents--; } else { @@ -1890,7 +1890,7 @@ HgfsSearchHandle2Search(HgfsHandle handle) // IN HgfsSearch *search = NULL; ASSERT(searchArray); - + /* XXX: This O(n) lookup can and should be optimized. */ for (i = 0; i < numSearches; i++) { if (!DblLnkLst_IsLinked(&searchArray[i].links) && @@ -1987,25 +1987,36 @@ HgfsServerClose(char const *packetIn, // IN: incoming packet char *packetOut, // OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsRequestClose *request; - HgfsReplyClose *reply; + HgfsRequest *header = (HgfsRequest *)packetIn; + HgfsHandle *file; + size_t replySize; - request = (HgfsRequestClose *)packetIn; - ASSERT(request); - reply = (HgfsReplyClose *)packetOut; - ASSERT(reply); + ASSERT(packetIn); + ASSERT(packetOut); ASSERT(packetSize); - LOG(4, ("HgfsServerClose: close fh %u\n", request->file)); + if (header->op == HGFS_OP_CLOSE_V3) { + HgfsRequestCloseV3 *request; + request = (HgfsRequestCloseV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + file = &request->file; + replySize = sizeof(HgfsReplyCloseV3) + sizeof(HgfsReply); + } else { + HgfsRequestClose *request; + request = (HgfsRequestClose *)packetIn; + file = &request->file; + replySize = sizeof *request; + } + + LOG(4, ("HgfsServerClose: close fh %u\n", *file)); - if (!HgfsRemoveFromCache(request->file)) { + if (!HgfsRemoveFromCache(*file)) { LOG(4, ("HgfsServerClose: Could not remove the node from cache.\n")); return HGFS_INTERNAL_STATUS_ERROR; } else { - HgfsFreeFileNode(request->file); + HgfsFreeFileNode(*file); } - *packetSize = sizeof *reply; + *packetSize = replySize; return 0; } @@ -2032,27 +2043,42 @@ HgfsServerSearchClose(char const *packetIn, // IN: incoming packet char *packetOut, // OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsRequestSearchClose *request; - HgfsReplySearchClose *reply; + HgfsRequest *header = (HgfsRequest *)packetIn; + HgfsHandle *search; + size_t replySize; - request = (HgfsRequestSearchClose *)packetIn; - ASSERT(request); - reply = (HgfsReplySearchClose *)packetOut; - ASSERT(reply); + ASSERT(packetIn); + ASSERT(packetOut); ASSERT(packetSize); - LOG(4, ("HgfsServerSearchClose: close search #%u\n", request->search)); + if (header->op == HGFS_OP_SEARCH_CLOSE_V3) { + HgfsRequestSearchCloseV3 *request = + (HgfsRequestSearchCloseV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + HgfsReplySearchCloseV3 *reply = + (HgfsReplySearchCloseV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); + + search = &request->search; + replySize = HGFS_REP_PAYLOAD_SIZE_V3(reply); + } else { + HgfsRequestSearchClose *request = (HgfsRequestSearchClose *)packetIn; + HgfsReplySearchClose *reply = (HgfsReplySearchClose *)packetOut; + search = &request->search; + replySize = sizeof *reply; + } + + LOG(4, ("HgfsServerSearchClose: close search #%u\n", *search)); - if (!HgfsRemoveSearch(request->search)) { + if (!HgfsRemoveSearch(*search)) { /* Invalid handle */ - LOG(4, ("HgfsServerSearchClose: invalid handle %u\n", request->search)); + LOG(4, ("HgfsServerSearchClose: invalid handle %u\n", *search)); return HGFS_INTERNAL_STATUS_ERROR; } - *packetSize = sizeof *reply; + *packetSize = replySize; return 0; } +#define HGFS_SIZEOF_OP(type) (sizeof (type) + sizeof (HgfsRequest)) /* Opcode handlers, indexed by opcode */ static struct { @@ -2090,22 +2116,22 @@ static struct { { HgfsServerDeleteDir, sizeof (HgfsRequestDeleteV2) }, { HgfsServerRename, sizeof (HgfsRequestRenameV2) }, - { HgfsServerOpen, (sizeof (HgfsRequestOpenV3) + sizeof (HgfsRequest)) }, - { HgfsServerRead, (sizeof (HgfsRequestReadV3) + sizeof (HgfsRequest)) }, - { HgfsServerWrite, (sizeof (HgfsRequestWriteV3) + sizeof (HgfsRequest)) }, - { HgfsServerClose, (sizeof (HgfsRequestCloseV3) + sizeof (HgfsRequest)) }, - { HgfsServerSearchOpen, (sizeof (HgfsRequestSearchOpenV3) + sizeof (HgfsRequest)) }, - { HgfsServerSearchRead, (sizeof (HgfsRequestSearchReadV3) + sizeof (HgfsRequest)) }, - { HgfsServerSearchClose, (sizeof (HgfsRequestSearchCloseV3) + sizeof (HgfsRequest)) }, - { HgfsServerGetattr, (sizeof (HgfsRequestGetattrV3) + sizeof (HgfsRequest)) }, - { HgfsServerSetattr, (sizeof (HgfsRequestSetattrV3) + sizeof (HgfsRequest)) }, - { HgfsServerCreateDir, (sizeof (HgfsRequestCreateDirV3) + sizeof (HgfsRequest)) }, - { HgfsServerDeleteFile, (sizeof (HgfsRequestDeleteV3) + sizeof (HgfsRequest)) }, - { HgfsServerDeleteDir, (sizeof (HgfsRequestDeleteV3) + sizeof (HgfsRequest)) }, - { HgfsServerRename, (sizeof (HgfsRequestRenameV3) + sizeof (HgfsRequest)) }, - { HgfsServerQueryVolume, (sizeof (HgfsRequestQueryVolumeV3) + sizeof (HgfsRequest)) }, - { HgfsServerSymlinkCreate, (sizeof (HgfsRequestSymlinkCreateV3) + sizeof (HgfsRequest)) }, - { HgfsServerServerLockChange, sizeof (HgfsRequestServerLockChange) }, + { HgfsServerOpen, HGFS_SIZEOF_OP(HgfsRequestOpenV3) }, + { HgfsServerRead, HGFS_SIZEOF_OP(HgfsRequestReadV3) }, + { HgfsServerWrite, HGFS_SIZEOF_OP(HgfsRequestWriteV3) }, + { HgfsServerClose, HGFS_SIZEOF_OP(HgfsRequestCloseV3) }, + { HgfsServerSearchOpen, HGFS_SIZEOF_OP(HgfsRequestSearchOpenV3) }, + { HgfsServerSearchRead, HGFS_SIZEOF_OP(HgfsRequestSearchReadV3) }, + { HgfsServerSearchClose, HGFS_SIZEOF_OP(HgfsRequestSearchCloseV3) }, + { HgfsServerGetattr, HGFS_SIZEOF_OP(HgfsRequestGetattrV3) }, + { HgfsServerSetattr, HGFS_SIZEOF_OP(HgfsRequestSetattrV3) }, + { HgfsServerCreateDir, HGFS_SIZEOF_OP(HgfsRequestCreateDirV3) }, + { HgfsServerDeleteFile, HGFS_SIZEOF_OP(HgfsRequestDeleteV3) }, + { HgfsServerDeleteDir, HGFS_SIZEOF_OP(HgfsRequestDeleteV3) }, + { HgfsServerRename, HGFS_SIZEOF_OP(HgfsRequestRenameV3) }, + { HgfsServerQueryVolume, HGFS_SIZEOF_OP(HgfsRequestQueryVolumeV3) }, + { HgfsServerSymlinkCreate, HGFS_SIZEOF_OP(HgfsRequestSymlinkCreateV3) }, + { HgfsServerServerLockChange, sizeof (HgfsRequestServerLockChange) }, }; @@ -2169,8 +2195,8 @@ HgfsServer_DispatchPacket(char const *packetIn, // IN: Incoming request pack if (op < sizeof handlers / sizeof handlers[0]) { if (*packetSize >= handlers[op].minReqSize) { HgfsInternalStatus internalStatus; - internalStatus = (*handlers[op].handler)(packetIn, - packetOut, + internalStatus = (*handlers[op].handler)(packetIn, + packetOut, packetSize); status = HgfsConvertFromInternalStatus(internalStatus); } else { @@ -2226,7 +2252,7 @@ HgfsServer_InvalidateObjects(DblLnkLst_Links *shares) // IN: List of new shares ASSERT(shares); LOG(4, ("HgfsServer_InvalidateObjects: Beginning\n")); - /* + /* * Iterate over each node, skipping those that are unused. For each node, * if its filename is no longer within a share, remove it. */ @@ -2238,15 +2264,15 @@ HgfsServer_InvalidateObjects(DblLnkLst_Links *shares) // IN: List of new shares if (nodeArray[i].state == FILENODE_STATE_UNUSED) { continue; } - + handle = HgfsFileNode2Handle(&nodeArray[i]); LOG(4, ("HgfsServer_InvalidateObjects: Examining node with fd %d (%s)\n", handle, nodeArray[i].utf8Name)); - - /* + + /* * For each share, is the node within the share? The answer is yes if the - * share's path is a prefix for the node's path. To make sure we don't - * get any false positives, check for a path separator (or nul + * share's path is a prefix for the node's path. To make sure we don't + * get any false positives, check for a path separator (or nul * terminator) right after the matched prefix. */ for (l = shares->next; l != shares; l = l->next) { @@ -2255,13 +2281,13 @@ HgfsServer_InvalidateObjects(DblLnkLst_Links *shares) // IN: List of new shares share = DblLnkLst_Container(l, HgfsSharedFolder, links); ASSERT(share); if ((strncmp(nodeArray[i].utf8Name, share->path, share->pathLen) == 0) - && (*(nodeArray[i].utf8Name + share->pathLen) == DIRSEPC || + && (*(nodeArray[i].utf8Name + share->pathLen) == DIRSEPC || *(nodeArray[i].utf8Name + share->pathLen) == '\0')) { LOG(4, ("HgfsServer_InvalidateObjects: Node is still valid\n")); break; } } - + /* If the node wasn't found in any share, remove it. */ if (l == shares) { LOG(4, ("HgfsServer_InvalidateObjects: Node is invalid, removing\n")); @@ -2275,8 +2301,8 @@ HgfsServer_InvalidateObjects(DblLnkLst_Links *shares) // IN: List of new shares } SyncMutex_Unlock(&hgfsNodeArrayLock); - /* - * Iterate over each search, skipping those that are on the free list. For + /* + * Iterate over each search, skipping those that are on the free list. For * each search, if its base name is no longer within a share, remove it. */ SyncMutex_Lock(&hgfsSearchArrayLock); @@ -2292,8 +2318,8 @@ HgfsServer_InvalidateObjects(DblLnkLst_Links *shares) // IN: List of new shares LOG(4, ("HgfsServer_InvalidateObjects: Examining search (%s)\n", searchArray[i].utf8Dir)); - /* - * For each share, is the search within the share? We apply the same + /* + * For each share, is the search within the share? We apply the same * heuristic as was used for the nodes above. */ for (l = shares->next; l != shares; l = l->next) { @@ -2302,7 +2328,7 @@ HgfsServer_InvalidateObjects(DblLnkLst_Links *shares) // IN: List of new shares share = DblLnkLst_Container(l, HgfsSharedFolder, links); ASSERT(share); if ((strncmp(searchArray[i].utf8Dir, share->path, share->pathLen) == 0) - && (*(searchArray[i].utf8Dir + share->pathLen) == DIRSEPC || + && (*(searchArray[i].utf8Dir + share->pathLen) == DIRSEPC || *(searchArray[i].utf8Dir + share->pathLen) == '\0')) { LOG(4, ("HgfsServer_InvalidateObjects: Search is still valid\n")); break; @@ -2356,26 +2382,26 @@ HgfsServerStatFs(const char *pathName, // IN: Path we're interested in Wiper_Init(NULL); /* - * Sanity checks. If length is good, assume well-formed drive path - * (i.e. "C:\..." or "\\abc..."). Note that we throw out shares that - * exactly equal p.mountPoint's size because we won't have room for a null - * delimiter on copy. Allow 0 length drives so that hidden feature "" can + * Sanity checks. If length is good, assume well-formed drive path + * (i.e. "C:\..." or "\\abc..."). Note that we throw out shares that + * exactly equal p.mountPoint's size because we won't have room for a null + * delimiter on copy. Allow 0 length drives so that hidden feature "" can * work. */ if (pathLength < 0 || pathLength >= sizeof p.mountPoint) { LOG(4, ("HgfsServerStatFs: could not get the volume name\n")); return FALSE; } - + /* Now call the wiper lib to get space information. */ Str_Strcpy(p.mountPoint, pathName, sizeof p.mountPoint); wiperError = WiperSinglePartition_GetSpace(&p, freeBytes, totalBytes); if (strlen(wiperError) > 0) { - LOG(4, ("HgfsServerQueryVolume: error using wiper lib: %s\n", + LOG(4, ("HgfsServerQueryVolume: error using wiper lib: %s\n", wiperError)); return FALSE; } - + return TRUE; } @@ -2405,7 +2431,7 @@ HgfsNameStatus HgfsServerGetAccess(char *cpName, // IN: Cross-platform filename to check size_t cpNameSize, // IN: Size of name cpName HgfsOpenMode mode, // IN: Requested access mode - uint32 caseFlags, // IN: Case-sensitivity flags + uint32 caseFlags, // IN: Case-sensitivity flags char **bufOut, // OUT: File name in local fs size_t *outLen, // OUT: Length of name out HgfsSharedFolder **hgfsShare) // OUT: Share @@ -2436,7 +2462,7 @@ HgfsServerGetAccess(char *cpName, // IN: Cross-platform filena inEnd = cpName + cpNameSize; - /* + /* * Get first component. We bypass the higher level CPName_GetComponent * function so we'll have more control over the illegal characters, which, * for the share name, should be none. @@ -2454,7 +2480,7 @@ HgfsServerGetAccess(char *cpName, // IN: Cross-platform filena /* * VMDB stores the ANSI name so convert from UTF8 before looking up a share. - * XXX: Ideally, we should store share names in UTF16 so that these + * XXX: Ideally, we should store share names in UTF16 so that these * conversions can be done away with. */ if (!CodeSet_Utf8ToCurrent(cpName, @@ -2566,7 +2592,7 @@ HgfsServerGetAccess(char *cpName, // IN: Cross-platform filena tempSize = sizeof tempBuf; tempPtr = tempBuf; - if (CPName_ConvertFrom((char const **) &cpName, + if (CPName_ConvertFrom((char const **) &cpName, &cpNameSize, &tempSize, &tempPtr) < 0) { @@ -2575,12 +2601,12 @@ HgfsServerGetAccess(char *cpName, // IN: Cross-platform filena goto error; } - /* + /* * For volume root directory shares the prefix will have a trailing * separator and since our remaining paths start with a separator, we * will skip over the second separator for this case. Bug 166755. */ - if ((out != myBufOut) && + if ((out != myBufOut) && (*(out - 1) == DIRSEPC) && (tempBuf[0] == DIRSEPC)) { startIndex++; @@ -2648,14 +2674,14 @@ HgfsServerGetAccess(char *cpName, // IN: Cross-platform filena #if defined(__APPLE__) { size_t nameLen; - /* + /* * For Mac hosts the unicode format is decomposed (form D) * so there is a need to convert the incoming name from HGFS clients * which is assumed to be in the normalized form C (precomposed). */ - if (!CodeSet_Utf8FormCToUtf8FormD(myBufOut, - out - myBufOut, - &tempPtr, + if (!CodeSet_Utf8FormCToUtf8FormD(myBufOut, + out - myBufOut, + &tempPtr, &nameLen)) { LOG(4, ("HgfsServerGetAccess: unicode conversion to form D failed.\n")); nameStatus = HGFS_NAME_STATUS_FAILURE; @@ -2738,7 +2764,7 @@ HgfsServerIsSharedFolderOnly(char const *cpName,// IN: Cross-platform filename inEnd = cpName + cpNameSize; - /* + /* * Get first component. We bypass the higher level CPName_GetComponent * function so we'll have more control over the illegal characters, which, * for the share name, should be none. @@ -2891,7 +2917,7 @@ HgfsServerGetDents(HgfsGetNameFunc getName, // IN: Function to get name len, &utf8Name, &utf8NameLen)) { - LOG(4, ("HgfsServerGetDents: Unable to convert \"%s\" to utf-8\n", + LOG(4, ("HgfsServerGetDents: Unable to convert \"%s\" to utf-8\n", name)); goto error; } @@ -2972,7 +2998,7 @@ error_free: * * The casual reader will notice that the "type" of this search is obviously * always DIRECTORY_SEARCH_TYPE_DIR, but the caller is nonetheless required - * to pass it in, for completeness' sake with respect to + * to pass it in, for completeness' sake with respect to * HgfsServerSearchVirtualDir. * * Results: @@ -3269,7 +3295,7 @@ HgfsCreateAndCacheFileNode(HgfsFileOpenInfo *openInfo, // IN: Open info struct inEnd = openInfo->cpName + openInfo->cpNameSize; - /* + /* * Get first component. We bypass the higher level CPName_GetComponent * function so we'll have more control over the illegal characters, which, * for the share name, should be none. @@ -3291,7 +3317,7 @@ HgfsCreateAndCacheFileNode(HgfsFileOpenInfo *openInfo, // IN: Open info struct /* * VMDB stores the ANSI name so convert from UTF8 before looking up a share. - * XXX: Ideally, we should store share names in UTF16 so that these + * XXX: Ideally, we should store share names in UTF16 so that these * conversions can be done away with. */ if (!CodeSet_Utf8ToCurrent(openInfo->cpName, @@ -3368,14 +3394,14 @@ HgfsUnpackOpenRequest(char const *packetIn, // IN: request packet switch (openInfo->requestType) { case HGFS_OP_OPEN_V3: { - HgfsRequestOpenV3 *requestV3 = - (HgfsRequestOpenV3 *)(packetIn + sizeof *request); - LOG(4, ("HgfsUnpackOpenRequest: HGFS_OP_OPEN_V3\n")); - + HgfsRequestOpenV3 *requestV3 = + (HgfsRequestOpenV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + LOG(4, ("HgfsUnpackOpenRequest: HGFS_OP_OPEN_V3\n")); + /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *requestV3 + sizeof *request); - extra = packetSize - sizeof *requestV3 - sizeof *request; + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); + extra = packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); if (!(requestV3->mask & HGFS_OPEN_VALID_FILE_NAME)) { /* We do not support open requests without a valid file name. */ @@ -3400,7 +3426,7 @@ HgfsUnpackOpenRequest(char const *packetIn, // IN: request packet openInfo->mode = requestV3->mode; openInfo->cpName = requestV3->fileName.name; openInfo->cpNameSize = requestV3->fileName.length; - openInfo->caseFlags = requestV3->fileName.flags; + openInfo->caseFlags = requestV3->fileName.caseType; openInfo->flags = requestV3->flags; openInfo->specialPerms = requestV3->specialPerms; openInfo->ownerPerms = requestV3->ownerPerms; @@ -3459,7 +3485,7 @@ HgfsUnpackOpenRequest(char const *packetIn, // IN: request packet } case HGFS_OP_OPEN: { - HgfsRequestOpen *requestV1 = + HgfsRequestOpen *requestV1 = (HgfsRequestOpen *)packetIn; /* Enforced by the dispatch function. */ @@ -3467,7 +3493,7 @@ HgfsUnpackOpenRequest(char const *packetIn, // IN: request packet extra = packetSize - sizeof *requestV1; /* - * requestV1->fileName.length is user-provided, so this test must be + * requestV1->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ @@ -3478,7 +3504,7 @@ HgfsUnpackOpenRequest(char const *packetIn, // IN: request packet /* For OpenV1 requests, we know exactly what fields we expect. */ openInfo->mask = HGFS_OPEN_VALID_MODE | - HGFS_OPEN_VALID_FLAGS | + HGFS_OPEN_VALID_FLAGS | HGFS_OPEN_VALID_OWNER_PERMS | HGFS_OPEN_VALID_FILE_NAME; openInfo->mode = requestV1->mode; @@ -3491,7 +3517,7 @@ HgfsUnpackOpenRequest(char const *packetIn, // IN: request packet default: return FALSE; } - + return TRUE; } @@ -3521,18 +3547,33 @@ HgfsPackOpenReply(HgfsFileOpenInfo *openInfo, // IN: open info struct ASSERT(packetSize); ASSERT(openInfo); - if (openInfo->requestType == HGFS_OP_OPEN) { - HgfsReplyOpen *reply = (HgfsReplyOpen *)packetOut; + switch (openInfo->requestType) { + case HGFS_OP_OPEN_V3: { + HgfsReplyOpenV3 *reply = (HgfsReplyOpenV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); reply->file = openInfo->file; - *packetSize = sizeof *reply; - } else { - /* Identical reply packet for V2 and V3. */ + if (openInfo->mask & HGFS_OPEN_VALID_SERVER_LOCK) { + reply->acquiredLock = openInfo->acquiredLock; + } + *packetSize = HGFS_REP_PAYLOAD_SIZE_V3(reply); + break; + } + case HGFS_OP_OPEN_V2: { HgfsReplyOpenV2 *reply = (HgfsReplyOpenV2 *)packetOut; reply->file = openInfo->file; if (openInfo->mask & HGFS_OPEN_VALID_SERVER_LOCK) { reply->acquiredLock = openInfo->acquiredLock; } *packetSize = sizeof *reply; + break; + } + case HGFS_OP_OPEN: { + HgfsReplyOpen *reply = (HgfsReplyOpen *)packetOut; + reply->file = openInfo->file; + *packetSize = sizeof *reply; + break; + } + default: + return FALSE; } return TRUE; @@ -3549,7 +3590,7 @@ HgfsPackOpenReply(HgfsFileOpenInfo *openInfo, // IN: open info struct * holds flags to specify a handle or name for the file or * directory to delete. * - * Since the structure of the get delete request packet is the same + * Since the structure of the get delete request packet is the same * for Delete File or Directory of the protocol, code is identical for * both operations. * @@ -3570,7 +3611,7 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet size_t *cpNameSize, // OUT: cpName size HgfsDeleteHint *hints, // OUT: delete hints HgfsHandle *file, // OUT: file handle - uint32 *caseFlags) // OUT: case-sensitivity flags + uint32 *caseFlags) // OUT: case-sensitivity flags { HgfsRequest *request; size_t extra; @@ -3589,17 +3630,17 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet case HGFS_OP_DELETE_FILE_V3: case HGFS_OP_DELETE_DIR_V3: { HgfsRequestDeleteV3 *requestV3; - - requestV3 = (HgfsRequestDeleteV3 *)(packetIn + sizeof *request); + + requestV3 = (HgfsRequestDeleteV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); LOG(4, ("HgfsUnpackDeleteRequest: HGFS_OP_DELETE_DIR_V3\n")); - + /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *requestV3 + sizeof *request); + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); *file = HGFS_INVALID_HANDLE; *hints = requestV3->hints; - /* + /* * If we've been asked to reuse a handle, we don't need to look at, let * alone test the filename or its length. */ @@ -3608,10 +3649,10 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet *cpName = NULL; *cpNameSize = 0; } else { - extra = packetSize - sizeof *requestV3 - sizeof *request; + extra = packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); /* - * request->fileName.length is user-provided, so this test must be + * request->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV3->fileName.length > extra) { @@ -3620,7 +3661,7 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet } *cpName = requestV3->fileName.name; *cpNameSize = requestV3->fileName.length; - *caseFlags = requestV3->fileName.flags; + *caseFlags = requestV3->fileName.caseType; } break; } @@ -3628,14 +3669,14 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet case HGFS_OP_DELETE_DIR_V2: { HgfsRequestDeleteV2 *requestV2; requestV2 = (HgfsRequestDeleteV2 *)packetIn; - + /* Enforced by the dispatch function. */ ASSERT(packetSize >= sizeof *requestV2); *file = HGFS_INVALID_HANDLE; *hints = requestV2->hints; - /* + /* * If we've been asked to reuse a handle, we don't need to look at, let * alone test the filename or its length. */ @@ -3647,7 +3688,7 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet extra = packetSize - sizeof *requestV2; /* - * request->fileName.length is user-provided, so this test must be + * request->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV2->fileName.length > extra) { @@ -3662,7 +3703,7 @@ HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet case HGFS_OP_DELETE_FILE: case HGFS_OP_DELETE_DIR: { HgfsRequestDelete *requestV1; - + requestV1 = (HgfsRequestDelete *)packetIn; /* Enforced by the dispatch function. */ @@ -3716,12 +3757,16 @@ HgfsPackDeleteReply(char *packetOut, // IN/OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsReplyDelete *reply = (HgfsReplyDelete *)packetOut; + HgfsRequest *header = (HgfsRequest *)packetOut; ASSERT(packetOut); ASSERT(packetSize); - *packetSize = sizeof *reply; + if (header->op == HGFS_OP_DELETE_FILE_V3 || header->op == HGFS_OP_DELETE_DIR_V3) { + *packetSize = sizeof(HgfsReplyDeleteV3) + sizeof(HgfsReply); + } else { + *packetSize = sizeof(HgfsReplyDelete); + } return TRUE; } @@ -3757,14 +3802,10 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet HgfsRenameHint *hints, // OUT: rename hints HgfsHandle *srcFile, // OUT: src file handle HgfsHandle *targetFile, // OUT: target file handle - uint32 *oldCaseFlags, // OUT: source case-sensitivity flags - uint32 *newCaseFlags) // OUT: dest. case-sensitivity flags + uint32 *oldCaseFlags, // OUT: source case-sensitivity flags + uint32 *newCaseFlags) // OUT: dest. case-sensitivity flags { - HgfsRequestRename *requestV1; - HgfsRequestRenameV2 *requestV2; - HgfsRequestRenameV3 *requestV3; HgfsRequest *request; - HgfsFileName *newName; size_t extra; ASSERT(packetIn); @@ -3794,15 +3835,20 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet switch (request->op) { case HGFS_OP_RENAME_V3: - requestV3 = (HgfsRequestRenameV3 *)packetIn; - + { + HgfsRequestRenameV3 *requestV3; + HgfsFileNameV3 *newName; + + requestV3 = (HgfsRequestRenameV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + LOG(4, ("HgfsUnpackRenameRequest: HGFS_OP_RENAME_V3\n")); + /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *requestV3); - extra = packetSize - sizeof *requestV3; + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); + extra = packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); *hints = requestV3->hints; - /* + /* * If we've been asked to reuse a handle, we don't need to look at, let * alone test the filename or its length. This applies to the source * and the target. @@ -3815,7 +3861,7 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet } else { /* - * request->fileName.length is user-provided, so this test must be + * request->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV3->oldName.length > extra) { @@ -3826,7 +3872,7 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet /* It is now safe to use the old file name. */ *cpOldName = requestV3->oldName.name; *cpOldNameLen = requestV3->oldName.length; - *oldCaseFlags = requestV3->oldName.flags; + *oldCaseFlags = requestV3->oldName.caseType; } extra -= *cpOldNameLen; @@ -3836,9 +3882,7 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet *cpNewNameLen = 0; *newCaseFlags = 0; } else { - - newName = (HgfsFileName *)((char *)(&requestV3->oldName + 1) - + *cpOldNameLen); + newName = (HgfsFileNameV3 *)(requestV3->oldName.name + 1 + *cpOldNameLen); if (newName->length > extra) { /* The input packet is smaller than the request */ return FALSE; @@ -3847,20 +3891,24 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet /* It is now safe to use the new file name. */ *cpNewName = newName->name; *cpNewNameLen = newName->length; - *newCaseFlags = requestV3->newName.flags; + *newCaseFlags = newName->caseType; } break; - + } case HGFS_OP_RENAME_V2: + { + HgfsRequestRenameV2 *requestV2; + HgfsFileName *newName; + requestV2 = (HgfsRequestRenameV2 *)packetIn; - + /* Enforced by the dispatch function. */ ASSERT(packetSize >= sizeof *requestV2); extra = packetSize - sizeof *requestV2; *hints = requestV2->hints; - /* + /* * If we've been asked to reuse a handle, we don't need to look at, let * alone test the filename or its length. This applies to the source * and the target. @@ -3872,7 +3920,7 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet } else { /* - * request->fileName.length is user-provided, so this test must be + * request->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV2->oldName.length > extra) { @@ -3904,8 +3952,13 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet *cpNewNameLen = newName->length; } break; + } case HGFS_OP_RENAME: + { + HgfsRequestRename *requestV1; + HgfsFileName *newName; + requestV1 = (HgfsRequestRename *)packetIn; /* Enforced by the dispatch function. */ @@ -3941,6 +3994,7 @@ HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet *cpNewName = newName->name; *cpNewNameLen = newName->length; break; + } default: return FALSE; @@ -3976,12 +4030,16 @@ HgfsPackRenameReply(char *packetOut, // IN/OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsReplyRename *reply = (HgfsReplyRename *)packetOut; + HgfsRequest *header = (HgfsRequest *)packetOut; ASSERT(packetOut); ASSERT(packetSize); - *packetSize = sizeof *reply; + if (header->op == HGFS_OP_RENAME_V3) { + *packetSize = sizeof(HgfsReplyRenameV3) + sizeof(HgfsReply); + } else { + *packetSize = sizeof(HgfsReplyRename); + } return TRUE; } @@ -3996,7 +4054,7 @@ HgfsPackRenameReply(char *packetOut, // IN/OUT: outgoing packet * HgfsFileAttrInfo structure that is used to pass around getattr request * information. * - * Since the structure of the get attributes request packet hasn't changed + * Since the structure of the get attributes request packet hasn't changed * in version 2 of the protocol, HgfsRequestGetattrV2 is identical to * HgfsRequestGetattr. So use HgfsRequestGetattr type to access packetIn to * keep the code simple. @@ -4019,11 +4077,8 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet char **cpName, // OUT: cpName size_t *cpNameSize, // OUT: cpName size HgfsHandle *file, // OUT: file handle - uint32 *caseFlags) // OUT: case-sensitivity flags + uint32 *caseFlags) // OUT: case-sensitivity flags { - HgfsRequestGetattr *requestV1; - HgfsRequestGetattrV2 *requestV2; - HgfsRequestGetattrV3 *requestV3; HgfsRequest *request; size_t extra; @@ -4039,14 +4094,16 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet *caseFlags = HGFS_FILE_NAME_DEFAULT_CASE; switch (request->op) { - case HGFS_OP_GETATTR_V3: - requestV3 = (HgfsRequestGetattrV3 *)(packetIn + sizeof(struct HgfsRequest)); - LOG(4, ("HgfsUnpackGetattrRequest: HGFS_OP_GETATTR_V3\n")); + case HGFS_OP_GETATTR_V3: { + HgfsRequestGetattrV3 *requestV3; + requestV3 = (HgfsRequestGetattrV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + LOG(4, ("HgfsUnpackGetattrRequest: HGFS_OP_GETATTR_V3\n")); + /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *requestV3 + sizeof(struct HgfsRequest)); + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); - /* + /* * If we've been asked to reuse a handle, we don't need to look at, let * alone test the filename or its length. */ @@ -4056,10 +4113,10 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet *cpName = NULL; *cpNameSize = 0; } else { - extra = packetSize - sizeof *requestV3 - sizeof(struct HgfsRequest); + extra = packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); /* - * request->fileName.length is user-provided, so this test must be + * request->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV3->fileName.length > extra) { @@ -4068,19 +4125,21 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet } *cpName = requestV3->fileName.name; *cpNameSize = requestV3->fileName.length; - *caseFlags = requestV3->fileName.flags; + *caseFlags = requestV3->fileName.caseType; LOG(4, ("HgfsUnpackGetattrRequest: HGFS_OP_GETATTR_V3: %u\n", *caseFlags)); } break; + } - case HGFS_OP_GETATTR_V2: + case HGFS_OP_GETATTR_V2: { + HgfsRequestGetattrV2 *requestV2; requestV2 = (HgfsRequestGetattrV2 *)packetIn; - + /* Enforced by the dispatch function. */ ASSERT(packetSize >= sizeof *requestV2); - /* + /* * If we've been asked to reuse a handle, we don't need to look at, let * alone test the filename or its length. */ @@ -4093,7 +4152,7 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet extra = packetSize - sizeof *requestV2; /* - * request->fileName.length is user-provided, so this test must be + * request->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV2->fileName.length > extra) { @@ -4104,8 +4163,10 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet *cpNameSize = requestV2->fileName.length; } break; + } - case HGFS_OP_GETATTR: + case HGFS_OP_GETATTR: { + HgfsRequestGetattr *requestV1; requestV1 = (HgfsRequestGetattr *)packetIn; /* Enforced by the dispatch function. */ @@ -4124,6 +4185,7 @@ HgfsUnpackGetattrRequest(char const *packetIn, // IN: request packet *cpName = requestV1->fileName.name; *cpNameSize = requestV1->fileName.length; break; + } default: return FALSE; @@ -4180,9 +4242,10 @@ HgfsPackGetattrReply(HgfsFileAttrInfo *attr, // IN: attr stucture ASSERT(packetSize); ASSERT(attr); - if (attr->requestType == HGFS_OP_GETATTR_V3) { - HgfsReplyGetattrV3 *reply = (HgfsReplyGetattrV3 *)(packetOut + - sizeof(struct HgfsRequest)); + switch (attr->requestType) { + case HGFS_OP_GETATTR_V3: { + HgfsReplyGetattrV3 *reply = + (HgfsReplyGetattrV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); reply->attr.mask = attr->mask; reply->attr.type = attr->type; @@ -4195,7 +4258,7 @@ HgfsPackGetattrReply(HgfsFileAttrInfo *attr, // IN: attr stucture * Also keep in mind that sizeof *reply already contains one character, * which we'll consider the nul terminator. */ - if (utf8TargetNameLen > HGFS_PACKET_MAX - sizeof *reply - sizeof(struct HgfsReply)) { + if (utf8TargetNameLen > HGFS_PACKET_MAX - HGFS_REP_PAYLOAD_SIZE_V3(reply)) { return FALSE; } if (utf8TargetName) { @@ -4207,7 +4270,8 @@ HgfsPackGetattrReply(HgfsFileAttrInfo *attr, // IN: attr stucture } reply->symlinkTarget.length = utf8TargetNameLen; reply->symlinkTarget.name[utf8TargetNameLen] = '\0'; - reply->symlinkTarget.flags = HGFS_FILE_NAME_DEFAULT_CASE; + reply->symlinkTarget.caseType = 0; + reply->symlinkTarget.caseType = HGFS_FILE_NAME_DEFAULT_CASE; reply->attr.size = attr->size; reply->attr.creationTime = attr->creationTime; @@ -4223,8 +4287,11 @@ HgfsPackGetattrReply(HgfsFileAttrInfo *attr, // IN: attr stucture reply->attr.userId = attr->userId; reply->attr.groupId = attr->groupId; reply->attr.hostFileId = attr->hostFileId; - *packetSize = sizeof *reply + utf8TargetNameLen + sizeof(struct HgfsReply); - } else if (attr->requestType == HGFS_OP_GETATTR_V2) { + *packetSize = HGFS_REP_PAYLOAD_SIZE_V3(reply) + utf8TargetNameLen; + break; + } + + case HGFS_OP_GETATTR_V2: { HgfsReplyGetattrV2 *reply = (HgfsReplyGetattrV2 *)packetOut; reply->attr.mask = attr->mask; reply->attr.type = attr->type; @@ -4266,7 +4333,10 @@ HgfsPackGetattrReply(HgfsFileAttrInfo *attr, // IN: attr stucture reply->attr.groupId = attr->groupId; reply->attr.hostFileId = attr->hostFileId; *packetSize = sizeof *reply + utf8TargetNameLen; - } else { + break; + } + + case HGFS_OP_GETATTR: { HgfsReplyGetattr *reply = (HgfsReplyGetattr *)packetOut; /* In GetattrV1, symlinks are treated as regular files. */ @@ -4283,6 +4353,12 @@ HgfsPackGetattrReply(HgfsFileAttrInfo *attr, // IN: attr stucture reply->attr.attrChangeTime = attr->attrChangeTime; reply->attr.permissions = attr->ownerPerms; *packetSize = sizeof *reply; + break; + } + + default: + LOG(4, ("HgfsPackGetattrReply: Invalid GetAttr op.\n")); + return FALSE; } return TRUE; @@ -4319,29 +4395,37 @@ HgfsUnpackSearchReadRequest(const char *packetIn, // IN: request packet HgfsHandle *hgfsSearchHandle, // OUT: hgfs search handle uint32 *offset) // OUT: entry offset { - HgfsRequestSearchRead *request; - + HgfsRequest *header = (HgfsRequest *)packetIn; ASSERT(packetIn); ASSERT(attr); ASSERT(hgfsSearchHandle); ASSERT(offset); - /* XXX: Changes required for VMCI. */ - request = (HgfsRequestSearchRead *)packetIn; + if (header->op == HGFS_OP_SEARCH_READ_V3) { + HgfsRequestSearchReadV3 *request; - /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *request); + request = (HgfsRequestSearchReadV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); - *hgfsSearchHandle = request->search; - *offset = request->offset; + /* Enforced by the dispatch function. */ + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(request)); - /* Initialize the rest of the fields. */ - attr->requestType = request->header.op; + *hgfsSearchHandle = request->search; + *offset = request->offset; - if (request->header.op == HGFS_OP_SEARCH_READ_V3) { LOG(4, ("HgfsUnpackSearchReadRequest: HGFS_OP_SEARCH_READ_V3\n")); + } else { + HgfsRequestSearchRead *request; + + request = (HgfsRequestSearchRead *)packetIn; + + /* Enforced by the dispatch function. */ + ASSERT(packetSize >= sizeof *request); + + *hgfsSearchHandle = request->search; + *offset = request->offset; } + attr->requestType = header->op; attr->mask = HGFS_ATTR_VALID_NONE; attr->type = 0; attr->size = 0; @@ -4387,9 +4471,10 @@ HgfsPackSearchReadReply(const char *utf8Name, // IN: file name char *packetOut, // IN/OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - if (attr->requestType == HGFS_OP_SEARCH_READ_V3) { - HgfsReplySearchReadV3 *reply = (HgfsReplySearchReadV3 *)packetOut + - sizeof(struct HgfsRequest); + switch (attr->requestType) { + case HGFS_OP_SEARCH_READ_V3: { + HgfsReplySearchReadV3 *reply = + (HgfsReplySearchReadV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); HgfsDirEntry *dirent = (HgfsDirEntry *)reply->payload; /* @@ -4401,16 +4486,16 @@ HgfsPackSearchReadReply(const char *utf8Name, // IN: file name * Also keep in mind that sizeof *reply already contains one character, * which we'll consider the nul terminator. */ - if (utf8NameLen > HGFS_PACKET_MAX - sizeof *reply - sizeof(struct HgfsReply) - - sizeof(struct HgfsDirEntry)) { + if (utf8NameLen > HGFS_PACKET_MAX - HGFS_REP_PAYLOAD_SIZE_V3(reply) - + sizeof(struct HgfsDirEntry)) { return FALSE; } - *packetSize = sizeof *reply + utf8NameLen + sizeof(struct HgfsReply) - + sizeof(struct HgfsDirEntry); + *packetSize = HGFS_REP_PAYLOAD_SIZE_V3(reply) + utf8NameLen + sizeof *dirent; reply->count = 1; dirent->fileName.length = (uint32)utf8NameLen; - dirent->fileName.flags = HGFS_FILE_NAME_DEFAULT_CASE; + dirent->fileName.caseType = 0; + dirent->fileName.caseType = HGFS_FILE_NAME_DEFAULT_CASE; dirent->nextEntry = 0; if (utf8NameLen == 0) { @@ -4437,7 +4522,10 @@ HgfsPackSearchReadReply(const char *utf8Name, // IN: file name dirent->attr.userId = attr->userId; dirent->attr.groupId = attr->groupId; dirent->attr.hostFileId = attr->hostFileId; - } else if (attr->requestType == HGFS_OP_SEARCH_READ_V2) { + break; + } + + case HGFS_OP_SEARCH_READ_V2: { HgfsReplySearchReadV2 *reply = (HgfsReplySearchReadV2 *)packetOut; /* @@ -4480,8 +4568,10 @@ HgfsPackSearchReadReply(const char *utf8Name, // IN: file name reply->attr.userId = attr->userId; reply->attr.groupId = attr->groupId; reply->attr.hostFileId = attr->hostFileId; - - } else { + break; + } + + case HGFS_OP_SEARCH_READ: { HgfsReplySearchRead *reply = (HgfsReplySearchRead *)packetOut; /* @@ -4519,6 +4609,13 @@ HgfsPackSearchReadReply(const char *utf8Name, // IN: file name reply->attr.writeTime = attr->writeTime; reply->attr.attrChangeTime = attr->attrChangeTime; reply->attr.permissions = attr->ownerPerms; + break; + } + + default: { + LOG(4, ("HgfsPackSearchReadReply: Invalid SearchRead Op.")); + return FALSE; + } } return TRUE; @@ -4552,7 +4649,7 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet char **cpName, // OUT: cpName size_t *cpNameSize, // OUT: cpName size HgfsHandle *file, // OUT: server file ID - uint32 *caseFlags) // OUT: case-sensitivity flags + uint32 *caseFlags) // OUT: case-sensitivity flags { HgfsRequest *request; size_t extra; @@ -4572,11 +4669,11 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet switch (attr->requestType) { case HGFS_OP_SETATTR_V3: { - HgfsRequestSetattrV3 *requestV3 = - (HgfsRequestSetattrV3 *)(packetIn + sizeof(struct HgfsRequest)); + HgfsRequestSetattrV3 *requestV3 = + (HgfsRequestSetattrV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *requestV3 + sizeof(struct HgfsRequest)); + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); attr->mask = requestV3->attr.mask; attr->type = requestV3->attr.type; @@ -4594,11 +4691,11 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet attr->userId = requestV3->attr.userId; attr->groupId = requestV3->attr.groupId; attr->hostFileId = requestV3->attr.hostFileId; - + *hints = requestV3->hints; - /* - * If we've been asked to reuse a handle, we don't need to look at, + /* + * If we've been asked to reuse a handle, we don't need to look at, * let alone test the filename or its length. */ if (*hints & HGFS_ATTR_HINT_USE_FILE_DESC) { @@ -4607,7 +4704,7 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet *cpNameSize = 0; *caseFlags = 0; } else { - extra = packetSize - sizeof *requestV3 - sizeof(struct HgfsRequest); + extra = packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); if (requestV3->fileName.length > extra) { /* The input packet is smaller than the request. */ @@ -4616,7 +4713,7 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet /* It is now safe to read the file name. */ *cpName = requestV3->fileName.name; *cpNameSize = requestV3->fileName.length; - *caseFlags = requestV3->fileName.flags; + *caseFlags = requestV3->fileName.caseType; } LOG(4, ("HgfsUnpackSetattrRequest: unpacking HGFS_OP_SETATTR_V3, %u\n", *caseFlags)); break; @@ -4624,7 +4721,7 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet case HGFS_OP_SETATTR_V2: { - HgfsRequestSetattrV2 *requestV2 = + HgfsRequestSetattrV2 *requestV2 = (HgfsRequestSetattrV2 *)packetIn; /* Enforced by the dispatch function. */ @@ -4646,11 +4743,11 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet attr->userId = requestV2->attr.userId; attr->groupId = requestV2->attr.groupId; attr->hostFileId = requestV2->attr.hostFileId; - + *hints = requestV2->hints; - /* - * If we've been asked to reuse a handle, we don't need to look at, + /* + * If we've been asked to reuse a handle, we don't need to look at, * let alone test the filename or its length. */ if (*hints & HGFS_ATTR_HINT_USE_FILE_DESC) { @@ -4673,15 +4770,15 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet } case HGFS_OP_SETATTR: { - HgfsRequestSetattr *requestV1 = + HgfsRequestSetattr *requestV1 = (HgfsRequestSetattr *)packetIn; - + /* Enforced by the dispatch function. */ ASSERT(packetSize >= sizeof *requestV1); extra = packetSize - sizeof *requestV1; - + /* - * requestV1->fileName.length is user-provided, so this test must be + * requestV1->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ @@ -4689,11 +4786,11 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet /* The input packet is smaller than the request. */ return FALSE; } - + /* It is now safe to read the file name. */ *cpName = requestV1->fileName.name; *cpNameSize = requestV1->fileName.length; - + attr->mask = 0; attr->mask |= requestV1->update & HGFS_ATTR_SIZE ? @@ -4719,17 +4816,17 @@ HgfsUnpackSetattrRequest(char const *packetIn, // IN: request packet requestV1->update & HGFS_ATTR_PERMISSIONS ? HGFS_ATTR_VALID_OWNER_PERMS : 0; - + *hints |= requestV1->update & HGFS_ATTR_ACCESS_TIME_SET ? HGFS_ATTR_HINT_SET_ACCESS_TIME : 0; - + *hints |= requestV1->update & HGFS_ATTR_WRITE_TIME_SET ? HGFS_ATTR_HINT_SET_WRITE_TIME : 0; - + attr->type = requestV1->attr.type; attr->size = requestV1->attr.size; attr->creationTime = requestV1->attr.creationTime; @@ -4773,12 +4870,16 @@ HgfsPackSetattrReply(char *packetOut, // IN/OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsReplySetattr *reply = (HgfsReplySetattr *)packetOut; + HgfsRequest *header = (HgfsRequest *)packetOut; ASSERT(packetOut); ASSERT(packetSize); - *packetSize = sizeof *reply; + if (header->op == HGFS_OP_SETATTR_V3) { + *packetSize = sizeof(HgfsReplySetattrV3) + sizeof(HgfsReply); + } else { + *packetSize = sizeof(HgfsReplySetattr); + } return TRUE; } @@ -4810,7 +4911,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet { HgfsRequest *request; size_t extra; - + ASSERT(packetIn); ASSERT(info); request = (HgfsRequest *)packetIn; @@ -4821,12 +4922,12 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet switch (info->requestType) { case HGFS_OP_CREATE_DIR_V3: { - HgfsRequestCreateDirV3 *requestV3 = - (HgfsRequestCreateDirV3 *)(packetIn + sizeof *request); + HgfsRequestCreateDirV3 *requestV3 = + (HgfsRequestCreateDirV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); /* Enforced by the dispatch function. */ - ASSERT(packetSize >= sizeof *requestV3 + sizeof *request); - extra = packetSize - sizeof *requestV3 - sizeof *request; + ASSERT(packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); + extra = packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); if (!(requestV3->mask & HGFS_CREATE_DIR_VALID_FILE_NAME)) { /* We do not support requests without a valid file name. */ @@ -4834,7 +4935,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet } /* - * requestV3->fileName.length is user-provided, so this test must be + * requestV3->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV3->fileName.length > extra) { @@ -4850,7 +4951,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet info->mask = requestV3->mask; info->cpName = requestV3->fileName.name; info->cpNameSize = requestV3->fileName.length; - info->caseFlags = requestV3->fileName.flags; + info->caseFlags = requestV3->fileName.caseType; info->specialPerms = requestV3->specialPerms; info->ownerPerms = requestV3->ownerPerms; info->groupPerms = requestV3->groupPerms; @@ -4860,7 +4961,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet } case HGFS_OP_CREATE_DIR_V2: { - HgfsRequestCreateDirV2 *requestV2 = + HgfsRequestCreateDirV2 *requestV2 = (HgfsRequestCreateDirV2 *)packetIn; /* Enforced by the dispatch function. */ @@ -4873,7 +4974,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet } /* - * requestV2->fileName.length is user-provided, so this test must be + * requestV2->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ if (requestV2->fileName.length > extra) { @@ -4905,7 +5006,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet extra = packetSize - sizeof *requestV1; /* - * requestV1->fileName.length is user-provided, so this test must be + * requestV1->fileName.length is user-provided, so this test must be * carefully written to prevent wraparounds. */ @@ -4915,7 +5016,7 @@ HgfsUnpackCreateDirRequest(char const *packetIn, // IN: incoming packet } /* For CreateDirV1 requests, we know exactly what fields we expect. */ - info->mask = + info->mask = HGFS_CREATE_DIR_VALID_OWNER_PERMS | HGFS_CREATE_DIR_VALID_FILE_NAME; info->cpName = requestV1->fileName.name; @@ -4956,12 +5057,16 @@ HgfsPackCreateDirReply(char *packetOut, // IN/OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsReplyCreateDir *reply = (HgfsReplyCreateDir *)packetOut; + HgfsRequest *header = (HgfsRequest *)packetOut; ASSERT(packetOut); ASSERT(packetSize); - *packetSize = sizeof *reply; + if (header->op == HGFS_OP_CREATE_DIR_V3) { + *packetSize = sizeof(HgfsReplyCreateDirV3) + sizeof(HgfsReply); + } else { + *packetSize = sizeof(HgfsReplyCreateDir); + } return TRUE; } @@ -5100,7 +5205,7 @@ HgfsServer_ExitState(void) if (nodeArray[i].state == FILENODE_STATE_UNUSED) { continue; } - + handle = HgfsFileNode2Handle(&nodeArray[i]); HgfsRemoveFromCacheInternal(handle); HgfsFreeFileNodeInternal(handle); @@ -5116,7 +5221,7 @@ HgfsServer_ExitState(void) } free(searchArray); searchArray = NULL; - + SyncMutex_Destroy(&hgfsIOLock); SyncMutex_Destroy(&hgfsSearchArrayLock); SyncMutex_Destroy(&hgfsNodeArrayLock); @@ -5161,8 +5266,8 @@ HgfsServerOplockBreakReply(const unsigned char *packetIn, // IN: Reply packet } reply = (HgfsReplyServerLockChange *)packetIn; lockData = (ServerLockData *)clientData; - - /* + + /* * XXX: It should be safe to ignore the status and id from the actual * HgfsReply. The only information we need to properly acknowledge the break * is the original fd and the new lease, which, in the case of a degrade, @@ -5180,12 +5285,12 @@ HgfsServerOplockBreakReply(const unsigned char *packetIn, // IN: Reply packet * * When the host FS needs to break the oplock so that another client * can open the file, it signals the event in the overlapped structure - * that we used to request an oplock. + * that we used to request an oplock. * This sets off the following chains of events: * 1. Send the oplock break request to the guest. - * 2. Once the guest acknowledges the oplock break, the completion + * 2. Once the guest acknowledges the oplock break, the completion * routine GuestRpcServerRequestCallback will fire, causing - * HgfsServerOplockBreakReply to also fire, which will break the oplock + * HgfsServerOplockBreakReply to also fire, which will break the oplock * on the host FS. * * Results: @@ -5207,16 +5312,16 @@ HgfsServerOplockBreak(ServerLockData *lockData) LOG(4, ("HgfsServerOplockBreak: entered\n")); - /* - * XXX: Just because the file in not in the cache on the server, + /* + * XXX: Just because the file in not in the cache on the server, * does not mean it was closed on the client. It is possible that * we closed the file on the server because we ran out of space * in cache. That's why for now as long as a file has a lock, * we don't remove it from the node cache. This should be fixed. * - * In any case, none of these cache-related failures should cause us to ack - * the oplock break locally. That is because if the file wasn't in the - * cache, or it had no lock, chances are someone else (maybe the VCPU + * In any case, none of these cache-related failures should cause us to ack + * the oplock break locally. That is because if the file wasn't in the + * cache, or it had no lock, chances are someone else (maybe the VCPU * thread) broke the oplock and/or closed the file. */ if (!HgfsFileDesc2Handle(lockData->fileDesc, &hgfsHandle)) { @@ -5234,11 +5339,11 @@ HgfsServerOplockBreak(ServerLockData *lockData) goto free_and_exit; } - /* + /* * We need to setup the entire request here. The command prefix will be - * added later, so save some space for it. - * - * XXX: This should probably go into a common allocation function that + * added later, so save some space for it. + * + * XXX: This should probably go into a common allocation function that * other out-of-band requests can use. */ requestBuffer = malloc(sizeof *request + HGFS_CLIENT_CMD_LEN); @@ -5254,12 +5359,12 @@ HgfsServerOplockBreak(ServerLockData *lockData) request->header.id = 0; /* XXX */ request->file = hgfsHandle; request->newServerLock = lockData->serverLock; - - /* + + /* * Just send the request size for our actual request; our callee will * write in the command prefix and modify the request size appropriately. - * - * If for some reason we fail, we'll acknowledge the oplock break + * + * If for some reason we fail, we'll acknowledge the oplock break * immediately. */ if (HgfsServerManager_SendRequest(requestBuffer, @@ -5269,7 +5374,7 @@ HgfsServerOplockBreak(ServerLockData *lockData) return; } free(requestBuffer); - + ack_and_exit: HgfsAckOplockBreak(lockData, HGFS_LOCK_NONE); return; diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c index 23ba68baa..65835a8ce 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c @@ -218,7 +218,7 @@ futimes(int fd, const struct timeval times[2]) if (snprintf(nameBuffer, sizeof nameBuffer, PROC_SELF_FD "%d", fd) < 0) { return -1; } - return utimes(nameBuffer, mytimes); + return Posix_Utimes(nameBuffer, mytimes); #else /* !sun */ return futimesat(fd, NULL, times); #endif /* !sun */ @@ -280,12 +280,7 @@ static int HgfsStatFromName(char *fileName, #ifndef __FreeBSD__ static int HgfsCaseInsensitiveLookup(char *fileName, - char *shareName); - -#if 0 -static int HgfsToUpper(char *src, - char *dst); -#endif + char *sharePath); static int HgfsToLower(char *src, char *dst); @@ -728,7 +723,7 @@ HgfsCheckFileNode(char const *localName, // IN * file name still refers to the same pair */ - if (stat(localName, &nodeStat) < 0) { + if (Posix_Stat(localName, &nodeStat) < 0) { int error = errno; LOG(4, ("HgfsCheckFileNode: couldn't stat local file \"%s\": %s\n", localName, strerror(error))); @@ -802,7 +797,7 @@ HgfsGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle * in append mode. If not, close the file and reopen it in append * mode. */ - if (append && !(node.flags & FILE_NODE_APPEND_FL)) { + if (append && !(node.flags & HGFS_FILE_NODE_APPEND_FL)) { status = HgfsCloseFile(node.fileDesc); if (status != 0) { LOG(4, ("HgfsGetFd: Couldn't close file \"%s\" for reopening\n", @@ -847,7 +842,7 @@ HgfsGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle * * XXX: We should use O_LARGEFILE, see lib/file/fileIOPosix.c --hpreg */ - newFd = open(node.utf8Name, + newFd = Posix_Open(node.utf8Name, node.mode | openFlags | (append ? O_APPEND : 0)); if (newFd < 0) { @@ -957,7 +952,7 @@ HgfsValidateOpen(HgfsFileOpenInfo *openInfo, // IN: Open info struct /* * Try to open the file with the requested mode, flags and permissions. */ - fd = open(openInfo->utf8Name, + fd = Posix_Open(openInfo->utf8Name, openMode | openFlags, openPerms); if (fd < 0) { @@ -1161,6 +1156,15 @@ HgfsGetattrResolveAlias(char const *fileName, // IN: Input filename /* * If alias points to an unmounted volume, the volume needs to be explicitly * mounted on the host. Mount flag kResolveAliasFileNoUI serves the purpose. + * + * XXX: This function returns fnfErr (file not found) if it encounters a + * broken alias. Perhaps we should make that look like a dangling symlink + * instead of returning an error? + * + * XXX: It also returns errors if it encounters a file with a .alias suffix + * that isn't a real alias. That's OK for now because our caller + * (HgfsGetattrFromName) will assume that an error means the file is a + * regular file. */ osStatus = FSResolveAliasFileWithMountFlags(&fileRef, FALSE, &targetIsFolder, &wasAliased, kResolveAliasFileNoUI); @@ -1280,7 +1284,7 @@ HgfsGetHiddenAttr(char const *fileName, // IN: Input filename * NOTE: fileName needs to be of size PATH_MAX. * * Results: - * 0 on Success, -1 otherwise. + * 0 on Success, non-zero otherwise. * String str converted to lower-case and placed in dst. * * Side effects: @@ -1309,11 +1313,11 @@ HgfsToLower(char *src, // IN: Input filename } if (ret == (size_t) -2) { LOG(4, ("%s: mbrtowc failed: %d: %s\n", __FUNCTION__, (int)ret, strerror(errno))); - return -1; + return errno; } if (ret == (size_t) -1) { LOG(4, ("%s: mbrtowc failed: %d\n", __FUNCTION__, (int)ret)); - return -1; + return errno; } src += ret; wc = towlower(wc); @@ -1324,71 +1328,13 @@ HgfsToLower(char *src, // IN: Input filename return 0; } -#if 0 - -/* - *----------------------------------------------------------------------------- - * - * HgfsToUpper -- - * - * Convert string to upper-case independent of the locale. - * - * NOTE: fileName needs to be of size PATH_MAX. - * - * Results: - * 0 on Success, -1 otherwise. - * String str converted to upper-case and placed in dst. - * - * Side effects: - * None. - * - *----------------------------------------------------------------------------- - */ - -static int -HgfsToUpper(char *src, // IN: Input filename - char *dst) // OUT: converted filename -{ - char *end = src + strlen(src); - wchar_t wc; - mbstate_t mbs1, mbs2; - size_t ret; - - memset(&mbs1, 0, sizeof(mbstate_t)); - memset(&mbs2, 0, sizeof(mbstate_t)); - while (src < end) { - ret = mbrtowc(&wc, src, end - src, &mbs1); - if (ret == 0) { - *dst++ = '\0'; - src++; - continue; - } - if (ret == (size_t) -2) { - LOG(4, ("%s: mbrtowc failed: %d: %s\n", __FUNCTION__, ret, strerror(errno))); - return -1; - } - if (ret == (size_t) -1) { - LOG(4, ("%s: mbrtowc failed: %d\n", __FUNCTION__, ret)); - return -1; - } - src += ret; - wc = towupper(wc); - ret = wcrtomb(dst, wc, &mbs2); - dst += ret; - } - *dst++ = '\0'; - return 0; -} - -#endif - /* *----------------------------------------------------------------------------- * * HgfsCaseInsensitiveLookup -- * - * Do case insensitivie lookup for fileName. Each component past shareName is + * Do case insensitivie lookup for fileName. Each component past sharePath is * looked-up case-insensitively. Expensive! * * NOTE: fileName needs to be of size PATH_MAX. @@ -1404,40 +1350,40 @@ HgfsToUpper(char *src, // IN: Input filename */ static int -HgfsCaseInsensitiveLookup(char *fileName, // IN / OUT - char *shareName) // IN +HgfsCaseInsensitiveLookup(char *fileName, // IN/OUT + char *sharePath) // IN { - char *fileSuffix = fileName + strlen(shareName) + 1; + char *fileSuffix = fileName + strlen(sharePath) + 1; char curDir[PATH_MAX]; char convertedFileName[PATH_MAX]; char convertedComponent[PATH_MAX]; struct dirent *dirent; - DIR *dir; - char *ptr; + DIR *dir = NULL; + char *ptr = NULL; int error; - strcpy(curDir, shareName); + Str_Strcpy(curDir, sharePath, PATH_MAX); again: + /* Open the shared directory. */ dir = opendir(curDir); if (!dir) { - return ENOENT; + goto not_found; } + /* Get a component. */ ptr = strchr(fileSuffix, DIRSEPC); if (ptr) { *ptr = '\0'; } + /* Convert the component to a lower case. */ error = HgfsToLower(fileSuffix, convertedComponent); if (error) { - if (ptr) { - *ptr = DIRSEPC; - } - closedir(dir); - return ENOENT; + goto not_found; } + /* Compare the lower case component with lower case directory entry. */ while ((dirent = readdir(dir))) { error = HgfsToLower(dirent->d_name, convertedFileName); if (error) { @@ -1450,20 +1396,27 @@ again: fileSuffix = ptr + 1; closedir(dir); if (!ptr) { - strcpy(fileName, curDir); - return 0; - } + Str_Strcpy(fileName, curDir, PATH_MAX); + goto found; + } *ptr = DIRSEPC; goto again; } } +not_found: /* Match not found. */ if (ptr) { *ptr = DIRSEPC; } - closedir(dir); + if (dir) { + closedir(dir); + } return ENOENT; + +found: + return 0; + } #endif @@ -1490,29 +1443,23 @@ again: int HgfsServerConvertCase(HgfsSharedFolder *share, // IN uint32 caseFlags, // IN - char *fileName) // IN / OUT + char *fileName) // IN/OUT { + int error = 0; #ifndef __FreeBSD__ - int error; - char *fileBaseName; - ASSERT(fileName); - LOG(4, ("%s: fileName: #%s# %u, %d\n", __FUNCTION__, fileName, caseFlags, (int)caseFlags)); + LOG(4, ("%s: fileName: #%s# %u\n", __FUNCTION__, fileName, caseFlags)); if (!share) { return -1; } - /* fileBaseName is the relative path of the file. */ - fileBaseName = fileName + share->pathLen; - if (caseFlags == HGFS_FILE_NAME_CASE_INSENSITIVE) { - LOG(4, ("%s: %u, %d\n", __FUNCTION__, caseFlags, (int)caseFlags)); + LOG(4, ("%s: Case insensitive lookup.\n", __FUNCTION__)); error = HgfsCaseInsensitiveLookup(fileName, share->path); - return error; } #endif - return 0; + return error; } @@ -1535,16 +1482,16 @@ HgfsServerConvertCase(HgfsSharedFolder *share, // IN */ static int -HgfsStatFromName(char *fileName, // IN: filename +HgfsStatFromName(char *fileName, // IN: filename to stat HgfsSharedFolder *share, // IN: share - uint32 caseFlags, // IN: case-sensitivity flags + uint32 caseFlags, // IN: case-sensitivity flags struct stat *stats) // OUT: file stats { int error; /* Simple case - plain lookup. */ errno = 0; - error = lstat(fileName, stats); + error = Posix_Lstat(fileName, stats); if (!error || errno != ENOENT) { return errno; } @@ -1553,10 +1500,15 @@ HgfsStatFromName(char *fileName, // IN: filename return ENOENT; } - if (!strncmp(fileName, share->path, strlen(fileName))) { + /* If fileName is same as share path, access is denied. */ + if (!Str_Strncmp(fileName, share->path, strlen(fileName))) { return EACCES; } + /* + * If share path is not a prefix in fileName, it is a wrong + * share for this fileName. Return ENOENT. + */ if (Str_Strncmp(share->path, fileName, share->pathLen)) { return ENOENT; } @@ -1568,7 +1520,7 @@ HgfsStatFromName(char *fileName, // IN: filename } LOG(4, ("%s: stating %s\n", __FUNCTION__, fileName)); - error = lstat(fileName, stats); + error = Posix_Lstat(fileName, stats); if (error < 0) { return errno; } @@ -1598,15 +1550,16 @@ HgfsStatFromName(char *fileName, // IN: filename */ static HgfsInternalStatus -HgfsGetattrFromName(char *fileName, // IN / OUT: Input filename - HgfsSharedFolder *share, // IN: Share - uint32 caseFlags, // IN: case-sensitivity flags +HgfsGetattrFromName(char *fileName, // IN/OUT: Input filename + HgfsSharedFolder *share, // IN: Share + uint32 caseFlags, // IN: case-sensitivity flags HgfsFileAttrInfo *attr, // OUT: Struct to copy into char **targetName) // OUT: Symlink target filename { HgfsInternalStatus status = 0; struct stat stats; int error; + char *myTargetName = NULL; ASSERT(attr); LOG(4, ("HgfsGetattrFromName: getting attrs for \"%s\"\n", fileName)); @@ -1636,13 +1589,11 @@ HgfsGetattrFromName(char *fileName, // IN / OUT: Input filename * caller asked. Use st_size and readlink() to do so. */ if (targetName != NULL) { - char *myTargetName; myTargetName = Posix_ReadLink(fileName); if (myTargetName == NULL) { error = errno; LOG(4, ("HgfsGetattrFromName: readlink returned wrong size\n")); - free(myTargetName); /* * Because of an unavoidable race between the lstat(2) and the @@ -1653,20 +1604,23 @@ HgfsGetattrFromName(char *fileName, // IN / OUT: Input filename status = error ? error : ENOMEM; goto exit; } - *targetName = myTargetName; } } else { - char *myTargetName = NULL; - /* * Now is a good time to check if the file was an alias. If so, we'll * treat it as a symlink. + * + * XXX: If HgfsGetattrResolveAlias fails, we'll treat the file as a + * regular file. This isn't completely correct (the function may have + * failed because we're out of memory), but it's better than having to + * call LScopyItemInfoForRef for each file, which may negatively affect + * performance. See: + * + * http://lists.apple.com/archives/carbon-development/2001/Nov/msg00007.html */ LOG(4, ("HgfsGetattrFromName: NOT a directory or symlink\n")); - status = HgfsGetattrResolveAlias(fileName, &myTargetName); - if (status != 0) { + if (HgfsGetattrResolveAlias(fileName, &myTargetName)) { LOG(4, ("HgfsGetattrFromName: could not resolve file aliases\n")); - goto exit; } if (myTargetName != NULL) { /* @@ -1677,23 +1631,34 @@ HgfsGetattrFromName(char *fileName, // IN / OUT: Input filename */ stats.st_size = strlen(myTargetName); stats.st_mode |= ACCESSPERMS; - - /* - * Note that the caller may not actually care about the alias's - * target filename (though it still wants to know that the file is an - * alias). - */ - if (targetName != NULL) { - *targetName = myTargetName; - } else { - free(myTargetName); - } attr->type = HGFS_FILE_TYPE_SYMLINK; } else { attr->type = HGFS_FILE_TYPE_REGULAR; } } + if (myTargetName != NULL && targetName != NULL) { +#if defined(__APPLE__) + /* + * HGFS clients will expect filenames in unicode normal form C + * (precomposed) so Mac hosts must convert from normal form D + * (decomposed). + */ + if (!CodeSet_Utf8FormDToUtf8FormC(myTargetName, + strlen(myTargetName), + targetName, + NULL)) { + LOG(4, ("HgfsGetattrFromName: Unable to normalize form C " + "\"%s\"\n", myTargetName)); + status = HgfsConvertFromNameStatus(HGFS_NAME_STATUS_FAILURE); + goto exit; + } +#else + *targetName = myTargetName; + myTargetName = NULL; +#endif + } + HgfsStat(&stats, attr); /* @@ -1703,6 +1668,7 @@ HgfsGetattrFromName(char *fileName, // IN / OUT: Input filename HgfsGetHiddenAttr(fileName, attr); exit: + free(myTargetName); return status; } @@ -2415,7 +2381,7 @@ HgfsSetattrFromName(char *cpName, // IN: Name LOG(4, ("HgfsSetattrFromName: setting attrs for \"%s\"\n", localName)); /* We need the old stats so that we can preserve times. */ - if (lstat(localName, &statBuf) == -1) { + if (Posix_Lstat(localName, &statBuf) == -1) { error = errno; LOG(4, ("HgfsSetattrFromName: error stating file \"%s\": %s\n", localName, strerror(error))); @@ -2439,7 +2405,7 @@ HgfsSetattrFromName(char *cpName, // IN: Name permsChanged = HgfsSetattrMode(&statBuf, attr, &newPermissions); if (permsChanged) { LOG(4, ("HgfsSetattrFromName: set mode %o\n", (unsigned)newPermissions)); - if (chmod(localName, newPermissions) < 0) { + if (Posix_Chmod(localName, newPermissions) < 0) { error = errno; LOG(4, ("HgfsSetattrFromName: error chmoding file \"%s\": %s\n", localName, strerror(error))); @@ -2453,7 +2419,7 @@ HgfsSetattrFromName(char *cpName, // IN: Name * not be changed, we pass in -1. */ if (idChanged) { - if (lchown(localName, newUid, newGid) < 0) { + if (Posix_Lchown(localName, newUid, newGid) < 0) { error = errno; LOG(4, ("HgfsSetattrFromName: error chowning file \"%s\": %s\n", localName, strerror(error))); @@ -2472,7 +2438,7 @@ HgfsSetattrFromName(char *cpName, // IN: Name LOG(4, ("HgfsSetattrFromName: Client attempted to truncate an " "oplocked file\n")); status = EBUSY; - } else if (truncate(localName, attr->size) < 0) { + } else if (Posix_Truncate(localName, attr->size) < 0) { error = errno; LOG(4, ("HgfsSetattrFromName: error truncating file \"%s\": %s\n", localName, strerror(error))); @@ -2491,7 +2457,7 @@ HgfsSetattrFromName(char *cpName, // IN: Name * when we politely ask with -D_GNU_SOURCE -D_BSD_SOURCE */ - if (utimes(localName, times) < 0) { + if (Posix_Utimes(localName, times) < 0) { error = errno; LOG(4, ("HgfsSetattrFromName: utimes error on file \"%s\": %s\n", localName, strerror(error))); @@ -2547,7 +2513,7 @@ HgfsServerScandir(char const *baseDir, // IN: Directory to search in char buffer[8192]; /* We want a directory. No FIFOs and no symlinks. */ - result = open(baseDir, O_NONBLOCK | O_RDONLY | O_DIRECTORY | O_NOFOLLOW); + result = Posix_Open(baseDir, O_NONBLOCK | O_RDONLY | O_DIRECTORY | O_NOFOLLOW); if (result < 0) { status = errno; LOG(4, ("HgfsServerScandir: error in open: %d (%s)\n", status, @@ -2815,42 +2781,64 @@ HgfsServerRead(char const *packetIn, // IN: incoming packet char *packetOut, // OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsRequestRead *request; - HgfsReplyRead *reply; + HgfsRequest *header = (HgfsRequest *)packetIn; int fd; - uint64 offset; int error; HgfsInternalStatus status; uint32 extra; - uint32 requiredSize; Bool sequentialOpen; + HgfsHandle file; + uint64 offset; + uint32 requiredSize; + char *payload; + uint32 *replyActualSize; + size_t replySize; - request = (HgfsRequestRead *)packetIn; - ASSERT(request); - reply = (HgfsReplyRead *)packetOut; - ASSERT(reply); + ASSERT(packetIn); + ASSERT(packetOut); ASSERT(packetSize); + if (header->op == HGFS_OP_READ_V3) { + HgfsRequestReadV3 *request = + (HgfsRequestReadV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + HgfsReplyReadV3 *reply = (HgfsReplyReadV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); + + file = request->file; + offset = request->offset; + requiredSize = request->requiredSize; + payload = reply->payload; + replyActualSize = &reply->actualSize; + replySize = HGFS_REP_PAYLOAD_SIZE_V3(reply) - 1; + } else { + HgfsRequestRead *request = (HgfsRequestRead *)packetIn; + HgfsReplyRead *reply = (HgfsReplyRead *)packetOut; + + file = request->file; + offset = request->offset; + requiredSize = request->requiredSize; + payload = reply->payload; + replyActualSize = &reply->actualSize; + replySize = sizeof *reply - 1; + } + LOG(4, ("HgfsServerRead: read fh %u, offset %"FMT64"u, count %u\n", - request->file, request->offset, request->requiredSize)); + file, offset, requiredSize)); /* Get the file descriptor from the cache */ - status = HgfsGetFd(request->file, FALSE, &fd); + status = HgfsGetFd(file, FALSE, &fd); if (status != 0) { LOG(4, ("HgfsServerRead: Could not get file descriptor\n")); return status; } - if (!HgfsHandleIsSequentialOpen(request->file, &sequentialOpen)) { + if (!HgfsHandleIsSequentialOpen(file, &sequentialOpen)) { LOG(4, ("HgfsServerRead: Could not get sequenial open status\n")); return EBADF; } - ASSERT_ON_COMPILE(HGFS_PACKET_MAX >= sizeof *reply - 1); - extra = HGFS_PACKET_MAX - (sizeof *reply - 1); - - requiredSize = request->requiredSize; + ASSERT_ON_COMPILE(HGFS_PACKET_MAX >= replySize); + extra = HGFS_PACKET_MAX - replySize; /* * requiredSize is user-provided, so this test must be carefully @@ -2864,15 +2852,12 @@ HgfsServerRead(char const *packetIn, // IN: incoming packet requiredSize = extra; } - offset = request->offset; - - #if defined(GLIBC_VERSION_21) || defined(__APPLE__) /* Read from the file. */ if (sequentialOpen) { - error = read(fd, reply->payload, requiredSize); + error = read(fd, payload, requiredSize); } else { - error = pread(fd, reply->payload, requiredSize, offset); + error = pread(fd, payload, requiredSize, offset); } #else /* @@ -2903,7 +2888,7 @@ HgfsServerRead(char const *packetIn, // IN: incoming packet } } - error = read(fd, reply->payload, requiredSize); + error = read(fd, payload, requiredSize); SyncMutex_Unlock(&hgfsIOLock); #endif if (error < 0) { @@ -2914,12 +2899,13 @@ HgfsServerRead(char const *packetIn, // IN: incoming packet } LOG(4, ("HgfsServerRead: read %d bytes\n", error)); - reply->actualSize = error; - *packetSize = sizeof *reply - 1 + error; + *replyActualSize = error; + replySize += error; + *packetSize = replySize; return 0; error: - if (!HgfsRemoveFromCache(request->file)) { + if (!HgfsRemoveFromCache(file)) { LOG(4, ("HgfsServerRead: Could not remove the node from cache.\n")); } return status; @@ -2948,27 +2934,63 @@ HgfsServerWrite(char const *packetIn, // IN: incoming packet char *packetOut, // OUT: outgoing packet size_t *packetSize) // IN/OUT: size of packet { - HgfsRequestWrite *request; - HgfsReplyWrite *reply; + HgfsRequest *header = (HgfsRequest *)packetIn; uint32 extra; - uint32 requiredSize; HgfsInternalStatus status; int fd; - uint64 offset; int error; Bool sequentialOpen; + HgfsHandle file; + HgfsWriteFlags flags; + uint64 offset; + uint32 requiredSize; + char *payload; + uint32 *actualSize; + size_t replySize; - request = (HgfsRequestWrite *)packetIn; - ASSERT(request); - reply = (HgfsReplyWrite *)packetOut; - ASSERT(reply); + ASSERT(packetIn); + ASSERT(packetOut); ASSERT(packetSize); + + if (header->op == HGFS_OP_WRITE_V3) { + HgfsRequestWriteV3 *request = + (HgfsRequestWriteV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + HgfsReplyWriteV3 *reply = + (HgfsReplyWriteV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); + + /* Enforced by the dispatch function */ + ASSERT(*packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(request) - 1); + extra = *packetSize - (HGFS_REQ_PAYLOAD_SIZE_V3(request) - 1); + + file = request->file; + flags = request->flags; + offset = request->offset; + payload = request->payload; + requiredSize = request->requiredSize; + actualSize = &reply->actualSize; + replySize = HGFS_REP_PAYLOAD_SIZE_V3(reply); + } else { + HgfsRequestWrite *request = (HgfsRequestWrite *)packetIn; + HgfsReplyWrite *reply = (HgfsReplyWrite *)packetOut; - LOG(4, ("HgfsServerWrite: write fh %u, offset %"FMT64"u, count %u\n", - request->file, request->offset, request->requiredSize)); + /* Enforced by the dispatch function */ + ASSERT(*packetSize >= sizeof *request - 1); + extra = *packetSize - (sizeof *request - 1); + + file = request->file; + flags = request->flags; + offset = request->offset; + payload = request->payload; + requiredSize = request->requiredSize; + actualSize = &reply->actualSize; + replySize = sizeof *reply; + } + + LOG(4, ("HgfsServerWrite: write fh %u, offset %"FMT64"u, count %u, extra %u\n", + file, offset, requiredSize, extra)); /* Get the file desriptor from the cache */ - status = HgfsGetFd(request->file, ((request->flags & HGFS_WRITE_APPEND) ? + status = HgfsGetFd(file, ((flags & HGFS_WRITE_APPEND) ? TRUE : FALSE), &fd); @@ -2977,17 +2999,11 @@ HgfsServerWrite(char const *packetIn, // IN: incoming packet return status; } - if (!HgfsHandleIsSequentialOpen(request->file, &sequentialOpen)) { + if (!HgfsHandleIsSequentialOpen(file, &sequentialOpen)) { LOG(4, ("HgfsServerWrite: Could not get sequential open status\n")); return EBADF; } - /* Enforced by the dispatch function */ - ASSERT(*packetSize >= sizeof *request - 1); - extra = *packetSize - (sizeof *request - 1); - - requiredSize = request->requiredSize; - /* * requiredSize is user-provided, so this test must be carefully * written to prevent wraparounds. @@ -3000,14 +3016,12 @@ HgfsServerWrite(char const *packetIn, // IN: incoming packet requiredSize = extra; } - offset = request->offset; - #if defined(GLIBC_VERSION_21) || defined(__APPLE__) /* Write to the file. */ if (sequentialOpen) { - error = write(fd, request->payload, requiredSize); + error = write(fd, payload, requiredSize); } else { - error = pwrite(fd, request->payload, requiredSize, offset); + error = pwrite(fd, payload, requiredSize, offset); } #else /* @@ -3038,7 +3052,7 @@ HgfsServerWrite(char const *packetIn, // IN: incoming packet } } - error = write(fd, request->payload, requiredSize); + error = write(fd, payload, requiredSize); SyncMutex_Unlock(&hgfsIOLock); #endif if (error < 0) { @@ -3049,12 +3063,12 @@ HgfsServerWrite(char const *packetIn, // IN: incoming packet } LOG(4, ("HgfsServerWrite: wrote %d bytes\n", error)); - reply->actualSize = error; - *packetSize = sizeof *reply; + *actualSize = error; + *packetSize = replySize; return 0; error: - if (!HgfsRemoveFromCache(request->file)) { + if (!HgfsRemoveFromCache(file)) { LOG(4, ("HgfsServerWrite: Could not remove the node from cache.\n")); } return status; @@ -3093,7 +3107,8 @@ HgfsServerSearchOpen(char const *packetIn, // IN: incoming packet HgfsNameStatus nameStatus; char *dirName; uint32 dirNameLength; - uint32 caseFlags = HGFS_FILE_NAME_DEFAULT_CASE; + HgfsCaseType caseFlags = HGFS_FILE_NAME_DEFAULT_CASE; + size_t replySize; ASSERT(packetIn); ASSERT(packetOut); @@ -3102,18 +3117,21 @@ HgfsServerSearchOpen(char const *packetIn, // IN: incoming packet if (header->op == HGFS_OP_SEARCH_OPEN_V3) { HgfsRequestSearchOpenV3 *requestV3; + HgfsReplySearchOpenV3 *replyV3; + + requestV3 = (HgfsRequestSearchOpenV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + replyV3 = (HgfsReplySearchOpenV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); - requestV3 = (HgfsRequestSearchOpenV3 *)(packetIn + sizeof *header); /* Enforced by the dispatch function */ - ASSERT(*packetSize >= sizeof *requestV3 + sizeof *header); - extra = *packetSize - sizeof *requestV3 - sizeof *header; + ASSERT(*packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); + extra = *packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); - caseFlags = requestV3->dirName.flags; + caseFlags = requestV3->dirName.caseType; dirName = requestV3->dirName.name; - dirNameLength = requestV3->dirName.length; - replySearch = &((HgfsReplySearchOpenV3 *)(packetOut - + sizeof(struct HgfsReply)))->search; - *packetSize = sizeof(struct HgfsReplySearchOpen) + sizeof(struct HgfsReply); + dirNameLength = requestV3->dirName.length; + replySearch = &replyV3->search; + + replySize = HGFS_REP_PAYLOAD_SIZE_V3(replyV3); LOG(4, ("HgfsServerSearchOpen: HGFS_OP_SEARCH_OPEN_V3\n")); } else { HgfsRequestSearchOpen *request; @@ -3126,7 +3144,7 @@ HgfsServerSearchOpen(char const *packetIn, // IN: incoming packet dirName = request->dirName.name; dirNameLength = request->dirName.length; replySearch = &((HgfsReplySearchOpen *)packetOut)->search; - *packetSize = sizeof(struct HgfsReplySearchOpen); + replySize = sizeof *request; } /* @@ -3195,6 +3213,7 @@ HgfsServerSearchOpen(char const *packetIn, // IN: incoming packet * open. */ *replySearch = handle; + *packetSize = replySize; exit: return status; } @@ -3655,7 +3674,7 @@ HgfsServerCreateDir(char const *packetIn, // IN: incoming packet LOG(4, ("HgfsServerCreateDir: making dir \"%s\", mode %"FMTMODE"\n", localName, permissions)); - error = mkdir(localName, permissions); + error = Posix_Mkdir(localName, permissions); free(localName); if (error) { error = errno; @@ -3692,8 +3711,6 @@ HgfsServerDeleteFile(char const *packetIn, // IN: incoming packet size_t *packetSize) // IN/OUT: size of packet { HgfsNameStatus nameStatus; - HgfsRequestDelete *request; - HgfsReplyDelete *reply; char *localName; int error; HgfsHandle file = HGFS_INVALID_HANDLE; @@ -3702,10 +3719,8 @@ HgfsServerDeleteFile(char const *packetIn, // IN: incoming packet size_t cpNameSize; uint32 caseFlags; - request = (HgfsRequestDelete *)packetIn; - ASSERT(request); - reply = (HgfsReplyDelete *)packetOut; - ASSERT(reply); + ASSERT(packetIn); + ASSERT(packetOut); ASSERT(packetSize); if (!HgfsUnpackDeleteRequest(packetIn, @@ -3743,7 +3758,7 @@ HgfsServerDeleteFile(char const *packetIn, // IN: incoming packet ASSERT(localName); LOG(4, ("HgfsServerDeleteFile: unlinking \"%s\"\n", localName)); - error = unlink(localName); + error = Posix_Unlink(localName); free(localName); if (error) { error = errno; @@ -3781,8 +3796,6 @@ HgfsServerDeleteDir(char const *packetIn, // IN: incoming packet size_t *packetSize) // IN/OUT: size of packet { HgfsNameStatus nameStatus; - HgfsRequestDelete *request; - HgfsReplyDelete *reply; char *localName; int error; HgfsHandle file = HGFS_INVALID_HANDLE; @@ -3791,10 +3804,8 @@ HgfsServerDeleteDir(char const *packetIn, // IN: incoming packet size_t cpNameSize; uint32 caseFlags; - request = (HgfsRequestDelete *)packetIn; - ASSERT(request); - reply = (HgfsReplyDelete *)packetOut; - ASSERT(reply); + ASSERT(packetIn); + ASSERT(packetOut); ASSERT(packetSize); if (!HgfsUnpackDeleteRequest(packetIn, @@ -3838,7 +3849,7 @@ HgfsServerDeleteDir(char const *packetIn, // IN: incoming packet ASSERT(localName); LOG(4, ("HgfsServerDeleteDir: removing \"%s\"\n", localName)); - error = rmdir(localName); + error = Posix_Rmdir(localName); free(localName); if (error) { error = errno; @@ -4001,7 +4012,7 @@ HgfsServerRename(char const *packetIn, // IN: incoming packet LOG(4, ("HgfsServerRename: renaming \"%s\" to \"%s\"\n", localOldName, localNewName)); - error = rename(localOldName, localNewName); + error = Posix_Rename(localOldName, localNewName); if (error) { error = errno; LOG(4, ("HgfsServerRename: error: %s\n", strerror(error))); @@ -4086,25 +4097,29 @@ HgfsServerQueryVolume(char const *packetIn, // IN: incoming packet ASSERT(packetSize); if (header->op == HGFS_OP_QUERY_VOLUME_INFO_V3) { HgfsRequestQueryVolumeV3 *requestV3; + HgfsReplyQueryVolumeV3 *replyV3; - requestV3 = (HgfsRequestQueryVolumeV3 *)(packetIn + sizeof *header); - freeBytes = &((HgfsReplyQueryVolumeV3 *)(packetOut + sizeof(struct HgfsReply)))->freeBytes; - totalBytes = &((HgfsReplyQueryVolumeV3 *)(packetOut + sizeof(struct HgfsReply)))->totalBytes; + requestV3 = (HgfsRequestQueryVolumeV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); + replyV3 = (HgfsReplyQueryVolumeV3 *)HGFS_REP_GET_PAYLOAD_V3(packetOut); + + freeBytes = &replyV3->freeBytes; + totalBytes = &replyV3->totalBytes; /* Enforced by the dispatch function. */ - ASSERT(*packetSize >= sizeof *requestV3 + sizeof *header); - extra = *packetSize - sizeof *requestV3 - sizeof *header; + ASSERT(*packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); + extra = *packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); - caseFlags = requestV3->fileName.flags; + caseFlags = requestV3->fileName.caseType; fileName = requestV3->fileName.name; fileNameLength = requestV3->fileName.length; - *packetSize = sizeof(struct HgfsReplyQueryVolumeV3) + sizeof(struct HgfsReply); + *packetSize = HGFS_REP_PAYLOAD_SIZE_V3(replyV3); LOG(4, ("HgfsServerSearchOpen: HGFS_OP_SEARCH_OPEN_V3\n")); } else { - HgfsRequestQueryVolume *request; - request = (HgfsRequestQueryVolume *)packetIn; - freeBytes = &((HgfsReplyQueryVolume *)packetOut)->freeBytes; - totalBytes = &((HgfsReplyQueryVolume *)packetOut)->totalBytes; + HgfsRequestQueryVolume *request = (HgfsRequestQueryVolume *)packetIn; + HgfsReplyQueryVolume *reply = (HgfsReplyQueryVolume *)packetOut; + + freeBytes = &reply->freeBytes; + totalBytes = &reply->totalBytes; /* Enforced by the dispatch function. */ ASSERT(*packetSize >= sizeof *request); @@ -4112,7 +4127,7 @@ HgfsServerQueryVolume(char const *packetIn, // IN: incoming packet fileName = request->fileName.name; fileNameLength = request->fileName.length; - *packetSize = sizeof(struct HgfsReplyQueryVolume); + *packetSize = sizeof *reply; } /* @@ -4330,14 +4345,14 @@ HgfsServerSymlinkCreate(char const *packetIn, // IN: incoming packet if (header->op == HGFS_OP_CREATE_SYMLINK_V3) { HgfsRequestSymlinkCreateV3 *requestV3; HgfsFileNameV3 *targetNameP; - requestV3 = (HgfsRequestSymlinkCreateV3 *)(packetIn + sizeof *header); + requestV3 = (HgfsRequestSymlinkCreateV3 *)HGFS_REQ_GET_PAYLOAD_V3(packetIn); LOG(4, ("HgfsServerSymlinkCreate: HGFS_OP_CREATE_SYMLINK_V3\n")); /* Enforced by the dispatch function. */ - ASSERT(*packetSize >= sizeof *requestV3 + sizeof *header); - extra = *packetSize - sizeof *requestV3 - sizeof *header; + ASSERT(*packetSize >= HGFS_REQ_PAYLOAD_SIZE_V3(requestV3)); + extra = *packetSize - HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); - caseFlags = requestV3->symlinkName.flags; + caseFlags = requestV3->symlinkName.caseType; symlinkName = requestV3->symlinkName.name; symlinkNameLength = requestV3->symlinkName.length; @@ -4420,7 +4435,7 @@ HgfsServerSymlinkCreate(char const *packetIn, // IN: incoming packet localSymlinkName, localTargetName)); /* XXX: Should make use of targetNameP->flags? */ - error = symlink(localTargetName, localSymlinkName); + error = Posix_Symlink(localTargetName, localSymlinkName); free(localSymlinkName); if (error) { error = errno; diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/Makefile.in b/open-vm-tools/lib/hgfsServerManagerGuest/Makefile.in index 146910c82..b937c3592 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/Makefile.in +++ b/open-vm-tools/lib/hgfsServerManagerGuest/Makefile.in @@ -120,6 +120,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/hgfsServerPolicyGuest/Makefile.in b/open-vm-tools/lib/hgfsServerPolicyGuest/Makefile.in index 968c597d6..1a8c4e1f0 100644 --- a/open-vm-tools/lib/hgfsServerPolicyGuest/Makefile.in +++ b/open-vm-tools/lib/hgfsServerPolicyGuest/Makefile.in @@ -120,6 +120,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/impersonate/Makefile.in b/open-vm-tools/lib/impersonate/Makefile.in index a8669b337..47f6192c2 100644 --- a/open-vm-tools/lib/impersonate/Makefile.in +++ b/open-vm-tools/lib/impersonate/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/impersonate/impersonatePosix.c b/open-vm-tools/lib/impersonate/impersonatePosix.c index 23b4f81d4..726db671b 100644 --- a/open-vm-tools/lib/impersonate/impersonatePosix.c +++ b/open-vm-tools/lib/impersonate/impersonatePosix.c @@ -217,13 +217,13 @@ ImpersonateOwner(const char *file) // IN struct passwd *ppw = &pw; int error; - if (stat(file, &buf) == -1) { + if (Posix_Stat(file, &buf) == -1) { Warning("Failed to lookup owner for: %s. Reason: %s\n", file, strerror(errno)); return FALSE; } - if ((error = getpwuid_r(buf.st_uid, &pw, buffer, BUFSIZ, &ppw)) != 0 || !ppw) { + if ((error = Posix_Getpwuid_r(buf.st_uid, &pw, buffer, BUFSIZ, &ppw)) != 0 || !ppw) { if (error == 0) { error = ENOENT; } @@ -269,7 +269,7 @@ ImpersonateUndo(void) ASSERT(imp); //ASSERT(imp->impersonatedUser); - if ((error = getpwuid_r(0, &pw, buffer, BUFSIZ, &ppw)) != 0 || !ppw) { + if ((error = Posix_Getpwuid_r(0, &pw, buffer, BUFSIZ, &ppw)) != 0 || !ppw) { if (error == 0) { error = ENOENT; } @@ -304,9 +304,9 @@ ImpersonateUndo(void) } /* Restore root's environment */ - setenv("USER", ppw->pw_name, 1); - setenv("HOME", ppw->pw_dir, 1); - setenv("SHELL", ppw->pw_shell, 1); + Posix_Setenv("USER", ppw->pw_name, 1); + Posix_Setenv("HOME", ppw->pw_dir, 1); + Posix_Setenv("SHELL", ppw->pw_shell, 1); free((char *)imp->impersonatedUser); imp->impersonatedUser = NULL; @@ -386,9 +386,9 @@ ImpersonateDoPosix(struct passwd *pwd) // IN #endif /* Setup the user's environment */ - setenv("USER", pwd->pw_name, 1); - setenv("HOME", pwd->pw_dir, 1); - setenv("SHELL", pwd->pw_shell, 1); + Posix_Setenv("USER", pwd->pw_name, 1); + Posix_Setenv("HOME", pwd->pw_dir, 1); + Posix_Setenv("SHELL", pwd->pw_shell, 1); imp->impersonatedUser = strdup(pwd->pw_name); ASSERT_MEM_ALLOC(imp->impersonatedUser); diff --git a/open-vm-tools/lib/include/backdoor_def.h b/open-vm-tools/lib/include/backdoor_def.h index d9ea22676..cd28b8461 100644 --- a/open-vm-tools/lib/include/backdoor_def.h +++ b/open-vm-tools/lib/include/backdoor_def.h @@ -111,7 +111,8 @@ #define BDOOR_CMD_BIOSBBS 50 #define BDOOR_CMD_VASSERT 51 #define BDOOR_CMD_ISGOSDARWIN 52 -#define BDOOR_CMD_MAX 53 +#define BDOOR_CMD_DEBUGEVENT 53 +#define BDOOR_CMD_MAX 54 /* * IMPORTANT NOTE: When modifying the behavior of an existing backdoor command, diff --git a/open-vm-tools/lib/include/bsdfmt.h b/open-vm-tools/lib/include/bsdfmt.h index 5f2295b5f..68f8cf054 100644 --- a/open-vm-tools/lib/include/bsdfmt.h +++ b/open-vm-tools/lib/include/bsdfmt.h @@ -107,7 +107,7 @@ int BSDFmt_SPrint(BSDFmt_StrBuf *sbuf, BSDFmt_UIO *uio); * Conversion functions */ -char *BSDFmt_WCSConv(wchar_t *, int); +char *BSDFmt_WCharToUTF8(wchar_t *, int); char *BSDFmt_UJToA(uintmax_t, char *, int, int, const char *, int, char, const char *); diff --git a/open-vm-tools/lib/include/buildNumber.h b/open-vm-tools/lib/include/buildNumber.h index 6f1838f89..3b51f6378 100644 --- a/open-vm-tools/lib/include/buildNumber.h +++ b/open-vm-tools/lib/include/buildNumber.h @@ -1,12 +1,12 @@ #define BUILD_NUMBER \ - "build-87182" + "build-90473" #define BUILD_NUMBER_NUMERIC \ - 87182 + 90473 #define BUILD_NUMBER_NUMERIC_STRING \ - "87182" + "90473" #define PRODUCT_BUILD_NUMBER \ - "product-build-163" + "product-build-182" #define PRODUCT_BUILD_NUMBER_NUMERIC \ - 163 + 182 #define PRODUCT_BUILD_NUMBER_NUMERIC_STRING \ - "163" + "182" diff --git a/open-vm-tools/lib/include/codeset.h b/open-vm-tools/lib/include/codeset.h index a9107ec15..d6bd9e132 100644 --- a/open-vm-tools/lib/include/codeset.h +++ b/open-vm-tools/lib/include/codeset.h @@ -54,6 +54,18 @@ #include "vm_assert.h" #include "dynbuf.h" +# if defined(__FreeBSD__) || defined(VMX86_SERVER) || defined(__APPLE__) \ + || (defined(__linux__) && !defined(GLIBC_VERSION_21) \ + && !defined(GLIBC_VERSION_22) && !defined(GLIBC_VERSION_23)) +#define CURRENT_IS_UTF8 +#endif + +/* + * Guard these defines, borrowed from ICU's utf16.h, so that source files + * can include both. + */ + +#ifndef __UTF16_H__ /** * Is this code point a surrogate (U+d800..U+dfff)? @@ -222,68 +234,96 @@ } \ } +#endif // __UTF16_H__ + +#define CSGTG_NORMAL 0x0000 /* Without any information loss. */ +#define CSGTG_TRANSLIT 0x0001 /* Transliterate unknown characters. */ +#define CSGTG_IGNORE 0x0002 /* Skip over untranslatable characters. */ + +Bool +CodeSet_Init(void); + +void +CodeSet_DontUseIcu(void); + +Bool +CodeSet_GenericToGenericDb(const char *codeIn, // IN + const char *bufIn, // IN + size_t sizeIn, // IN + const char *codeOut, // IN + unsigned int flags, // IN + DynBuf *db); // IN/OUT Bool -CodeSet_Utf8ToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_GenericToGeneric(const char *codeIn, // IN + const char *bufIn, // IN + size_t sizeIn, // IN + const char *codeOut, // IN + unsigned int flags, // IN + char **bufOut, // IN/OUT + size_t *sizeOut); // IN/OUT Bool -CodeSet_Utf8ToCurrentTranslit(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_Utf8ToCurrent(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_CurrentToUtf8(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_CurrentToUtf8(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_Utf16leToUtf8_Db(char const *bufIn, // IN - size_t sizeIn, // IN +CodeSet_Utf16leToUtf8_Db(const char *bufIn, // IN + size_t sizeIn, // IN DynBuf *db); // IN Bool -CodeSet_Utf16leToUtf8(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_Utf16leToUtf8(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_Utf8ToUtf16le(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_Utf8ToUtf16le(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_CurrentToUtf16le(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_CurrentToUtf16le(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_Utf16leToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_Utf16leToCurrent(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_Utf16beToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut); // OUT +CodeSet_Utf16beToCurrent(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT Bool -CodeSet_Utf8FormDToUtf8FormC(char const *bufIn, // IN +CodeSetOld_Utf8Normalize(const char *bufIn, // IN + size_t sizeIn, // IN + Bool precomposed, // IN + DynBuf *db); // OUT + +Bool +CodeSet_Utf8FormDToUtf8FormC(const char *bufIn, // IN size_t sizeIn, // IN char **bufOut, // OUT size_t *sizeOut); // OUT Bool -CodeSet_Utf8FormCToUtf8FormD(char const *bufIn, // IN +CodeSet_Utf8FormCToUtf8FormD(const char *bufIn, // IN size_t sizeIn, // IN char **bufOut, // OUT size_t *sizeOut); // OUT @@ -291,6 +331,9 @@ CodeSet_Utf8FormCToUtf8FormD(char const *bufIn, // IN const char * CodeSet_GetCurrentCodeSet(void); +Bool +CodeSet_IsEncodingSupported(const char *name); + /* *----------------------------------------------------------------------------- diff --git a/open-vm-tools/lib/include/dictll.h b/open-vm-tools/lib/include/dictll.h index 136bc3b4c..f26027750 100644 --- a/open-vm-tools/lib/include/dictll.h +++ b/open-vm-tools/lib/include/dictll.h @@ -48,9 +48,13 @@ DictLL_UnmarshalLine(const char *buf, // IN char **value); // OUT Bool -DictLL_MarshalLine(DynBuf *output, // IN +DictLL_MarshalLine(DynBuf *output, // IN/OUT char const *name, // IN char const *value); // IN +Bool +DictLL_ReadUTF8BOM(FILE *file); // IN/OUT + + #endif /* __DICTLL_H__ */ diff --git a/open-vm-tools/lib/include/err.h b/open-vm-tools/lib/include/err.h index f16f2c038..0a9f6f020 100644 --- a/open-vm-tools/lib/include/err.h +++ b/open-vm-tools/lib/include/err.h @@ -44,10 +44,20 @@ extern "C" { typedef int Err_Number; #endif +#define ERR_INVALID ((Err_Number) -1) + const char *Err_ErrString(void); const char *Err_Errno2String(Err_Number errorNumber); +Err_Number Err_String2Errno(const char *string); + +#ifdef VMX86_DEBUG +Err_Number Err_String2ErrnoDebug(const char *string); +#endif + +char *Err_Errno2LocalString(Err_Number errorNumber); + /* *---------------------------------------------------------------------- diff --git a/open-vm-tools/lib/include/foundryThreads.h b/open-vm-tools/lib/include/foundryThreads.h index 7ad190cbd..0f1f3679a 100644 --- a/open-vm-tools/lib/include/foundryThreads.h +++ b/open-vm-tools/lib/include/foundryThreads.h @@ -51,7 +51,7 @@ Bool FoundryThreads_IsCurrentThread(struct FoundryWorkerThread *threadState); */ typedef struct FoundryWorkerThread { #if _WIN32 - DWORD threadId; + uintptr_t threadId; HANDLE threadHandle; #else pthread_t threadInfo; diff --git a/open-vm-tools/lib/include/guestApp.h b/open-vm-tools/lib/include/guestApp.h index a5b5ea86a..4142ec020 100644 --- a/open-vm-tools/lib/include/guestApp.h +++ b/open-vm-tools/lib/include/guestApp.h @@ -27,6 +27,10 @@ #ifndef __GUESTAPP_H__ # define __GUESTAPP_H__ +#if defined(_WIN32) +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -173,6 +177,22 @@ GuestApp_RpcSendOneCPName(char const *cmd, // IN: RPCI command Bool GuestApp_OpenUrl(const char *url, Bool maximize); +#if defined(_WIN32) +void GuestApp_SetDictEntryW(GuestApp_Dict *dict, + const WCHAR *name, + const WCHAR *value); + +void GuestApp_SetDictEntryDefaultW(GuestApp_Dict *dict, + const WCHAR *name, + const WCHAR *defaultVal); + +WCHAR *GuestApp_GetDictEntryW(GuestApp_Dict *dict, + const WCHAR *name); + +WCHAR *GuestApp_GetDictEntryDefaultW(GuestApp_Dict *dict, + const WCHAR *name); +#endif + #ifndef _WIN32 Bool GuestApp_FindProgram(const char *program); #endif diff --git a/open-vm-tools/lib/include/hgfsProto.h b/open-vm-tools/lib/include/hgfsProto.h index 861dd9192..367d99182 100644 --- a/open-vm-tools/lib/include/hgfsProto.h +++ b/open-vm-tools/lib/include/hgfsProto.h @@ -66,12 +66,12 @@ typedef enum { HGFS_OP_DELETE_DIR, /* Delete a directory */ HGFS_OP_RENAME, /* Rename a file or directory */ HGFS_OP_QUERY_VOLUME_INFO, /* Query volume information */ - + /* * The following operations are only available in version 2 of the hgfs - * protocol. The corresponding version 1 opcodes above are deprecated. + * protocol. The corresponding version 1 opcodes above are deprecated. */ - + HGFS_OP_OPEN_V2, /* Open file */ HGFS_OP_GETATTR_V2, /* Get file attributes */ HGFS_OP_SETATTR_V2, /* Set file attributes */ @@ -82,9 +82,9 @@ typedef enum { HGFS_OP_DELETE_FILE_V2, /* Delete a file */ HGFS_OP_DELETE_DIR_V2, /* Delete a directory */ HGFS_OP_RENAME_V2, /* Rename a file or directory */ - + /* - * Operations for version 3. + * Operations for version 3, deprecating version 2 operations. */ HGFS_OP_OPEN_V3, /* Open file */ @@ -175,10 +175,10 @@ typedef uint8 HgfsPermissions; * * The client can ask the server to acquire opportunistic locking/leasing * from the host FS on its behalf. This is communicated as part of an open request. - * + * * HGFS_LOCK_OPPORTUNISTIC means that the client trusts the server * to decide what kind of locking to request from the host FS. - * All other values tell the server explicitly the type of lock to + * All other values tell the server explicitly the type of lock to * request. * * The server will attempt to acquire the desired lock and will notify the client @@ -214,9 +214,9 @@ typedef uint8 HgfsAttrChanges; /* - * Hints to indicate in a getattr or setattr which attributes + * Hints to indicate in a getattr or setattr which attributes * are valid for the request. - * For setattr only, attributes should be set by host even if + * For setattr only, attributes should be set by host even if * no valid values are specified by the guest. */ @@ -227,7 +227,7 @@ typedef uint64 HgfsAttrHint; #define HGFS_ATTR_HINT_USE_FILE_DESC (1 << 2) /* - * Hint to determine using a name or a handle to determine + * Hint to determine using a name or a handle to determine * what to delete. */ @@ -236,7 +236,7 @@ typedef uint64 HgfsDeleteHint; #define HGFS_DELETE_HINT_USE_FILE_DESC (1 << 0) /* - * Hint to determine using a name or a handle to determine + * Hint to determine using a name or a handle to determine * what to renames. */ @@ -254,7 +254,7 @@ typedef uint64 HgfsRenameHint; * units of 100ns since Jan 1, 1601, UTC. */ -/* +/* * Version 1 attributes. Deprecated. * Version 2 should be using HgfsAttrV2. */ @@ -277,14 +277,14 @@ HgfsAttr; /* Various flags and Windows attributes. */ -typedef uint64 HgfsAttrFlags; +typedef uint64 HgfsAttrFlags; #define HGFS_ATTR_HIDDEN (1 << 0) #define HGFS_ATTR_SYSTEM (1 << 1) #define HGFS_ATTR_ARCHIVE (1 << 2) -/* +/* * Specifies which open request fields contain * valid values. */ @@ -293,7 +293,7 @@ typedef uint64 HgfsOpenValid; #define HGFS_OPEN_VALID_NONE 0 #define HGFS_OPEN_VALID_MODE (1 << 0) -#define HGFS_OPEN_VALID_FLAGS (1 << 1) +#define HGFS_OPEN_VALID_FLAGS (1 << 1) #define HGFS_OPEN_VALID_SPECIAL_PERMS (1 << 2) #define HGFS_OPEN_VALID_OWNER_PERMS (1 << 3) #define HGFS_OPEN_VALID_GROUP_PERMS (1 << 4) @@ -306,7 +306,7 @@ typedef uint64 HgfsOpenValid; #define HGFS_OPEN_VALID_FILE_NAME (1 << 11) -/* +/* * Specifies which attribute fields contain * valid values. */ @@ -326,12 +326,12 @@ typedef uint64 HgfsAttrValid; #define HGFS_ATTR_VALID_OTHER_PERMS (1 << 9) #define HGFS_ATTR_VALID_FLAGS (1 << 10) #define HGFS_ATTR_VALID_ALLOCATION_SIZE (1 << 11) -#define HGFS_ATTR_VALID_USERID (1 << 12) +#define HGFS_ATTR_VALID_USERID (1 << 12) #define HGFS_ATTR_VALID_GROUPID (1 << 13) #define HGFS_ATTR_VALID_FILEID (1 << 14) - -/* + +/* * Specifies which create dir request fields contain * valid values. */ @@ -345,12 +345,12 @@ typedef uint64 HgfsCreateDirValid; #define HGFS_CREATE_DIR_VALID_OTHER_PERMS (1 << 3) #define HGFS_CREATE_DIR_VALID_FILE_NAME (1 << 4) -/* +/* * Version 2 of HgfsAttr */ -typedef -#include "vmware_pack_begin.h" +typedef +#include "vmware_pack_begin.h" struct HgfsAttrV2 { HgfsAttrValid mask; /* A bit mask to determine valid attribute fields */ HgfsFileType type; /* File type */ @@ -360,12 +360,12 @@ struct HgfsAttrV2 { uint64 writeTime; /* Time of last write */ uint64 attrChangeTime; /* Time file attributes were last * changed. Ignored by Windows */ - HgfsPermissions specialPerms; /* Special permissions bits (suid, etc.). + HgfsPermissions specialPerms; /* Special permissions bits (suid, etc.). * Ignored by Windows */ HgfsPermissions ownerPerms; /* Owner permissions bits */ - HgfsPermissions groupPerms; /* Group permissions bits. Ignored by + HgfsPermissions groupPerms; /* Group permissions bits. Ignored by * Windows */ - HgfsPermissions otherPerms; /* Other permissions bits. Ignored by + HgfsPermissions otherPerms; /* Other permissions bits. Ignored by * Windows */ HgfsAttrFlags flags; /* Various flags and Windows 'attributes' */ uint64 allocationSize; /* Actual size of file on disk */ @@ -374,9 +374,9 @@ struct HgfsAttrV2 { uint64 hostFileId; /* File Id of the file on host: inode_t on Linux */ uint64 reserved1; /* Reserved for future use */ uint64 reserved2; /* Reserved for future use */ -} -#include "vmware_pack_end.h" -HgfsAttrV2; +} +#include "vmware_pack_end.h" +HgfsAttrV2; /* @@ -407,16 +407,16 @@ HgfsAttrV2; * SEARCH_OPEN. * * In the current HGFS server implementation, each request has a minimum packet - * size that must be met for it to be considered valid. This minimum is simply + * size that must be met for it to be considered valid. This minimum is simply * the sizeof the particular request, which includes the solitary byte from the * HgfsFileName struct. For these particular requests, clients add an extra * byte to their payload size, without that byte being present anywhere. * * It isn't clear that this behavior is correct, but the end result is that - * neither end malfunctions, as an extra byte gets sent by the client and is + * neither end malfunctions, as an extra byte gets sent by the client and is * ignored by the server. Unfortunately, it cannot be easily fixed. The * server's minimum packet size can be changed, but the client should continue - * to send an extra byte, otherwise older servers with a slightly longer + * to send an extra byte, otherwise older servers with a slightly longer * minimum packet size may consider the new client's packets to be too short. * * UTF-8 representation @@ -435,11 +435,11 @@ HgfsAttrV2; * * Precomposed (normal form C) versus Decomposed (normal form D) * ------------------------------------------------------------- - * Certain Unicode characters can be encoded in more than one way. + * Certain Unicode characters can be encoded in more than one way. * For example, an (A acute) can be encoded either precomposed, - * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, + * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, * as U+0041 U+0301 (LATIN CAPITAL LETTER A followed by a COMBINING ACUTE ACCENT). - * Precomposed characters are more common in the Windows world, + * Precomposed characters are more common in the Windows world, * whereas decomposed characters are more common on the Mac. * * See UAX 15 (http://unicode.org/reports/tr15/) @@ -456,15 +456,28 @@ HgfsFileName; /* - * HgfsFileNameV3 - new header to incorporate case-sensitivity flags along with + * Case-sensitiviy flags are only used when any lookup is + * involved on the server side. + */ + +typedef enum { + HGFS_FILE_NAME_DEFAULT_CASE, + HGFS_FILE_NAME_CASE_SENSITIVE, + HGFS_FILE_NAME_CASE_INSENSITIVE, +} HgfsCaseType; + + +/* + * HgfsFileNameV3 - new header to incorporate case-sensitivity flags along with * Hgfs file handle. - */ + */ typedef #include "vmware_pack_begin.h" struct HgfsFileNameV3 { - uint32 length; /* Does NOT include terminating NUL */ - uint32 flags; /* Flags describe below. */ + uint32 length; /* Does NOT include terminating NUL */ + uint32 flags; /* Flags described below. */ + HgfsCaseType caseType; /* Case-sensitivity type. */ HgfsHandle fid; char name[1]; } @@ -476,10 +489,7 @@ HgfsFileNameV3; * HgfsFileNameV3 flags. Case-sensitiviy flags are only used when any lookup is * involved on the server side. */ -#define HGFS_FILE_NAME_USE_FILE_DESC (1 << 0) /* Other flags ignored if set. */ -#define HGFS_FILE_NAME_CASE_SENSITIVE (1 << 1) -#define HGFS_FILE_NAME_CASE_INSENSITIVE (1 << 2) -#define HGFS_FILE_NAME_DEFAULT_CASE (1 << 3) /* Default host case. */ +#define HGFS_FILE_NAME_USE_FILE_DESC (1 << 0) /* Case type ignored if set. */ /* @@ -530,26 +540,26 @@ HgfsRequestOpen; typedef #include "vmware_pack_begin.h" -struct HgfsRequestOpenV2 { - HgfsRequest header; +struct HgfsRequestOpenV2 { + HgfsRequest header; HgfsOpenValid mask; /* Bitmask that specified which fields are valid. */ - HgfsOpenMode mode; /* Which type of access requested. See desiredAccess */ - HgfsOpenFlags flags; /* Which flags to open the file with */ - HgfsPermissions specialPerms; /* Desired 'special' permissions for file creation */ - HgfsPermissions ownerPerms; /* Desired 'owner' permissions for file creation */ - HgfsPermissions groupPerms; /* Desired 'group' permissions for file creation */ - HgfsPermissions otherPerms; /* Desired 'other' permissions for file creation */ - HgfsAttrFlags attr; /* Attributes, if any, for file creation */ - uint64 allocationSize; /* How much space to pre-allocate during creation */ - uint32 desiredAccess; /* Extended support for windows access modes */ + HgfsOpenMode mode; /* Which type of access requested. See desiredAccess */ + HgfsOpenFlags flags; /* Which flags to open the file with */ + HgfsPermissions specialPerms; /* Desired 'special' permissions for file creation */ + HgfsPermissions ownerPerms; /* Desired 'owner' permissions for file creation */ + HgfsPermissions groupPerms; /* Desired 'group' permissions for file creation */ + HgfsPermissions otherPerms; /* Desired 'other' permissions for file creation */ + HgfsAttrFlags attr; /* Attributes, if any, for file creation */ + uint64 allocationSize; /* How much space to pre-allocate during creation */ + uint32 desiredAccess; /* Extended support for windows access modes */ uint32 shareAccess; /* Windows only, share access modes */ HgfsServerLock desiredLock; /* The type of lock desired by the client */ uint64 reserved1; /* Reserved for future use */ uint64 reserved2; /* Reserved for future use */ - HgfsFileName fileName; -} -#include "vmware_pack_end.h" -HgfsRequestOpenV2; + HgfsFileName fileName; +} +#include "vmware_pack_end.h" +HgfsRequestOpenV2; /* Version 3 of HgfsRequestOpen */ @@ -860,16 +870,16 @@ typedef struct HgfsReplySearchReadV2 { HgfsReply header; HgfsAttrV2 attr; - - /* - * fileName.length = 0 means "no entry at this offset" + + /* + * fileName.length = 0 means "no entry at this offset" * If the file is a symlink (as specified in attr) * this name is the name of the symlink, not the target. - */ - HgfsFileName fileName; -} -#include "vmware_pack_end.h" -HgfsReplySearchReadV2; + */ + HgfsFileName fileName; +} +#include "vmware_pack_end.h" +HgfsReplySearchReadV2; /* Directory entry structure. */ @@ -877,13 +887,13 @@ HgfsReplySearchReadV2; typedef struct HgfsDirEntry { uint32 nextEntry; HgfsAttrV2 attr; - - /* - * fileName.length = 0 means "no entry at this offset" + + /* + * fileName.length = 0 means "no entry at this offset" * If the file is a symlink (as specified in attr) * this name is the name of the symlink, not the target. - */ - HgfsFileNameV3 fileName; + */ + HgfsFileNameV3 fileName; } HgfsDirEntry; typedef @@ -892,8 +902,8 @@ struct HgfsReplySearchReadV3 { uint64 count; /* Number of directory entries. */ uint64 reserved; /* Reserved for future use. */ char payload[1]; /* Directory entries. */ -} -#include "vmware_pack_end.h" +} +#include "vmware_pack_end.h" HgfsReplySearchReadV3; @@ -996,10 +1006,10 @@ typedef struct HgfsReplyGetattrV2 { HgfsReply header; HgfsAttrV2 attr; - + /* - * If the file is a symlink, as specified in attr.type, then this is - * the target for the symlink. If the file is not a symlink, this should + * If the file is a symlink, as specified in attr.type, then this is + * the target for the symlink. If the file is not a symlink, this should * be ignored. * * This filename is in "CPNameLite" format. See CPNameLite.c for details. @@ -1014,10 +1024,10 @@ typedef #include "vmware_pack_begin.h" struct HgfsReplyGetattrV3 { HgfsAttrV2 attr; - + /* - * If the file is a symlink, as specified in attr.type, then this is - * the target for the symlink. If the file is not a symlink, this should + * If the file is a symlink, as specified in attr.type, then this is + * the target for the symlink. If the file is not a symlink, this should * be ignored. * * This filename is in "CPNameLite" format. See CPNameLite.c for details. @@ -1192,7 +1202,7 @@ struct HgfsRequestDelete { HgfsRequestDelete; -/* Version 2 of HgfsReplyCreateDir */ +/* Version 2 of HgfsRequestDelete */ typedef #include "vmware_pack_begin.h" @@ -1206,7 +1216,7 @@ struct HgfsRequestDeleteV2 { HgfsRequestDeleteV2; -/* Version 3 of HgfsReplyCreateDir */ +/* Version 3 of HgfsRequestDelete */ typedef #include "vmware_pack_begin.h" @@ -1420,7 +1430,7 @@ struct HgfsReplySymlinkCreate { HgfsReplySymlinkCreate; -/* HgfsRequestServerLockChange and HgfsReplyServerLockChange for v3. */ +/* HgfsRequestSymlinkCreate and HgfsReplySymlinkCreate for v3. */ typedef #include "vmware_pack_begin.h" diff --git a/open-vm-tools/lib/include/hgfsServerInt.h b/open-vm-tools/lib/include/hgfsServerInt.h index ea0e54351..24f70ce7a 100644 --- a/open-vm-tools/lib/include/hgfsServerInt.h +++ b/open-vm-tools/lib/include/hgfsServerInt.h @@ -181,14 +181,14 @@ typedef struct HgfsFileNode { } HgfsFileNode; -/* HGFSFileNode flags. */ +/* HgfsFileNode flags. */ /* TRUE if opened in append mode */ -#define FILE_NODE_APPEND_FL (1 << 0) +#define HGFS_FILE_NODE_APPEND_FL (1 << 0) /* Whether this file was opened in sequential mode. */ -#define FILE_NODE_SEQUENTIAL_FL (1 << 1) +#define HGFS_FILE_NODE_SEQUENTIAL_FL (1 << 1) /* Whether this a shared folder open. */ -#define FILE_NODE_SHARED_FOLDER_OPEN_FL (1 << 2) +#define HGFS_FILE_NODE_SHARED_FOLDER_OPEN_FL (1 << 2) /* * This struct represents a file search that a client initiated. @@ -339,7 +339,7 @@ HgfsServerGetAccess(char *in, // IN: CP filename to check uint32 caseFlags, // IN: Case-sensitivity flags char **bufOut, // OUT: File name in local fs size_t *outLen, // OUT: Length of name out - HgfsSharedFolder **share); // OUT: Length of name out + HgfsSharedFolder **share); // OUT: Shared Folder Bool HgfsServerIsSharedFolderOnly(char const *in, // IN: CP filename to check diff --git a/open-vm-tools/lib/include/hgfsUtil.h b/open-vm-tools/lib/include/hgfsUtil.h index 0d61eaed4..4747844ab 100644 --- a/open-vm-tools/lib/include/hgfsUtil.h +++ b/open-vm-tools/lib/include/hgfsUtil.h @@ -91,6 +91,14 @@ struct timespec { #define HGFS_NAME_BUFFER_SIZE(request) (HGFS_PACKET_MAX - (sizeof *request - 1)) #define HGFS_NAME_BUFFER_SIZET(sizet) (HGFS_PACKET_MAX - (sizet) - 1) +/* XXX: Needs change when VMCI is supported. */ +#define HGFS_REQ_PAYLOAD_SIZE_V3(hgfsReq) (sizeof *hgfsReq + sizeof(HgfsRequest)) +#define HGFS_REP_PAYLOAD_SIZE_V3(hgfsRep) (sizeof *hgfsRep + sizeof(HgfsReply)) + +/* XXX: Needs change when VMCI is supported. */ +#define HGFS_REQ_GET_PAYLOAD_V3(hgfsReq) ((char *)(hgfsReq) + sizeof(HgfsRequest)) +#define HGFS_REP_GET_PAYLOAD_V3(hgfsRep) ((char *)(hgfsRep) + sizeof(HgfsReply)) + #ifndef _WIN32 /* * Routines for converting between Win NT and unix time formats. The diff --git a/open-vm-tools/lib/include/loglevel_user.h b/open-vm-tools/lib/include/loglevel_user.h index e40d1e873..280e0bfa4 100644 --- a/open-vm-tools/lib/include/loglevel_user.h +++ b/open-vm-tools/lib/include/loglevel_user.h @@ -90,8 +90,8 @@ LOGLEVEL_VAR(aioWin32), \ LOGLEVEL_VAR(aioWin32Completion), \ LOGLEVEL_VAR(aioLinux), \ - LOGLEVEL_VAR(aioGeneric), \ LOGLEVEL_VAR(aioHttp), \ + LOGLEVEL_VAR(aioGeneric), \ LOGLEVEL_VAR(cdrom), \ LOGLEVEL_VAR(checksum), \ \ @@ -184,8 +184,10 @@ LOGLEVEL_VAR(cptOps), \ LOGLEVEL_VAR(VProbeExec), \ LOGLEVEL_VAR(VProbeVP), \ + LOGLEVEL_VAR(device), \ LOGLEVEL_VAR(devicePowerOn), \ LOGLEVEL_VAR(vmxvmdbCallbacks), \ + LOGLEVEL_VAR(guestInstall), \ LOGLEVEL_EXTENSION_DECLARE(LOGLEVEL_USER); diff --git a/open-vm-tools/lib/include/mntinfo.h b/open-vm-tools/lib/include/mntinfo.h index 9611f1a69..56a13f0c1 100644 --- a/open-vm-tools/lib/include/mntinfo.h +++ b/open-vm-tools/lib/include/mntinfo.h @@ -37,6 +37,7 @@ #elif defined(__FreeBSD__) # include #endif +#include "posix.h" /* *---------------------------------------------------------------------------- @@ -86,8 +87,8 @@ # define MNTINFO struct mnttab # define DECLARE_MNTINFO(name) struct mnttab __ ## name; \ struct mnttab *name = &__ ## name -# define OPEN_MNTFILE(mode) fopen(MNTFILE, mode) -# define GETNEXT_MNTINFO(fp, mnt) (getmntent(fp, mnt) == 0) +# define OPEN_MNTFILE(mode) Posix_Fopen(MNTFILE, mode) +# define GETNEXT_MNTINFO(fp, mnt) (Posix_Getmntent(fp, mnt) == 0) # define CLOSE_MNTFILE(fp) (fclose(fp) == 0) # define MNTINFO_NAME(mnt) mnt->mnt_special # define MNTINFO_FSTYPE(mnt) mnt->mnt_fstype @@ -98,8 +99,8 @@ # define MNTHANDLE FILE * # define MNTINFO struct mntent # define DECLARE_MNTINFO(name) struct mntent *name -# define OPEN_MNTFILE(mode) setmntent(MNTFILE, mode) -# define GETNEXT_MNTINFO(fp, mnt) ((mnt = getmntent(fp)) != NULL) +# define OPEN_MNTFILE(mode) Posix_Setmntent(MNTFILE, mode) +# define GETNEXT_MNTINFO(fp, mnt) ((mnt = Posix_Getmntent(fp)) != NULL) # define CLOSE_MNTFILE(fp) (endmntent(fp) == 1) # define MNTINFO_NAME(mnt) mnt->mnt_fsname # define MNTINFO_FSTYPE(mnt) mnt->mnt_type diff --git a/open-vm-tools/lib/include/msg.h b/open-vm-tools/lib/include/msg.h index 724fc841f..3733ba54e 100644 --- a/open-vm-tools/lib/include/msg.h +++ b/open-vm-tools/lib/include/msg.h @@ -59,6 +59,9 @@ #define MSGID(id) MSG_MAGIC "(msg." #id ")" #define BUTTONID(id) MSG_MAGIC "(button." #id ")" +// the X hides MSG_MAGIC so it won't appear in the object file +#define MSG_MAGICAL(s) (strncmp(s, MSG_MAGIC"X", MSG_MAGIC_LEN) == 0) + #define INVALID_MSG_CODE (-1) /* @@ -269,7 +272,7 @@ EXTERN void MsgSetPostStderrBlock(Bool block); // XXX don't know -- edward static INLINE const char * Msg_StripMSGID(const char *idString) // IN { - if (idString && strncmp(idString, MSG_MAGIC"X", MSG_MAGIC_LEN) == 0) { + if (idString && MSG_MAGICAL(idString)) { const char *strp; /* diff --git a/open-vm-tools/lib/include/msgfmt.h b/open-vm-tools/lib/include/msgfmt.h index 004d00d33..87db51319 100644 --- a/open-vm-tools/lib/include/msgfmt.h +++ b/open-vm-tools/lib/include/msgfmt.h @@ -66,6 +66,13 @@ MsgFmt_SpecFunc(void *clientData, // IN /* * A format argument + * + * In addition to being a internal data structure, + * MsgFmt_Arg defines the Vob (vmkernel observations) protocol + * between vmkernel and vmx. As such, it must be carefully aligned, + * so that all the fields (except the pointers) have fixed sizes + * and the same offsets in the 64-bit vmkernel, the 32-bit vmx, + * and the 64-bit vmx. */ typedef enum MsgFmt_ArgType { @@ -78,11 +85,19 @@ typedef enum MsgFmt_ArgType { MSGFMT_ARG_STRING8, MSGFMT_ARG_STRING16, MSGFMT_ARG_STRING32, + MSGFMT_ARG_ERRNO, } MsgFmt_ArgType; +typedef enum MsgFmt_ArgPlatform { + MSGFMT_PLATFORM_UNKNOWN, + MSGFMT_PLATFORM_LINUX, + MSGFMT_PLATFORM_WINDOWS, + MSGFMT_PLATFORM_MACOS, +} MsgFmt_ArgPlatform; + typedef struct MsgFmt_Arg { - MsgFmt_ArgType type; - int precision; // private + int32 type; + int32 pad; union { int32 signed32; int64 signed64; @@ -96,8 +111,27 @@ typedef struct MsgFmt_Arg { void *ptr; // private } v; + struct { + int32 platform; + int32 number; + } e; + union { // private + int32 precision; + char *localString; + uint64 pad; + } p; } MsgFmt_Arg; +#if defined __linux__ +#define MSGFMT_CURRENT_PLATFORM MSGFMT_PLATFORM_LINUX +#elif defined _WIN32 +#define MSGFMT_CURRENT_PLATFORM MSGFMT_PLATFORM_WINDOWS +#elif defined __APPLE__ +#define MSGFMT_CURRENT_PLATFORM MSGFMT_PLATFORM_MACOS +#else +#define MSGFMT_CURRENT_PLATFORM MSGFMT_PLATFORM_UNKNOWN +#endif + /* * Global functions diff --git a/open-vm-tools/lib/include/posix.h b/open-vm-tools/lib/include/posix.h index 41112f114..c4bb8f517 100644 --- a/open-vm-tools/lib/include/posix.h +++ b/open-vm-tools/lib/include/posix.h @@ -34,6 +34,7 @@ #include "vm_basic_types.h" #include "unicodeTypes.h" +#include "codeset.h" /* * Force all users of these wrappers to use the LFS (large file) interface @@ -56,7 +57,11 @@ struct statfs; struct utimbuf; struct timeval; struct passwd; +#if !defined(sun) struct mntent; +#else +struct mnttab; +#endif #endif @@ -70,10 +75,15 @@ int Posix_Unlink(ConstUnicode pathName); FILE *Posix_Freopen(ConstUnicode pathName, const char *mode, FILE *stream); int Posix_Access(ConstUnicode pathName, int mode); int Posix_Stat(ConstUnicode pathName, struct stat *statbuf); -int Posix_Mkdir(ConstUnicode pathName, mode_t mode); -int Posix_Chdir(ConstUnicode pathName); int Posix_Chmod(ConstUnicode pathName, mode_t mode); +void Posix_Perror(ConstUnicode str); +#if !defined(N_PLAT_NLM) +int Posix_Mkdir(ConstUnicode pathName, mode_t mode); +int Posix_Chdir(ConstUnicode pathName); +Unicode Posix_Getenv(ConstUnicode name); +long Posix_Pathconf(ConstUnicode pathName, int name); +#endif #if !defined(_WIN32) void *Posix_Dlopen(ConstUnicode pathName, int flags); @@ -90,13 +100,15 @@ int Posix_Mkfifo(ConstUnicode pathName, mode_t mode); int Posix_Truncate(ConstUnicode pathName, off_t length); int Posix_Utimes(ConstUnicode pathName, const struct timeval *time); int Posix_Execl(ConstUnicode pathName, ConstUnicode arg0, ...); +int Posix_Execlp(ConstUnicode fileName, ConstUnicode arg0, ...); int Posix_Execv(ConstUnicode pathName, Unicode const argVal[]); +int Posix_Execve(ConstUnicode pathName, Unicode const argVal[], + Unicode const envPtr[]); int Posix_Execvp(ConstUnicode fileName, Unicode const argVal[]); int Posix_Lstat(ConstUnicode pathName, struct stat *statbuf); DIR *Posix_OpenDir(ConstUnicode pathName); -Unicode Posix_Getenv(ConstUnicode name); -int Posix_Setenv(ConstUnicode name, ConstUnicode value, int overWrite); - +int Posix_System(ConstUnicode command); +int Posix_Putenv(Unicode name); /* * These functions return dynamically allocated stings that have to be @@ -106,44 +118,51 @@ int Posix_Setenv(ConstUnicode name, ConstUnicode value, int overWrite); Unicode Posix_RealPath(ConstUnicode pathName); Unicode Posix_ReadLink(ConstUnicode pathName); +struct passwd *Posix_Getpwnam(ConstUnicode name); +struct passwd *Posix_Getpwuid(uid_t uid); + #if !defined(sun) int Posix_Statfs(ConstUnicode pathName, struct statfs *statfsbuf); +int Posix_Setenv(ConstUnicode name, ConstUnicode value, int overWrite); #if !defined(__FreeBSD__) -/* - * These functions have Unicode strings embedded in their return values - * so they must be used in the ESX environment. - */ -struct passwd *Posix_Getpwnam(ConstUnicode name); int Posix_Getpwnam_r(ConstUnicode name, struct passwd *pw, char *buf, size_t size, struct passwd **ppw); -struct passwd *Posix_Getpwuid(uid_t uid); int Posix_Getpwuid_r(uid_t uid, struct passwd *pw, char *buf, size_t size, struct passwd **ppw); - +struct passwd *Posix_Getpwent(void); +int Posix_GetGroupList(ConstUnicode user, gid_t group, gid_t *groups, + int *ngroups); +struct group *Posix_Getgrnam(ConstUnicode name); +int Posix_Getgrnam_r(ConstUnicode name, struct group *gr, + char *buf, size_t size, struct group **pgr); #if !defined(__APPLE__) +int Posix_Mount(ConstUnicode source, ConstUnicode target, + const char *filesystemtype, unsigned long mountflags, + const void *data); +int Posix_Umount(ConstUnicode target); FILE *Posix_Setmntent(ConstUnicode pathName, const char *mode); -/* - * These functions have Unicode strings embedded in their return values - * so they must be used in the ESX environment. - */ struct mntent *Posix_Getmntent(FILE *fp); struct mntent *Posix_Getmntent_r(FILE *fp, struct mntent *m, char *buf, int size); + #endif // !defined(__APPLE__) #endif // !defined(__FreeBSD__) +#else // !defined(sun) +int Posix_Getmntent(FILE *fp, struct mnttab *mp); + #endif // !defined(sun) #endif // !defined(N_PLAT_NLM) #endif // !define(_WIN32) - -#if defined(VMX86_SERVER) && !defined(UNICODE_BUILDING_POSIX_WRAPPERS) +#if defined(CURRENT_IS_UTF8) && \ + !defined(UNICODE_BUILDING_POSIX_WRAPPERS) /* - * ESX is a UTF-8 environment so these functions can be "defined away" - - * the POSIX wrapper call can be directly mapped to the POSIX function - * avoiding unneccesary (call and handling) overhead. + * ESX and MacOS X are UTF-8 environments so these functions can be + * "defined away" - the POSIX wrapper call can be directly mapped to the + * POSIX function avoiding unneccesary (call and handling) overhead. * * NOTE: PLEASE KEEP THESE IN SORTED ORDER */ @@ -154,20 +173,35 @@ struct mntent *Posix_Getmntent_r(FILE *fp, struct mntent *m, #define Posix_Creat creat #define Posix_Dlopen dlopen #define Posix_Execl execl +#define Posix_Execlp execlp #define Posix_Execv execv +#define Posix_Execve execve #define Posix_Execvp execvp #define Posix_Fopen fopen #define Posix_Freopen freopen #define Posix_Getenv getenv +#define Posix_GetGroupList getgrouplist +#define Posix_Getmntent getmntent +#define Posix_Getmntent_r getmntent_r +#define Posix_Getpwnam getpwnam +#define Posix_Getpwnam_r getpwnam_r +#define Posix_Getpwuid getpwuid +#define Posix_Getpwuid_r getpwuid_r +#define Posix_Getgrnam getgrnam +#define Posix_Getgrnam_r getgrnam_r #define Posix_Lchown lchown #define Posix_Link link #define Posix_Lstat lstat #define Posix_Mkdir mkdir #define Posix_Mkfifo mkfifo #define Posix_Mknod mknod +#define Posix_Mount mount #define Posix_Open open #define Posix_OpenDir opendir +#define Posix_Pathconf pathconf +#define Posix_Perror perror #define Posix_Popen popen +#define Posix_Putenv putenv #define Posix_Rename rename #define Posix_Rmdir rmdir #define Posix_Setenv setenv @@ -175,7 +209,9 @@ struct mntent *Posix_Getmntent_r(FILE *fp, struct mntent *m, #define Posix_Stat stat #define Posix_Statfs statfs #define Posix_Symlink symlink +#define Posix_System system #define Posix_Truncate truncate +#define Posix_Umount umount #define Posix_Unlink unlink #define Posix_Utime utime #define Posix_Utimes utimes diff --git a/open-vm-tools/lib/include/str.h b/open-vm-tools/lib/include/str.h index aaba7c491..42c7c1659 100644 --- a/open-vm-tools/lib/include/str.h +++ b/open-vm-tools/lib/include/str.h @@ -67,6 +67,9 @@ * * NOTE: Str_Asprintf/Str_Vasprintf return NULL on failure, while * Str_SafeAsprintf/Str_SafeVasprintf ASSERT_NOT_IMPLEMENTED. + * + * NOTE: "%s" refers to strings of "char" units, while "%S" refers to + * strings of "wchar_t" units, regardless of platform. */ EXTERN int Str_Sprintf(char *buf, size_t max, @@ -99,6 +102,9 @@ EXTERN char *Str_SafeVasprintf(size_t *length, const char *format, * * NOTE: Str_Aswprintf/Str_Vaswprintf return NULL on failure, while * Str_SafeAswprintf/Str_SafeVaswprintf ASSERT_NOT_IMPLEMENTED. + * + * NOTE: "%s" refers to strings of "char" units, while "%S" refers to + * strings of "wchar_t" units, regardless of platform. */ EXTERN int Str_Swprintf(wchar_t *buf, size_t max, @@ -163,11 +169,16 @@ unsigned char *Str_Mbscat(char *buf, const char *src, #define Str_Strspn(s1, s2) strspn(s1, s2) #define Str_Strcspn(s1, s2) strcspn(s1, s2) -#ifdef _WIN32 +#if defined(_WIN32) #define Str_Strcasecmp(s1, s2) _stricmp(s1, s2) #define Str_Strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) #define Str_ToUpper(s) _strupr(s) - #define Str_ToLower(s) _strlwr(s) + #define Str_ToLower(s) _strlwr(s) +#elif defined(N_PLAT_NLM) + #define Str_Strcasecmp(s1, s2) stricmp(s1, s2) + #define Str_Strncasecmp(s1, s2, n) strnicmp(s1, s2, n) + char *Str_ToUpper(char *string); + char *Str_ToLower(char *string); #else #define Str_Strcasecmp(s1, s2) strcasecmp(s1, s2) #define Str_Strncasecmp(s1, s2, n) strncasecmp(s1, s2, n) diff --git a/open-vm-tools/lib/include/syncMutex.h b/open-vm-tools/lib/include/syncMutex.h index 98966c222..d4e7f9a01 100644 --- a/open-vm-tools/lib/include/syncMutex.h +++ b/open-vm-tools/lib/include/syncMutex.h @@ -47,8 +47,6 @@ * SyncMutex -- */ -#define MUTEX_MAX_PATH WAITQ_MAX_PATH - typedef struct SyncMutex { #if defined(N_PLAT_NLM) LONG semaphoreHandle; diff --git a/open-vm-tools/lib/include/syncWaitQ.h b/open-vm-tools/lib/include/syncWaitQ.h index cb4d8fc3c..3923949c7 100644 --- a/open-vm-tools/lib/include/syncWaitQ.h +++ b/open-vm-tools/lib/include/syncWaitQ.h @@ -69,8 +69,6 @@ */ -#define WAITQ_MAX_PATH 0x100 - typedef struct SyncWaitQ { /* * Common members used for both named and unnamed objects @@ -88,7 +86,7 @@ typedef struct SyncWaitQ { */ // Name of the waitqueue object (FIFO path on Linux or Event name on Win32) - char path[WAITQ_MAX_PATH]; + char *pathName; /* * The following handles are only used only in the case of diff --git a/open-vm-tools/lib/include/unicodeBase.h b/open-vm-tools/lib/include/unicodeBase.h index 10eb1957b..1feda6cb8 100644 --- a/open-vm-tools/lib/include/unicodeBase.h +++ b/open-vm-tools/lib/include/unicodeBase.h @@ -180,6 +180,9 @@ void Unicode_Free(Unicode str); Unicode *Unicode_AllocList(char **srcList, ssize_t length, StringEncoding encoding); +Unicode *Unicode_GetAllocList(Unicode const srcList[], ssize_t length, + StringEncoding encoding); + /* *----------------------------------------------------------------------------- * @@ -311,53 +314,8 @@ Bool Unicode_CopyBytes(void *destBuffer, size_t *retLength, StringEncoding encoding); - -/* - *----------------------------------------------------------------------------- - * - * Unicode_GetAllocBytes -- - * - * Allocates and returns a NUL terminated buffer into which the contents - * of the unicode string are extracted using the specified encoding. - * - * NOTE: The length of the NUL can depend on the encoding. - * UTF-16 NUL is "\0\0"; UTF-32 NUL is "\0\0\0\0". - * - * NULL is returned for NULL argument. - * - * Results: - * Pointer to the dynamically allocated memory, - * or NULL on NULL argument. - * The caller is responsible to free the memory allocated - * by this routine. - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ - -static INLINE void * -Unicode_GetAllocBytes(ConstUnicode str, // IN: - StringEncoding encoding) // IN: -{ - void *memory; - Bool success; - size_t length; - - if (str == NULL) { - return NULL; - } - - length = Unicode_BytesRequired(str, encoding); - - memory = Util_SafeMalloc(length); - - success = Unicode_CopyBytes(memory, str, length, NULL, encoding); - ASSERT(success); - - return memory; -} +void *Unicode_GetAllocBytes(ConstUnicode str, + StringEncoding encoding); /* diff --git a/open-vm-tools/lib/include/unicodeICU.h b/open-vm-tools/lib/include/unicodeICU.h new file mode 100644 index 000000000..c61dcf9fb --- /dev/null +++ b/open-vm-tools/lib/include/unicodeICU.h @@ -0,0 +1,99 @@ +/********************************************************* + * Copyright (C) 2008 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 + * by the Free Software Foundation version 2.1 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + *********************************************************/ + +/* + * unicodeICU.h -- + * + * Unicode operations that depend on the third-party ICU support + * library. + */ + +#ifndef _UNICODE_ICU_H_ +#define _UNICODE_ICU_H_ + +#define INCLUDE_ALLOW_USERLEVEL + +#ifndef USE_ICU +#error These interfaces require the ICU library (define USE_ICU). +#endif + +#include "includeCheck.h" + +#include "unicodeBase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + UNICODE_COMPARE_DEFAULT = 0, + UNICODE_COMPARE_IGNORE_ACCENTS, + UNICODE_COMPARE_IGNORE_CASE, + UNICODE_COMPARE_IGNORE_PUNCTUATION +} UnicodeCompareOption; + + +/* + * Different languages and cultures have unique rules for how strings + * are compared and sorted. For example: + * + * Swedish: z < "o with umlaut" + * German: "o with umlaut" < z + * + * When producing a result visible to the user (like a sorted list of + * virtual machine names) string comparsion must obey the rules set by + * the user's language and culture, collectively called the "locale". + */ + +int Unicode_CompareWithLocale(ConstUnicode str1, + ConstUnicode str2, + const char *locale, + UnicodeCompareOption compareOption); + +/* + * Transforms the case of the string using the given locale's rules. + * + * Pass in a NULL locale to use the process's default locale. + * + * Changing the case of a string can change its length, so don't + * assume the string is the same length after calling these functions. + */ +Unicode Unicode_ToLower(ConstUnicode str, const char *locale); +Unicode Unicode_ToUpper(ConstUnicode str, const char *locale); + +#ifdef HAVE_ICU_38 +Unicode Unicode_ToTitle(ConstUnicode str, const char *locale); +#endif + +typedef enum { + UNICODE_NORMAL_FORM_C, // "e with acute accent" -> U+00E9 + UNICODE_NORMAL_FORM_D // "e with acute accent" -> U+0065 U+0302 +} UnicodeNormalizationForm; + +/* + * Normalizes Unicode characters composed of multiple parts into a + * standard form. + */ +Unicode Unicode_Normalize(ConstUnicode str, + UnicodeNormalizationForm form); + +#ifdef __cplusplus +} +#endif + +#endif // _UNICODE_ICU_H_ diff --git a/open-vm-tools/lib/include/unicodeInt.h b/open-vm-tools/lib/include/unicodeInt.h index 0a00a3a82..38a0231b1 100644 --- a/open-vm-tools/lib/include/unicodeInt.h +++ b/open-vm-tools/lib/include/unicodeInt.h @@ -43,6 +43,14 @@ void UnicodePinIndices(ConstUnicode str, UnicodeIndex *strLength); utf16_t UnicodeSimpleCaseFold(utf16_t codeUnit); +void *UnicodeGetAllocBytesInternal(ConstUnicode src, + StringEncoding encoding, + size_t *retLength); + +Bool UnicodeSanityCheck(const void *buffer, + ssize_t lengthInBytes, + StringEncoding encoding); + #ifdef __cplusplus } #endif diff --git a/open-vm-tools/lib/include/unicodeTypes.h b/open-vm-tools/lib/include/unicodeTypes.h index e47faef80..e2801f978 100644 --- a/open-vm-tools/lib/include/unicodeTypes.h +++ b/open-vm-tools/lib/include/unicodeTypes.h @@ -166,9 +166,49 @@ typedef enum { STRING_ENCODING_UNKNOWN = -2, } StringEncoding; + +#ifdef __cplusplus +extern "C" { +#endif + const char *Unicode_EncodingEnumToName(StringEncoding encoding); StringEncoding Unicode_EncodingNameToEnum(const char *encodingName); StringEncoding Unicode_GetCurrentEncoding(void); Bool Unicode_IsEncodingSupported(StringEncoding encoding); +Bool Unicode_IsEncodingValid(StringEncoding encoding); +void Unicode_Init(int argc, char ***argv, char ***envp); +#if defined (_WIN32) +void Unicode_InitW(int argc, utf16_t **wargv, utf16_t **wenvp, + char ***argv, char ***envp); +#endif + +/* + *----------------------------------------------------------------------------- + * + * Unicode_ResolveEncoding -- + * + * Resolves a meta-encoding enum value (e.g. STRING_ENCODING_DEFAULT) to + * a concrete one (e.g. STRING_ENCODING_UTF8). + * + * Results: + * A StringEncoding enum value. May return STRING_ENCODING_UNKNOWN. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static INLINE StringEncoding +Unicode_ResolveEncoding(StringEncoding encoding) // IN +{ + return (encoding == STRING_ENCODING_DEFAULT) + ? Unicode_GetCurrentEncoding() + : encoding; +} + +#ifdef __cplusplus +} +#endif #endif // _UNICODE_TYPES_H_ diff --git a/open-vm-tools/lib/include/util.h b/open-vm-tools/lib/include/util.h index b0126e2f9..232d68b50 100644 --- a/open-vm-tools/lib/include/util.h +++ b/open-vm-tools/lib/include/util.h @@ -63,7 +63,6 @@ EXTERN CFMutableDictionaryRef UtilMacos_CreateCFDictionary( EXTERN io_service_t Util_IORegGetDeviceObjectByName(const char *deviceName); EXTERN char *Util_GetBSDName(const char *deviceName); EXTERN char *Util_IORegGetDriveType(const char *deviceName); -EXTERN char *Util_GetMacOSUserHomeDirectory(); EXTERN char *Util_GetMacOSDefaultVMPath(); #endif // __APPLE__ @@ -73,7 +72,6 @@ EXTERN uint32 Util_Checksum32(uint32 *buf, int len); EXTERN uint32 Util_Checksum(uint8 *buf, int len); EXTERN uint32 Util_Checksumv(void *iov, int numEntries); EXTERN Unicode Util_ExpandString(ConstUnicode fileName); -EXTERN Unicode Util_GetEnv(ConstUnicode name); EXTERN void Util_ExitThread(int); EXTERN NORETURN void Util_ExitProcessAbruptly(int); EXTERN int Util_HasAdminPriv(void); @@ -91,7 +89,7 @@ EXTERN int Util_BumpNoFds(uint32 *cur, uint32 *wanted); EXTERN Bool Util_CanonicalPathsIdentical(const char *path1, const char *path2); EXTERN Bool Util_IsAbsolutePath(const char *path); EXTERN unsigned Util_GetPrime(unsigned n0); -EXTERN uint32 Util_GetCurrentThreadId(void); +EXTERN uintptr_t Util_GetCurrentThreadId(void); EXTERN char *Util_DeriveFileName(const char *source, const char *name, @@ -549,4 +547,55 @@ Util_ZeroFreeStringW(wchar_t *str) // IN } #endif // _WIN32 + +/* + *----------------------------------------------------------------------------- + * + * Util_FreeList -- + * Util_FreeStringList -- + * + * Free a list (actually a vector) of allocated objects. + * The list (vector) itself is also freed. + * + * The list either has a specified length or is + * argv-style NULL terminated (if length is negative). + * + * Results: + * None + * + * Side effects: + * errno or Windows last error is preserved. + * + *----------------------------------------------------------------------------- + */ + +static INLINE void +Util_FreeList(void **list, // IN/OUT: the list to free + ssize_t length) // IN: the length +{ + if (length >= 0) { + ssize_t i; + + for (i = 0; i < length; i++) { + free(list[i]); + DEBUG_ONLY(list[i] = NULL); + } + } else { + void **s; + + for (s = list; *s != NULL; s++) { + free(*s); + DEBUG_ONLY(*s = NULL); + } + } + free(list); +} + +static INLINE void +Util_FreeStringList(char **list, // IN/OUT: the list to free + ssize_t length) // IN: the length +{ + Util_FreeList((void **) list, length); +} + #endif /* UTIL_H */ diff --git a/open-vm-tools/lib/include/uuid.h b/open-vm-tools/lib/include/uuid.h index b4b31afef..1e640d67d 100644 --- a/open-vm-tools/lib/include/uuid.h +++ b/open-vm-tools/lib/include/uuid.h @@ -34,9 +34,11 @@ Bool UUID_ConvertToBin(uint8 dest_id[UUID_SIZE], const char *text); char *UUID_ConvertToText(const uint8 id[UUID_SIZE]); -#define UUID_CREATE_WS4 0 /* the "original", WS4 and earlier scheme */ -#define UUID_CREATE_WS5 1 /* the WS5 scheme */ -#define UUID_CREATE_WS6 2 /* the WS6 scheme */ +#define UUID_CREATE_WS4 0 /* the "original", WS4 and earlier scheme */ +#define UUID_CREATE_WS5 1 /* the WS5 scheme */ +#define UUID_CREATE_WS6 2 /* the WS6 scheme - "native" path */ +#define UUID_CREATE_WS65 3 /* the WS65 scheme - UTF-8 path */ +#define UUID_CREATE_CURRENT 3 /* the current scheme - always the latest */ char *UUID_Create(const char *configFileFullPath, int schemeControl); diff --git a/open-vm-tools/lib/include/vix.h b/open-vm-tools/lib/include/vix.h index c1287dd69..3a7038e7b 100644 --- a/open-vm-tools/lib/include/vix.h +++ b/open-vm-tools/lib/include/vix.h @@ -191,8 +191,6 @@ enum { VIX_E_SNAPSHOT_INDEPENDENTDISK = 13016, VIX_E_SNAPSHOT_NONUNIQUE_NAME = 13017, VIX_E_SNAPSHOT_MEMORY_ON_INDEPENDENT_DISK = 13018, - VIX_E_SNAPSHOT_ENCODING = 13033, - /* Host Errors */ VIX_E_HOST_DISK_INVALID_VALUE = 14003, @@ -237,6 +235,7 @@ enum { VIX_E_DISK_SUBSYSTEM_INIT_FAIL = 16053, VIX_E_DISK_INVALID_CONNECTION = 16054, VIX_E_DISK_ENCODING = 16061, + VIX_E_DISK_CANTREPAIR = 16062, /* Crypto Library Errors */ VIX_E_CRYPTO_UNKNOWN_ALGORITHM = 17000, @@ -256,7 +255,13 @@ enum { /* Remoting Errors. */ VIX_E_CANNOT_CONNECT_TO_HOST = 18000, VIX_E_NOT_FOR_REMOTE_HOST = 18001, - + + /* Screen Capture Errors. */ + VIX_E_SCREEN_CAPTURE_ERROR = 19000, + VIX_E_SCREEN_CAPTURE_BAD_FORMAT = 19001, + VIX_E_SCREEN_CAPTURE_COMPRESSION_FAIL = 19002, + VIX_E_SCREEN_CAPTURE_LARGE_DATA = 19003, + /* Guest Errors */ VIX_E_GUEST_VOLUMES_NOT_FROZEN = 20000, VIX_E_NOT_A_FILE = 20001, @@ -343,6 +348,8 @@ enum { VIX_PROPERTY_JOB_RESULT_PROCESS_START_TIME = 3055, VIX_PROPERTY_JOB_RESULT_VM_VARIABLE_STRING = 3056, VIX_PROPERTY_JOB_RESULT_PROCESS_BEING_DEBUGGED = 3057, + VIX_PROPERTY_JOB_RESULT_SCREEN_IMAGE_SIZE = 3058, + VIX_PROPERTY_JOB_RESULT_SCREEN_IMAGE_DATA = 3059, VIX_PROPERTY_JOB_RESULT_FILE_SIZE = 3061, VIX_PROPERTY_JOB_RESULT_FILE_MOD_TIME = 3062, @@ -532,7 +539,7 @@ VixHandle VixVM_Open(VixHandle hostHandle, typedef int VixVMPowerOpOptions; enum { VIX_VMPOWEROP_NORMAL = 0, - VIX_VMPOWEROP_FROM_GUEST = 0x0001, + VIX_VMPOWEROP_FROM_GUEST = 0x0004, VIX_VMPOWEROP_SUPPRESS_SNAPSHOT_POWERON = 0x0080, VIX_VMPOWEROP_LAUNCH_GUI = 0x0200 }; @@ -553,12 +560,12 @@ VixHandle VixVM_PowerOff(VixHandle vmHandle, void *clientData); VixHandle VixVM_Reset(VixHandle vmHandle, - VixVMPowerOpOptions powerOnOptions, + VixVMPowerOpOptions resetOptions, VixEventProc *callbackProc, void *clientData); VixHandle VixVM_Suspend(VixHandle vmHandle, - VixVMPowerOpOptions powerOffOptions, + VixVMPowerOpOptions suspendOptions, VixEventProc *callbackProc, void *clientData); @@ -945,7 +952,8 @@ VixHandle VixVM_RemoveSharedFolder(VixHandle vmHandle, #ifndef VIX_HIDE_FROM_JAVA enum { - VIX_CAPTURESCREENFORMAT_BITMAP = 0x00, + VIX_CAPTURESCREENFORMAT_PNG = 0x01, + VIX_CAPTURESCREENFORMAT_PNG_NOCOMPRESS = 0x02, }; VixHandle VixVM_CaptureScreenImage(VixHandle vmHandle, diff --git a/open-vm-tools/lib/include/vixCommands.h b/open-vm-tools/lib/include/vixCommands.h index c9dcaac0e..16698e4b4 100644 --- a/open-vm-tools/lib/include/vixCommands.h +++ b/open-vm-tools/lib/include/vixCommands.h @@ -315,7 +315,6 @@ VixMsgPowerOpRequest; - /* * ********************************************************** * Set NIC request. The response is just a generic @@ -951,7 +950,19 @@ struct VixMsgRecordReplayEvent { VixMsgRecordReplayEvent; typedef +#include "vmware_pack_begin.h" +struct VixMsgDebuggerEvent { + VixMsgEventHeader eventHeader; + int32 blobLength; + /* + * This is followed by the blob buffer. + */ +} +#include "vmware_pack_end.h" +VixMsgDebuggerEvent; + +typedef #include "vmware_pack_begin.h" struct VixMsgGetRecordReplayInfoResponse { VixCommandResponseHeader header; @@ -2036,7 +2047,6 @@ enum { VIX_COMMAND_HOT_ADD_DEVICE = 138, VIX_COMMAND_HOT_REMOVE_DEVICE = 139, - VIX_COMMAND_DEBUGGER_ATTACH = 140, VIX_COMMAND_DEBUGGER_DETACH = 141, VIX_COMMAND_DEBUGGER_SEND_COMMAND = 142, @@ -2049,8 +2059,10 @@ enum { VIX_COMMAND_REMOVE_REPLAY_STATE = 148, VIX_COMMAND_CANCEL_USER_PROGRESS_MESSAGE = 150, + + VIX_COMMAND_GET_VMX_DEVICE_STATE = 151, - VIX_COMMAND_LAST_NORMAL_COMMAND = 151, + VIX_COMMAND_LAST_NORMAL_COMMAND = 152, VIX_TEST_UNSUPPORTED_TOOLS_OPCODE_COMMAND = 998, VIX_TEST_UNSUPPORTED_VMX_OPCODE_COMMAND = 999, }; diff --git a/open-vm-tools/lib/include/vixOpenSource.h b/open-vm-tools/lib/include/vixOpenSource.h index 6d7512b9e..20fe0870c 100644 --- a/open-vm-tools/lib/include/vixOpenSource.h +++ b/open-vm-tools/lib/include/vixOpenSource.h @@ -286,6 +286,9 @@ VixError VixPropertyList_RemoveAll(VixHandle propertyListHandle); VixError VixPropertyList_Remove(VixHandle propertyListHandle, int propertyID); +VixError VixPropertyList_RemoveFromImpl(VixPropertyListImpl *propList, + int propertyID); + VixError VixPropertyList_AppendProperties(VixHandle handle, int firstPropertyID, ...); @@ -395,6 +398,7 @@ enum { extern int vixDebugGlobalSpewLevel; extern char *VixAllocDebugString(char *fmt, ...); extern void VixDebugInit(int level); +extern const char *VixDebug_GetFileBaseName(const char *path); /* * preference name for client and vmx @@ -403,12 +407,14 @@ extern void VixDebugInit(int level); #define VIX_DEBUG_LEVEL(logLevel, s) if (logLevel <= vixDebugGlobalSpewLevel) \ { char *debugString = VixAllocDebugString s; \ - Log("Vix Debug: [%s:%d]: %s", __FILE__, __LINE__, debugString); \ + Log("Vix: [%lu %s:%d]: %s", (unsigned long)Util_GetCurrentThreadId(), \ + VixDebug_GetFileBaseName(__FILE__), __LINE__, debugString); \ free(debugString); } #define VIX_DEBUG(s) if (0 != vixDebugGlobalSpewLevel) \ { char *debugString = VixAllocDebugString s; \ - Log("Vix Debug: [%s:%d]: %s", __FILE__, __LINE__, debugString); \ + Log("Vix: [%lu %s:%d]: %s", (unsigned long)Util_GetCurrentThreadId(), \ + VixDebug_GetFileBaseName(__FILE__), __LINE__, debugString); \ free(debugString); } #endif // VIX_HIDE_FROM_JAVA diff --git a/open-vm-tools/lib/include/vixTools.h b/open-vm-tools/lib/include/vixTools.h index f4c5e61e3..260581adf 100644 --- a/open-vm-tools/lib/include/vixTools.h +++ b/open-vm-tools/lib/include/vixTools.h @@ -81,6 +81,9 @@ VixError VixToolsGetUserTmpDir(void *userToken, char **tmpDirPath); Bool VixToolsUserIsMemberOfAdministratorGroup(VixCommandRequestHeader *requestMsg); + +VixError VixToolsValidateUserCredentials(const char *domainAndUsername, + const char *password); #endif // _WIN32 #if IMPLEMENT_SOCKET_MGR diff --git a/open-vm-tools/lib/include/vmBackup.h b/open-vm-tools/lib/include/vmBackup.h index 7fee6f6d5..d6c9bab3d 100644 --- a/open-vm-tools/lib/include/vmBackup.h +++ b/open-vm-tools/lib/include/vmBackup.h @@ -31,14 +31,9 @@ #include "vmbackup_def.h" #include "dbllnklst.h" -#include "dynarray.h" #include "eventManager.h" #include "rpcin.h" #include "str.h" -#include "unicode.h" - -typedef char *Target; -DEFINE_DYNARRAY_TYPE(Target); typedef enum { VMBACKUP_STATUS_PENDING, @@ -90,7 +85,7 @@ typedef struct VmBackupState { Bool clientAborted; intptr_t clientData; void *scripts; - TargetArray disabledTargets; + const char *configDir; ssize_t currentScript; } VmBackupState; diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86.h b/open-vm-tools/lib/include/vm_basic_asm_x86.h index 27918bcf5..4e2f061b0 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_x86.h +++ b/open-vm-tools/lib/include/vm_basic_asm_x86.h @@ -100,13 +100,13 @@ static INLINE void FXSAVE_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsave %0\n" : "=m" (*save)); + __asm__ __volatile__ ("fxsave %0\n" : "=m" (*save) : : "memory"); } static INLINE void FXRSTOR_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*load) : "memory"); } static INLINE void @@ -126,7 +126,7 @@ FXRSTOR_AMD_ES0(const uint8 *load) "fxrstor %1 \n" : : "m" (dummy), "m" (*load) - : "ax"); + : "ax", "memory"); } #endif /* __GNUC__ */ diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h index e7006f7b6..7dc4e1652 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_x86_64.h +++ b/open-vm-tools/lib/include/vm_basic_asm_x86_64.h @@ -84,25 +84,25 @@ uint64 __shiftright128(uint64 lowPart, uint64 highPart, uint8 shift); static INLINE void FXSAVE_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsaveq %0 \n" : "=m" (*save)); + __asm__ __volatile__ ("fxsaveq %0 \n" : "=m" (*save) : : "memory"); } static INLINE void FXSAVE_COMPAT_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsave %0 \n" : "=m" (*save)); + __asm__ __volatile__ ("fxsave %0 \n" : "=m" (*save) : : "memory"); } static INLINE void FXRSTOR_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstorq %0 \n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstorq %0 \n" : : "m" (*load) : "memory"); } static INLINE void FXRSTOR_COMPAT_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstor %0 \n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstor %0 \n" : : "m" (*load) : "memory"); } static INLINE void @@ -122,7 +122,7 @@ FXRSTOR_AMD_ES0(const uint8 *load) "fxrstorq %1 \n" : : "m" (dummy), "m" (*load) - : "ax"); + : "ax", "memory"); } #endif /* __GNUC__ */ diff --git a/open-vm-tools/lib/include/vm_basic_types.h b/open-vm-tools/lib/include/vm_basic_types.h index 5e35a1500..2522d12fb 100644 --- a/open-vm-tools/lib/include/vm_basic_types.h +++ b/open-vm-tools/lib/include/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/lib/include/vm_tools_version.h b/open-vm-tools/lib/include/vm_tools_version.h index bd6a8cf57..8ab425988 100644 --- a/open-vm-tools/lib/include/vm_tools_version.h +++ b/open-vm-tools/lib/include/vm_tools_version.h @@ -739,9 +739,21 @@ typedef uint32 ToolsVersion; #define TOOLS_VERSION_SERVER20_BETA2_V_MNR 7 #define TOOLS_VERSION_SERVER20_BETA2_V_BASE 1 -#define TOOLS_VERSION_CURRENT TOOLS_VERSION_SERVER20_BETA2 -#define TOOLS_VERSION_CURRENT_STR TOOLS_VERSION_TO_STR(TOOLS_VERSION_SERVER20_BETA2) -#define TOOLS_VERSION_CURRENT_CSV TOOLS_VERSION_TO_CSV(TOOLS_VERSION_SERVER20_BETA2) +/* + * XXX: Chromium (WS 6.5) releases should have 7.8.x numbers. + * We still haven't used that range (beta 1 was released with 7.7.1). + */ + +#ifndef RC_INVOKED +#define TOOLS_VERSION_FUSION15_BETA1 TOOLS_VERSION_TO_UINT(TOOLS_VERSION_FUSION15_BETA1_V) +#endif /* RC_INVOKED */ +#define TOOLS_VERSION_FUSION15_BETA1_V_MJR 7 +#define TOOLS_VERSION_FUSION15_BETA1_V_MNR 9 +#define TOOLS_VERSION_FUSION15_BETA1_V_BASE 0 + +#define TOOLS_VERSION_CURRENT TOOLS_VERSION_FUSION15_BETA1 +#define TOOLS_VERSION_CURRENT_STR TOOLS_VERSION_TO_STR(TOOLS_VERSION_FUSION15_BETA1) +#define TOOLS_VERSION_CURRENT_CSV TOOLS_VERSION_TO_CSV(TOOLS_VERSION_FUSION15_BETA1) /* * The extended Tools version is the current Tools version with the diff --git a/open-vm-tools/lib/include/vm_version.h b/open-vm-tools/lib/include/vm_version.h index d7f639b9e..6ccf149ac 100644 --- a/open-vm-tools/lib/include/vm_version.h +++ b/open-vm-tools/lib/include/vm_version.h @@ -204,12 +204,14 @@ #define WBC_VERSION "e.x.p" #define SDK_VERSION "e.x.p" #define FOUNDRY_VERSION "e.x.p" +#define FOUNDRY_FILE_VERSION 1,5,0,PRODUCT_BUILD_NUMBER_NUMERIC #define VMLS_VERSION "e.x.p" #define LICENSE_VERSION "e.x.p" #define DDK_VERSION "e.x.p" #define VIM_API_VERSION "2.5.0" #define VIPERL_VERSION "1.1.0" #define RCLI_VERSION "1.5.0" +#define VDM_VERSION "e.x.p" // VMRC_PLUGIN_VERSION should match PLAYER_VERSION but can't be e.x.p #define VMRC_PLUGIN_VERSION "2.5.0" @@ -221,7 +223,7 @@ * * XXX: The extract-macro script should be updated to handle this special case. */ -#define TOOLS_VERSION "2008.04.14" +#define TOOLS_VERSION "2008.05.02" #ifdef VMX86_VPX #define VIM_API_TYPE "VirtualCenter" diff --git a/open-vm-tools/lib/message/Makefile.in b/open-vm-tools/lib/message/Makefile.in index 620cd4f22..913657dd8 100644 --- a/open-vm-tools/lib/message/Makefile.in +++ b/open-vm-tools/lib/message/Makefile.in @@ -129,6 +129,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/message/shared/Makefile.in b/open-vm-tools/lib/message/shared/Makefile.in index 95d91549c..b193ad23a 100644 --- a/open-vm-tools/lib/message/shared/Makefile.in +++ b/open-vm-tools/lib/message/shared/Makefile.in @@ -117,6 +117,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/misc/Makefile.am b/open-vm-tools/lib/misc/Makefile.am index 1a178521b..2d004b85f 100644 --- a/open-vm-tools/lib/misc/Makefile.am +++ b/open-vm-tools/lib/misc/Makefile.am @@ -20,7 +20,7 @@ noinst_LIBRARIES = libMisc.a libMisc_a_SOURCES = libMisc_a_SOURCES += atomic.c libMisc_a_SOURCES += base64.c -libMisc_a_SOURCES += codeset.c +libMisc_a_SOURCES += codesetOld.c libMisc_a_SOURCES += dbllnklst.c libMisc_a_SOURCES += dynarray.c libMisc_a_SOURCES += dynbuf.c @@ -39,6 +39,10 @@ libMisc_a_SOURCES += vmstdio.c libMisc_a_SOURCES += posixPosix.c libMisc_a_SOURCES += posixDlopen.c +if NO_ICU +libMisc_a_SOURCES += codeset.c +endif + AM_CFLAGS = AM_CFLAGS += @COMMON_CFLAGS@ AM_CFLAGS += @LIB_MISC_CFLAGS@ diff --git a/open-vm-tools/lib/misc/Makefile.in b/open-vm-tools/lib/misc/Makefile.in index 134181754..7e276ce23 100644 --- a/open-vm-tools/lib/misc/Makefile.in +++ b/open-vm-tools/lib/misc/Makefile.in @@ -49,6 +49,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@NO_ICU_TRUE@am__append_1 = codeset.c subdir = lib/misc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -61,13 +62,20 @@ LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libMisc_a_AR = $(AR) $(ARFLAGS) libMisc_a_LIBADD = +am__libMisc_a_SOURCES_DIST = atomic.c base64.c codesetOld.c \ + dbllnklst.c dynarray.c dynbuf.c escape.c hashTable.c \ + hostinfo_misc.c hostname.c idLinux.c iovector.c machineID.c \ + miscSolaris.c random.c timeutil.c util_misc.c vmstdio.c \ + posixPosix.c posixDlopen.c codeset.c +@NO_ICU_TRUE@am__objects_1 = codeset.$(OBJEXT) am_libMisc_a_OBJECTS = atomic.$(OBJEXT) base64.$(OBJEXT) \ - codeset.$(OBJEXT) dbllnklst.$(OBJEXT) dynarray.$(OBJEXT) \ + codesetOld.$(OBJEXT) dbllnklst.$(OBJEXT) dynarray.$(OBJEXT) \ dynbuf.$(OBJEXT) escape.$(OBJEXT) hashTable.$(OBJEXT) \ hostinfo_misc.$(OBJEXT) hostname.$(OBJEXT) idLinux.$(OBJEXT) \ iovector.$(OBJEXT) machineID.$(OBJEXT) miscSolaris.$(OBJEXT) \ random.$(OBJEXT) timeutil.$(OBJEXT) util_misc.$(OBJEXT) \ - vmstdio.$(OBJEXT) posixPosix.$(OBJEXT) posixDlopen.$(OBJEXT) + vmstdio.$(OBJEXT) posixPosix.$(OBJEXT) posixDlopen.$(OBJEXT) \ + $(am__objects_1) libMisc_a_OBJECTS = $(am_libMisc_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -82,7 +90,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libMisc_a_SOURCES) -DIST_SOURCES = $(libMisc_a_SOURCES) +DIST_SOURCES = $(am__libMisc_a_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -134,6 +142,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -232,10 +243,11 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libMisc.a -libMisc_a_SOURCES = atomic.c base64.c codeset.c dbllnklst.c dynarray.c \ - dynbuf.c escape.c hashTable.c hostinfo_misc.c hostname.c \ - idLinux.c iovector.c machineID.c miscSolaris.c random.c \ - timeutil.c util_misc.c vmstdio.c posixPosix.c posixDlopen.c +libMisc_a_SOURCES = atomic.c base64.c codesetOld.c dbllnklst.c \ + dynarray.c dynbuf.c escape.c hashTable.c hostinfo_misc.c \ + hostname.c idLinux.c iovector.c machineID.c miscSolaris.c \ + random.c timeutil.c util_misc.c vmstdio.c posixPosix.c \ + posixDlopen.c $(am__append_1) AM_CFLAGS = @COMMON_CFLAGS@ @LIB_MISC_CFLAGS@ SUBDIRS = shared all: all-recursive @@ -288,6 +300,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codeset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codesetOld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbllnklst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynarray.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynbuf.Po@am__quote@ diff --git a/open-vm-tools/lib/misc/codeset.c b/open-vm-tools/lib/misc/codeset.c index 747f2a059..3dbf186e7 100644 --- a/open-vm-tools/lib/misc/codeset.c +++ b/open-vm-tools/lib/misc/codeset.c @@ -1,33 +1,54 @@ -/********************************************************* - * Copyright (C) 1998 VMware, Inc. All rights reserved. +/* ********************************************************** + * Copyright 1998 VMware, Inc. All rights reserved. + * **********************************************************/ + +/* + * codeset.c -- * - * 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 - * by the Free Software Foundation version 2.1 and no later version. + * Character set and encoding conversion functions, using ICU. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public - * License for more details. * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * Some definitions borrow from header files from the ICU 1.8.1 + * library. * - *********************************************************/ - -/* - * codeset.c -- + * ICU 1.8.1 license follows: * - * Character set and encoding conversion functions --hpreg - */ - - -/* - * Windows have their own logic for conversion. On Posix systems with iconv - * available we use iconv. On systems without iconv use simple 1:1 translation - * for UTF8 <-> Current. We also use 1:1 translation also for MacOS's conversion - * between 'current' and 'UTF-8', as MacOS is UTF-8 only. + * ICU License - ICU 1.8.1 and later + * + * COPYRIGHT AND PERMISSION NOTICE + * + * Copyright (c) 1995-2006 International Business Machines Corporation + * and others + * + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any + * person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all + * copies of the Software and that both the above copyright + * notice(s) and this permission notice appear in supporting + * documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE + * BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR + * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a + * copyright holder shall not be used in advertising or otherwise + * to promote the sale, use or other dealings in this Software + * without prior written authorization of the copyright holder. */ #if defined(_WIN32) @@ -35,454 +56,448 @@ # include # include #else +# define _GNU_SOURCE # include # include # include -# if defined(__FreeBSD__) || (defined(__linux__) && !defined(GLIBC_VERSION_21)) -# define CURRENT_IS_UTF8 -# else -# define USE_ICONV -# include -# include -# ifdef __linux__ -# include "str.h" -# endif -# if defined(__APPLE__) -# define CURRENT_IS_UTF8 -# include /* for CFString */ -# endif -# endif +# include +# include #endif -#include "vm_assert.h" +#include +#include "vmware.h" +#include "vm_product.h" +#include "unicode/ucnv.h" +#include "unicode/putil.h" +#ifdef _WIN32 +#include "win32u.h" +#endif +#include "file.h" +#include "util.h" #include "codeset.h" +#include "codesetOld.h" +#include "str.h" + +/* + * Macros + */ + +#define CODESET_CAN_FALLBACK_ON_NON_ICU TRUE -#define CSGTG_NORMAL 0x0000 /* Without any information loss. */ -#define CSGTG_TRANSLIT 0x0001 /* Transliterate unknown characters. */ -#define CSGTG_IGNORE 0x0002 /* Skip over untranslatable characters. */ +#if defined(__APPLE__) +#define POSIX_ICU_DIR DEFAULT_LIBDIRECTORY "/icu" +#elif !defined(WIN32) +#define POSIX_ICU_DIR "/etc/vmware/icu" +#endif -#if defined(__FreeBSD__) || defined(sun) -static const char nul[] = {'\0', '\0'}; +/* + * XXX These should be passed in from the build system, + * but I don't have time to deal with bora-vmsoft. -- edward + */ + +#define ICU_DATA_FILE "icudt38l.dat" +#ifdef _WIN32 +#define ICU_DATA_FILE_DIR "%TCROOT%/noarch/icu-data-3.8-1" +#else +#define ICU_DATA_FILE_DIR "/build/toolchain/noarch/icu-data-3.8-1" +#endif + +#ifdef _WIN32 +#define ICU_DATA_FILE_W XCONC(L, ICU_DATA_FILE) +#define ICU_DATA_FILE_DIR_W XCONC(L, ICU_DATA_FILE_DIR) +#define ICU_DATA_FILE_PATH ICU_DATA_FILE_DIR_W DIRSEPS_W ICU_DATA_FILE_W #else -static const wchar_t nul = L'\0'; +#define ICU_DATA_FILE_PATH ICU_DATA_FILE_DIR DIRSEPS ICU_DATA_FILE #endif -#if defined(CURRENT_IS_UTF8) || defined(_WIN32) /* - *----------------------------------------------------------------------------- + * Variables + */ + +static Bool dontUseIcu = TRUE; +DEBUG_ONLY(static Bool initedIcu = FALSE;) + +/* + * Functions + */ + +#ifdef _WIN32 + +/* + *---------------------------------------------------------------------------- * - * CodeSetDuplicateStr -- + * CodeSetGetModulePath -- * - * Duplicate input string, appending zero terminator to its end. Only - * used on Windows and on platforms where current encoding is always - * UTF-8, on other iconv-capable platforms we just use iconv even for - * UTF-8 to UTF-8 translation. Note that this function is more like - * memdup() than strdup(), so it can be used for duplicating UTF-16 - * strings as well - string is always terminated by wide character NUL, - * which is supposed to be longest NUL character occuring on specified - * host. + * Returns the wide-character current module path. We can't use + * Win32U_GetModulePath because it invokes codeset.c conversion + * routines. * - * Results: - * TRUE on success - * FALSE on failure + * Returns: + * NULL, or a utf16 string (free with free). * * Side effects: - * None. + * None. * - *----------------------------------------------------------------------------- + *---------------------------------------------------------------------------- */ -static Bool -CodeSetDuplicateStr(const char *bufIn, // IN: Input string - size_t sizeIn, // IN: Input string length - char **bufOut, // OUT: "Converted" string - size_t *sizeOut) // OUT: Length of string +utf16_t * +CodeSetGetModulePath(HANDLE hModule) // IN { - char *myBufOut; + utf16_t *pathW = NULL; + DWORD size = MAX_PATH; - myBufOut = malloc(sizeIn + sizeof nul); - if (myBufOut == NULL) { - return FALSE; - } + while (TRUE) { + DWORD res; - memcpy(myBufOut, bufIn, sizeIn); - memset(myBufOut + sizeIn, 0, sizeof nul); + pathW = realloc(pathW, size * sizeof(wchar_t)); + if (!pathW) { + return NULL; + } - *bufOut = myBufOut; - if (sizeOut) { - *sizeOut = sizeIn; + res = GetModuleFileNameW(hModule, pathW, size); + + if (res == 0) { + /* fatal error */ + goto exit; + } else if (res == size) { + /* buffer too small */ + size *= 2; + } else { + /* success */ + break; + } } - return TRUE; + + exit: + return pathW; } -#endif + +#endif // _WIN32 /* *----------------------------------------------------------------------------- * - * CodeSetDynBufFinalize -- + * CodeSet_DontUseIcu -- * - * Append NUL terminator to the buffer, and return pointer to buffer - * and its data size (before appending terminator). Destroys buffer - * on failure. + * Tell codeset not to load or use ICU (or stop using it if it's + * already loaded). Codeset will fall back on codesetOld.c, which + * relies on system internationalization APIs (and may have more + * limited functionality). Not all APIs have a fallback, however + * (namely GenericToGeneric). * * Results: * TRUE on success * FALSE on failure * * Side effects: - * None. + * See above * *----------------------------------------------------------------------------- */ -static Bool -CodeSetDynBufFinalize(Bool ok, // IN: Earlier steps succeeded - DynBuf *db, // IN: Buffer with converted string - char **bufOut, // OUT: Converted string - size_t *sizeOut) // OUT: Length of string in bytes +void +CodeSet_DontUseIcu(void) { - if (!ok || !DynBuf_Append(db, &nul, sizeof nul) || !DynBuf_Trim(db)) { - DynBuf_Destroy(db); - return FALSE; - } - - *bufOut = DynBuf_Get(db); - if (sizeOut) { - *sizeOut = DynBuf_GetSize(db) - sizeof nul; - } - return TRUE; + dontUseIcu = TRUE; } /* *----------------------------------------------------------------------------- * - * CodeSetUtf8ToUtf16le -- + * CodeSet_Init -- * - * Append the content of a buffer (that uses the UTF-8 encoding) to a - * DynBuf (that uses the UTF-16LE encoding) + * Looks for ICU's data file in some platform-specific + * directory. If present, inits ICU by feeding it the path to that + * directory. If already inited, returns the current state (init + * failed/succeeded). + * + * Call while single-threaded. + * + * *********** WARNING *********** + * Do not call CodeSet_Init directly, it is called already by + * Unicode_Init. Lots of code depends on codeset. Please call + * Unicode_Init as early as possible. + * ******************************* * * Results: * TRUE on success * FALSE on failure * * Side effects: - * None + * See above * *----------------------------------------------------------------------------- */ -static Bool -CodeSetUtf8ToUtf16le(const char *bufIn, // IN - size_t sizeIn, // IN - DynBuf *db) // IN +Bool +CodeSet_Init(void) { - size_t currentSize; - size_t allocatedSize; - uint16 *buf; - - currentSize = DynBuf_GetSize(db); - allocatedSize = DynBuf_GetAllocatedSize(db); - buf = (uint16 *)((char *)DynBuf_Get(db) + currentSize); - while (sizeIn--) { - unsigned int uniChar = *bufIn++ & 0xFF; - size_t neededSize; - - if (uniChar >= 0x80) { - size_t charLen; - size_t idx; - - if (uniChar < 0xC2) { - /* 80-BF cannot start UTF8 sequence. C0-C1 cannot appear in UTF8 stream at all. */ - return FALSE; - } else if (uniChar < 0xE0) { - uniChar -= 0xC0; - charLen = 1; - } else if (uniChar < 0xF0) { - uniChar -= 0xE0; - charLen = 2; - } else if (uniChar < 0xF8) { - uniChar -= 0xF0; - charLen = 3; - } else if (uniChar < 0xFC) { - uniChar -= 0xF8; - charLen = 4; - } else if (uniChar < 0xFE) { - uniChar -= 0xFC; - charLen = 5; - } else { - return FALSE; - } - if (sizeIn < charLen) { - return FALSE; - } - for (idx = 0; idx < charLen; idx++) { - unsigned int nextChar; + DynBuf dbpath; +#ifdef _WIN32 + DWORD attribs; + utf16_t *modPath = NULL; + utf16_t *lastSlash; +#else + struct stat finfo; +#endif + char *path = NULL; + Bool ret = FALSE; + + DynBuf_Init(&dbpath); + + DEBUG_ONLY(ASSERT(!initedIcu);) + DEBUG_ONLY(initedIcu = TRUE;) + +#ifdef USE_ICU + /* + * We're using system ICU, which finds its own data. So nothing to + * do here. + */ + dontUseIcu = FALSE; + ret = TRUE; + goto exit; +#endif - nextChar = *bufIn++ & 0xFF; - if (nextChar < 0x80 || nextChar >= 0xC0) { - return FALSE; + /* + * ********************* WARNING + * Must avoid recursive calls into the codeset library here, hence + * the idiotic hoop-jumping. DO NOT change any of these calls to + * wrapper equivalents or call any other functions that may perform + * string conversion. + * ********************* WARNING + */ + +#ifdef _WIN32 // { + +#if vmx86_devel + /* + * Devel builds use toolchain directory first. + */ + + { + WCHAR icuFilePath[MAX_PATH] = { 0 }; + DWORD n = ExpandEnvironmentStringsW(ICU_DATA_FILE_PATH, + icuFilePath, ARRAYSIZE(icuFilePath)); + if (n > 0 && n < ARRAYSIZE(icuFilePath)) { + attribs = GetFileAttributesW(icuFilePath); + if ((INVALID_FILE_ATTRIBUTES != attribs) || + (attribs & FILE_ATTRIBUTE_DIRECTORY) == 0) { + if (!CodeSetOld_Utf16leToCurrent((const char *) icuFilePath, + n * sizeof *icuFilePath, + &path, NULL)) { + goto exit; } - uniChar = (uniChar << 6) + nextChar - 0x80; - sizeIn--; + goto found; } + } + } +#endif - /* - * Shorter encoding available. UTF-8 mandates that shortest possible encoding - * is used, as otherwise doing UTF-8 => anything => UTF-8 could bypass some - * important tests, like '/' for path separator or \0 for string termination. - * - * This test is not correct for charLen == 1, as its disallowed range is - * 0x00-0x7F, while this test disallows only 0x00-0x3F. But this part of - * problem is solved by stopping when 0xC1 is encountered, as 0xC1 0xXX - * describes just this range. This also means that 0xC0 and 0xC1 cannot - * ever occur in valid UTF-8 string. - */ - if (uniChar < 1U << (charLen * 5 + 1)) { - return FALSE; - } + /* + * Data file must be in current module directory. + */ + + modPath = CodeSetGetModulePath(NULL); + if (!modPath) { + goto exit; + } + + lastSlash = wcsrchr(modPath, DIRSEPC_W); + if (!lastSlash) { + goto exit; + } + + *lastSlash = L'\0'; + + if (!DynBuf_Append(&dbpath, modPath, + wcslen(modPath) * sizeof(utf16_t)) || + !DynBuf_Append(&dbpath, DIRSEPS_W, + wcslen(DIRSEPS_W) * sizeof(utf16_t)) || + !DynBuf_Append(&dbpath, ICU_DATA_FILE_W, + wcslen(ICU_DATA_FILE_W) * sizeof(utf16_t)) || + !DynBuf_Append(&dbpath, L"\0", 2)) { + goto exit; + } + + /* + * Check for file existence. + */ + + attribs = GetFileAttributesW((LPCWSTR) DynBuf_Get(&dbpath)); + + if ((INVALID_FILE_ATTRIBUTES == attribs) || + (attribs & FILE_ATTRIBUTE_DIRECTORY)) { + goto exit; + } + + /* + * Convert path to local encoding using system APIs (old codeset). + */ + + if (!CodeSetOld_Utf16leToCurrent(DynBuf_Get(&dbpath), + DynBuf_GetSize(&dbpath), + &path, NULL)) { + goto exit; + } + +#else // } _WIN32 { + +#if vmx86_devel + /* + * Devel builds use toolchain directory first. + */ + + if (stat(ICU_DATA_FILE_PATH, &finfo) >= 0 && !S_ISDIR(finfo.st_mode)) { + if ((path = strdup(ICU_DATA_FILE_PATH)) == NULL) { + goto exit; } + goto found; + } +#endif + + /* + * Data file must be in POSIX_ICU_DIR. + */ + if (!DynBuf_Append(&dbpath, POSIX_ICU_DIR, strlen(POSIX_ICU_DIR)) || + !DynBuf_Append(&dbpath, DIRSEPS, strlen(DIRSEPS)) || + !DynBuf_Append(&dbpath, ICU_DATA_FILE, strlen(ICU_DATA_FILE)) || + !DynBuf_Append(&dbpath, "\0", 1)) { + goto exit; + } + + /* + * Check for file existence. (DO NOT CHANGE TO 'stat' WRAPPER). + */ + + path = (char *) DynBuf_Detach(&dbpath); + if (stat(path, &finfo) < 0 || S_ISDIR(finfo.st_mode)) { + goto exit; + } + +#endif // } _WIN32 + +#if vmx86_devel +found: +#endif + + /* + * Tell ICU to use this directory. + */ + u_setDataDirectory(path); + + dontUseIcu = FALSE; + ret = TRUE; + + exit: + if (!ret) { /* - * Here we have UCS-4 character in uniChar, between 0 and 0x7FFFFFFF. - * Let's convert it to UTF-16. + * There was an error initing ICU, but if we can fall back on + * non-ICU (old CodeSet) then things are OK. */ - - /* Non-paired surrogates are illegal in UTF-16. */ - if (uniChar >= 0xD800 && uniChar < 0xE000) { - return FALSE; - } - if (uniChar < 0x10000) { - neededSize = currentSize + sizeof *buf; - } else if (uniChar < 0x110000) { - neededSize = currentSize + 2 * sizeof *buf; - } else { - /* This character cannot be represented in UTF-16. */ - return FALSE; - } - if (allocatedSize < neededSize) { - if (DynBuf_Enlarge(db, neededSize) == FALSE) { - return FALSE; - } - allocatedSize = DynBuf_GetAllocatedSize(db); - ASSERT(neededSize <= allocatedSize); - buf = (uint16 *)((char *)DynBuf_Get(db) + currentSize); - } - if (uniChar < 0x10000) { - *buf++ = uniChar; - } else { - *buf++ = 0xD800 + ((uniChar - 0x10000) >> 10); - *buf++ = 0xDC00 + ((uniChar - 0x10000) & 0x3FF); + if (CODESET_CAN_FALLBACK_ON_NON_ICU) { + ret = TRUE; + dontUseIcu = TRUE; } - currentSize = neededSize; } - /* All went fine, update buffer size. */ - DynBuf_SetSize(db, currentSize); - return TRUE; -} +#ifdef _WIN32 + free(modPath); +#endif -#if defined(_WIN32) + free(path); + DynBuf_Destroy(&dbpath); -static Bool IsWin95(void); -static DWORD GetInvalidCharsFlag(void); + return ret; +} -/* - * Win32-specific remarks: here is my understanding of those terms as of - * 2002/02/12: - * - * ANSI code page - * The character set used internally by Windows applications (when they are - * not fully Unicode). - * - * OEM code page - * The character set used by MS-DOS and stored in the FAT filesystem. - * - * --hpreg - */ +#if defined(CURRENT_IS_UTF8) /* *----------------------------------------------------------------------------- * - * CodeSetGenericToUtf16le -- + * CodeSetDuplicateUtf8Str -- * - * Append the content of a buffer (that uses the specified encoding) to a - * DynBuf (that uses the UTF-16LE encoding) --hpreg + * Duplicate UTF-8 string, appending zero terminator to its end. * * Results: * TRUE on success * FALSE on failure * * Side effects: - * None + * None. * *----------------------------------------------------------------------------- */ static Bool -CodeSetGenericToUtf16le(UINT codeIn, // IN - char const *bufIn, // IN - size_t sizeIn, // IN - DynBuf *db) // IN +CodeSetDuplicateUtf8Str(const char *bufIn, // IN: Input string + size_t sizeIn, // IN: Input string length + char **bufOut, // OUT: "Converted" string + size_t *sizeOut) // OUT: Length of string { - /* - * Undocumented: calling MultiByteToWideChar() with sizeIn == 0 returns 0 - * with GetLastError() set to ERROR_INVALID_PARAMETER. Isn't this API - * robust? --hpreg - */ - if (sizeIn) { - size_t initialSize; - DWORD flags = GetInvalidCharsFlag(); - Bool invalidCharsCheck = ((flags & MB_ERR_INVALID_CHARS) != 0); - - initialSize = DynBuf_GetSize(db); - for (;;) { - int result; - int resultReverse; - DWORD error = ERROR_SUCCESS; - - if (DynBuf_Enlarge(db, sizeof(wchar_t)) == FALSE) { - return FALSE; - } - - /* - * Must fail if bufIn has any invalid characters. - * So MB_ERR_INVALID_CHARS added, otherwise can - * lead to security issues see bug 154114. - */ - result = MultiByteToWideChar(codeIn, - flags, - bufIn, - sizeIn, - (wchar_t *)((char *)DynBuf_Get(db) + initialSize), - (DynBuf_GetAllocatedSize(db) - initialSize) / - sizeof(wchar_t)); - - if (0 == result) { - error = GetLastError(); // may be ERROR_NO_UNICODE_TRANSLATION - } - - /* - * Success if: result is > 0 and is the same number - * of characters as the input string contains. If there - * are any invalid characters, the Win2K SP4 or later will - * fail, but for earlier OS versions, these invalid characters - * will be dropped. Thus only succeed if we have no dropped - * characters. - * For the older platforms which don't fail for invalid characters - * we see if the reverse conversion of the converted string - * yields the same string size that was passed in. - * If not, then dropped characters so fail. - */ - if (!invalidCharsCheck) { - resultReverse = WideCharToMultiByte(codeIn, 0, - (wchar_t *)((char *)DynBuf_Get(db) + initialSize), - result, NULL, 0, 0, 0); - } - if (result > 0 && - (invalidCharsCheck || - (sizeIn == resultReverse))) { - DynBuf_SetSize(db, initialSize + result * sizeof(wchar_t)); - break; - } - - if (result > 0 && (!invalidCharsCheck && sizeIn != resultReverse)) { - return FALSE; - } + char *myBufOut; - ASSERT(result == 0); + myBufOut = malloc(sizeIn + 1); + if (myBufOut == NULL) { + return FALSE; + } - if (error != ERROR_INSUFFICIENT_BUFFER) { - return FALSE; - } + memcpy(myBufOut, bufIn, sizeIn); + memset(myBufOut + sizeIn, 0, 1); - /* Need a larger buffer --hpreg */ - } + *bufOut = myBufOut; + if (sizeOut) { + *sizeOut = sizeIn; } - return TRUE; } +#endif // defined(CURRENT_IS_UTF8) + /* *----------------------------------------------------------------------------- * - * CodeSetUtf16leToGeneric -- + * CodeSetDynBufFinalize -- * - * Append the content of a buffer (that uses the UTF-16LE encoding) to a - * DynBuf (that uses the specified encoding) --hpreg + * Append NUL terminator to the buffer, and return pointer to + * buffer and its data size (before appending terminator). Destroys + * buffer on failure. * * Results: * TRUE on success * FALSE on failure * * Side effects: - * None + * None. * *----------------------------------------------------------------------------- */ static Bool -CodeSetUtf16leToGeneric(char const *bufIn, // IN - size_t sizeIn, // IN - UINT codeOut, // IN - DynBuf *db) // IN +CodeSetDynBufFinalize(Bool ok, // IN: Earlier steps succeeded + DynBuf *db, // IN: Buffer with converted string + char **bufOut, // OUT: Converted string + size_t *sizeOut) // OUT: Length of string in bytes { /* - * Undocumented: calling WideCharToMultiByte() with sizeIn == 0 returns 0 - * with GetLastError() set to ERROR_INVALID_PARAMETER. Isn't this API - * robust? --hpreg + * NUL can be as long as 4 bytes if UTF-32, make no assumptions. */ - if (sizeIn) { - size_t initialSize; - - initialSize = DynBuf_GetSize(db); - for (;;) { - int result; - DWORD error; - - if (DynBuf_Enlarge(db, 1) == FALSE) { - return FALSE; - } - - result = WideCharToMultiByte(codeOut, - 0, - (wchar_t const *)bufIn, - sizeIn / sizeof(wchar_t), - (char *)DynBuf_Get(db) + initialSize, - DynBuf_GetAllocatedSize(db) - initialSize, - NULL, - /* - * XXX We may need to pass that argument - * to know when the conversion was - * not possible --hpreg - */ - NULL); - if (result > 0) { - DynBuf_SetSize(db, initialSize + result); - break; - } - - ASSERT(result == 0); - - /* Must come first --hpreg */ - error = GetLastError(); - - if (error != ERROR_INSUFFICIENT_BUFFER) { - return FALSE; - } - - /* Need a larger buffer --hpreg */ - } + if (!ok || !DynBuf_Append(db, "\0\0\0\0", 4) || !DynBuf_Trim(db)) { + DynBuf_Destroy(db); + return FALSE; } - /* - * Undocumented: if the input buffer is not NUL-terminated, the output - * buffer will not be NUL-terminated either --hpreg - */ + *bufOut = DynBuf_Get(db); + if (sizeOut) { + *sizeOut = DynBuf_GetSize(db) - 4; + } return TRUE; } @@ -490,15 +505,13 @@ CodeSetUtf16leToGeneric(char const *bufIn, // IN /* *----------------------------------------------------------------------------- * - * CodeSetUtf16leToCurrent -- + * CodeSetUtf8ToUtf16le -- * - * Convert the content of a buffer (that uses the UTF-16LE encoding) into - * another buffer (that uses the current encoding) --hpreg + * Append the content of a buffer (that uses the UTF-8 encoding) to a + * DynBuf (that uses the UTF-16LE encoding) * * Results: - * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. - * If not NULL, '*sizeOut' contains the size of the buffer - * (excluding the NUL terminator) + * TRUE on success * FALSE on failure * * Side effects: @@ -508,131 +521,43 @@ CodeSetUtf16leToGeneric(char const *bufIn, // IN */ static Bool -CodeSetUtf16leToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSetUtf8ToUtf16le(const char *bufIn, // IN + size_t sizeIn, // IN + DynBuf *db) // IN { - DynBuf db; - Bool ok; - - DynBuf_Init(&db); - /* XXX We should probably use CP_THREAD_ACP on Windows 2000/XP --hpreg */ - ok = CodeSetUtf16leToGeneric(bufIn, sizeIn, CP_ACP, &db); - return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); + return CodeSet_GenericToGenericDb("UTF-8", bufIn, sizeIn, "UTF-16LE", 0, + db); } -#endif #if defined(__APPLE__) + /* *----------------------------------------------------------------------------- * - * CodeSetUtf8Normalize -- + * CodeSet_Utf8Normalize -- * - * Convert the content of a buffer (that uses the UTF-8 encoding) into - * another buffer (that uses the UTF-8 encoding) that is in precomposed - (Normalization Form C) or decomposed (Normalization Form D). + * Calls down to CodeSetOld_Utf8Normalize. * * Results: - * TRUE on success: '*bufOut' contains a NUL terminated buffer. - * If not NULL, '*sizeOut' contains the size of the buffer - * (excluding the NUL terminator) - * FALSE on failure + * See CodeSetOld_Utf8Normalize. * * Side effects: - * '*bufOut' contains the allocated, NUL terminated buffer. + * See CodeSetOld_Utf8Normalize. * *----------------------------------------------------------------------------- */ -static Bool -CodeSetUtf8Normalize(char const *bufIn, // IN - size_t sizeIn, // IN - Bool precomposed, // IN - DynBuf *db) // OUT +Bool +CodeSet_Utf8Normalize(const char *bufIn, // IN + size_t sizeIn, // IN + Bool precomposed, // IN + DynBuf *db) // OUT { - Bool ok = FALSE; - CFStringRef str = NULL; - CFMutableStringRef mutStr = NULL; - CFIndex len, lenMut; - size_t initialSize = DynBuf_GetSize(db); - - str = CFStringCreateWithCString(NULL, - bufIn, - kCFStringEncodingUTF8); - if (str == NULL) { - goto exit; - } - - mutStr = CFStringCreateMutableCopy(NULL, 0, str); - if (mutStr == NULL) { - goto exit; - } - - /* - * Normalize the string, Form C - precomposed or D, not. - */ - CFStringNormalize(mutStr, - (precomposed ? kCFStringNormalizationFormC : - kCFStringNormalizationFormD)); - - /* - * Get the number (in terms of UTF-16 code units) - * of characters in a string. - */ - lenMut = CFStringGetLength(mutStr); - - /* - * Retrieve the maximum number of bytes a string of a - * specified length (in UTF-16 code units) will take up - * if encoded in a specified encoding. - */ - len = CFStringGetMaximumSizeForEncoding(lenMut, - kCFStringEncodingUTF8); - if (len + 1 > initialSize) { - if (DynBuf_Enlarge(db, len + 1 - initialSize) == FALSE) { - ok = FALSE; - goto exit; - } - } - - /* - * Copies the character contents of a string to a local C - * string buffer after converting the characters to UTF-8. - */ - ok = CFStringGetCString(mutStr, - (char *)DynBuf_Get(db), - len + 1, - kCFStringEncodingUTF8); - if (ok) { - /* Remove the NUL terminator that the above includes. */ - DynBuf_SetSize(db, strlen((char *)DynBuf_Get(db))); - } - -exit: - if (str) { - CFRelease(str); - } - if (mutStr) { - CFRelease(mutStr); - } - - return ok; + return CodeSetOld_Utf8Normalize(bufIn, sizeIn, precomposed, db); } -#endif /* defined(__APPLE__) */ - -/* - * Linux-specific remarks: - * - * We use UTF-16 instead of UCS-2, because Windows 2000 introduces support - * for basic input, output, and simple sorting of surrogates. - * - * We use UTF-16LE instead of UTF-16 so that iconv() does not prepend a BOM. - * - * --hpreg - */ +#endif /* defined(__APPLE__) */ /* @@ -640,15 +565,14 @@ exit: * * CodeSet_GetCurrentCodeSet -- * - * Return currently active code set - always UTF-8 on Apple (and old Linux), - * and reported by nl_langinfo on Linux & Solaris. + * Return native code set name. Always calls down to + * CodeSetOld_GetCurrentCodeSet. See there for more details. * * Results: - * The name of the current code set on success - * + * See CodeSetOld_GetCurrentCodeSet. * * Side effects: - * None + * See CodeSetOld_GetCurrentCodeSet. * *----------------------------------------------------------------------------- */ @@ -656,93 +580,266 @@ exit: const char * CodeSet_GetCurrentCodeSet(void) { -#if defined(CURRENT_IS_UTF8) - /* - * This code is used in - * 1. tools which need to support older glibc versions in which - * internationalization functions are not available. - * 2. Mac OS which we always assume UTF-8 - * On such systems we revert to the original behaviour of this code which - * simply copies the input buffer into the output. - */ - - return "UTF-8"; -#elif defined(_WIN32) - static char ret[20]; // max is "windows-4294967296" - - Str_Sprintf(ret, sizeof(ret), "windows-%u", GetACP()); - - return ret; -#else - return nl_langinfo(CODESET); -#endif + return CodeSetOld_GetCurrentCodeSet(); } -#if defined(USE_ICONV) - /* *----------------------------------------------------------------------------- * - * CodeSetIconvOpen -- + * CodeSet_GenericToGenericDb -- * - * Open iconv translator with requested flags. Currently only no flags, - * and both CSGTG_TRANSLIT and CSGTG_IGNORE together are supported, as - * this is only thing we need. If translit/ignore convertor fails, - * then non-transliterating conversion is used. + * Append the content of a buffer (that uses the specified encoding) to a + * DynBuf (that uses the specified encoding). * * Results: - * (iconv_t)-1 on failure - * iconv handle on success + * TRUE on success + * FALSE on failure * * Side effects: - * None. + * String (sans NUL-termination) is appended to db. * *----------------------------------------------------------------------------- */ -static INLINE_SINGLE_CALLER iconv_t -CodeSetIconvOpen(const char *codeIn, // IN - const char *codeOut, // IN - unsigned int flags) // IN -{ -#ifdef __linux__ - if (flags) { - char *codeOutExt; +Bool +CodeSet_GenericToGenericDb(const char *codeIn, // IN + const char *bufIn, // IN + size_t sizeIn, // IN + const char *codeOut, // IN + unsigned int flags, // IN + DynBuf *db) // IN/OUT +{ + Bool result = FALSE; + UErrorCode uerr; + char *bufInCur; + char *bufInEnd; + DynBuf dbpiv; + UChar *bufPiv; + UChar *bufPivCur; + UChar *bufPivEnd; + char *bufOut; + char *bufOutCur; + char *bufOutEnd; + size_t bufPivSize; + size_t bufPivOffset; + size_t bufOutSize; + size_t bufOutOffset; + UConverter *cvin = NULL; + UConverter *cvout = NULL; + UConverterToUCallback toUCb; + UConverterFromUCallback fromUCb; + + ASSERT(codeIn); + ASSERT(sizeIn == 0 || bufIn); + ASSERT(codeOut); + ASSERT(db); + ASSERT((CSGTG_NORMAL == flags) || (CSGTG_TRANSLIT == flags) || + (CSGTG_IGNORE == flags)); + + if (dontUseIcu) { + /* + * Fall back. + */ + return CodeSetOld_GenericToGenericDb(codeIn, bufIn, sizeIn, codeOut, + flags, db); + } + + DynBuf_Init(&dbpiv); + + /* + * Trivial case. + */ + if ((0 == sizeIn) || (NULL == bufIn)) { + result = TRUE; + goto exit; + } + + /* + * Open converters. + */ + uerr = U_ZERO_ERROR; + cvin = ucnv_open(codeIn, &uerr); + if (!cvin) { + goto exit; + } + + uerr = U_ZERO_ERROR; + cvout = ucnv_open(codeOut, &uerr); + if (!cvout) { + goto exit; + } + + /* + * Set callbacks according to flags. + */ + switch (flags) { + case CSGTG_NORMAL: + toUCb = UCNV_TO_U_CALLBACK_STOP; + fromUCb = UCNV_FROM_U_CALLBACK_STOP; + break; + + case CSGTG_TRANSLIT: + toUCb = UCNV_TO_U_CALLBACK_SUBSTITUTE; + fromUCb = UCNV_FROM_U_CALLBACK_SUBSTITUTE; + break; + + case CSGTG_IGNORE: + toUCb = UCNV_TO_U_CALLBACK_SKIP; + fromUCb = UCNV_FROM_U_CALLBACK_SKIP; + break; + + default: + NOT_IMPLEMENTED(); + break; + } + + uerr = U_ZERO_ERROR; + ucnv_setToUCallBack(cvin, toUCb, NULL, NULL, NULL, &uerr); + if (U_ZERO_ERROR != uerr) { + goto exit; + } + + uerr = U_ZERO_ERROR; + ucnv_setFromUCallBack(cvout, fromUCb, NULL, NULL, NULL, &uerr); + if (U_ZERO_ERROR != uerr) { + goto exit; + } + + /* + * Convert to pivot buffer. As a starting guess, allocate a pivot + * buffer the size of the input string times UChar size (with a + * fudge constant added in to avoid degen cases). + */ + bufInCur = (char *) bufIn; + bufInEnd = (char *) bufIn + sizeIn; + bufPivSize = (sizeIn + 4) * sizeof(UChar); + bufPivOffset = 0; + + while (TRUE) { + if (!DynBuf_Enlarge(&dbpiv, bufPivSize * sizeof(UChar))) { + goto exit; + } + + bufPiv = (UChar *) DynBuf_Get(&dbpiv); + bufPivCur = bufPiv + bufPivOffset; + bufPivEnd = bufPiv + bufPivSize; + + uerr = U_ZERO_ERROR; + ucnv_toUnicode(cvin, &bufPivCur, bufPivEnd, (const char **) &bufInCur, + bufInEnd, NULL, TRUE, &uerr); + + if (U_BUFFER_OVERFLOW_ERROR == uerr) { + /* + * 'bufInCur' points to the next chunk of input string to + * convert, so we leave it alone. 'bufPivCur' points to right + * after the last UChar written, so it should be at or almost + * at the end of the buffer. + * + * Our guess at 'bufPivSize' was obviously wrong, just double + * the buffer. + */ + bufPivSize *= 2; + bufPivOffset = bufPivCur - bufPiv; + } else if (U_FAILURE(uerr)) { + /* + * Failure. + */ + goto exit; + } else { + /* + * Success. + */ + break; + } + } + + /* + * Convert from pivot buffer. Since we're probably most likely + * converting to UTF-8, a safe guess for the byte size of the + * output buffer would be the same number of code units as in the + * pivot buffer (with a fudge constant added to avoid degen cases). + */ + bufPivEnd = bufPivCur; + bufPivCur = bufPiv; + bufPivSize = bufPivEnd - bufPivCur; + bufOutSize = bufPivSize + 4; + bufOutOffset = 0; + + while (TRUE) { + if (!DynBuf_Enlarge(db, bufOutSize)) { + goto exit; + } + + bufOut = (char *) DynBuf_Get(db); + bufOutCur = bufOut + bufOutOffset; + bufOutEnd = bufOut + bufOutSize; + + uerr = U_ZERO_ERROR; + ucnv_fromUnicode(cvout, &bufOutCur, bufOutEnd, + (const UChar **) &bufPivCur, bufPivEnd, NULL, TRUE, + &uerr); + + if (U_BUFFER_OVERFLOW_ERROR == uerr) { + /* + * 'bufPivCur' points to the next chunk of pivot string to + * convert, so we leave it alone. 'bufOutCur' points to right + * after the last unit written, so it should be at or almost + * at the end of the buffer. + * + * Our guess at 'bufOutSize' was obviously wrong, just double + * the buffer. + */ + bufOutSize *= 2; + bufOutOffset = bufOutCur - bufOut; + } else if (U_FAILURE(uerr)) { + /* + * Failure. + */ + goto exit; + } else { + /* + * "This was a triumph. + * I'm making a note here: + * HUGE SUCCESS. + * It's hard to overstate + * my satisfaction." + */ + break; + } + } + + /* + * Set final size and return. + */ + DynBuf_SetSize(db, bufOutCur - bufOut); - ASSERT(flags == (CSGTG_TRANSLIT | CSGTG_IGNORE)); - /* - * We should be using //TRANSLIT,IGNORE, but glibc versions older than - * 2.3.4 (in particular, the version that ships with redhat linux 9.0) - * are subtly broken when passing options with a comma, in such a way - * that iconv_open will succeed but iconv_close can crash. For now, we - * only use TRANSLIT and bail out after the first non-translitible - * character. - */ - codeOutExt = Str_Asprintf(NULL, "%s//TRANSLIT", codeOut); - if (codeOutExt) { - iconv_t cd = iconv_open(codeOutExt, codeIn); - free(codeOutExt); - if (cd != (iconv_t)-1) { - return cd; - } - } + result = TRUE; + + exit: + DynBuf_Destroy(&dbpiv); + + if (cvin) { + ucnv_close(cvin); } -#endif - return iconv_open(codeOut, codeIn); + + if (cvout) { + ucnv_close(cvout); + } + + return result; } /* *----------------------------------------------------------------------------- * - * CodeSetGenericToGeneric -- + * CodeSet_GenericToGeneric -- * - * Append the content of a buffer (that uses the specified encoding) to a - * DynBuf (that uses the specified encoding). --hpreg + * Non-db version of CodeSet_GenericToGenericDb. * * Results: - * TRUE on success + * TRUE on success, plus allocated string * FALSE on failure * * Side effects: @@ -751,117 +848,22 @@ CodeSetIconvOpen(const char *codeIn, // IN *----------------------------------------------------------------------------- */ -static Bool -CodeSetGenericToGeneric(char const *codeIn, // IN - char const *bufIn, // IN - size_t sizeIn, // IN - char const *codeOut, // IN - DynBuf *db, // IN/OUT - size_t flags) // IN +Bool +CodeSet_GenericToGeneric(const char *codeIn, // IN + const char *bufIn, // IN + size_t sizeIn, // IN + const char *codeOut, // IN + unsigned int flags, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { - iconv_t cd; - - ASSERT(codeIn); - ASSERT(sizeIn == 0 || bufIn); - ASSERT(codeOut); - ASSERT(db); - - cd = CodeSetIconvOpen(codeIn, codeOut, flags); - if (cd == (iconv_t)-1) { - return FALSE; - } - - for (;;) { - size_t size; - char *out; - char *outOrig; - size_t outLeft; - size_t status; - - /* - * Every character we care about can occupy at most - * 4 bytes - UCS-4 is 4 bytes, UTF-16 is 2+2 bytes, - * and UTF-8 is also at most 4 bytes for all - * characters under 0x1FFFFF. - * - * If we allocate too small buffer nothing critical - * happens except that in //IGNORE case some - * implementations might return EILSEQ instead of - * E2BIG. By having at least 4 bytes available we - * can be sure that at least one character is - * converted each call to iconv(). - */ - size = DynBuf_GetSize(db); - if (DynBuf_Enlarge(db, size + 4) == FALSE) { - goto error; - } - - out = (int8 *)DynBuf_Get(db) + size; - outOrig = out; - outLeft = DynBuf_GetAllocatedSize(db) - size; - - /* - * From glibc 2.2 onward bufIn is no longer const due to a change - * in the standard. However, the implementation of iconv doesn't - * change bufIn so a simple cast is safe. --plangdale - */ -#if defined(GLIBC_VERSION_22) - status = iconv(cd, (char **)&bufIn, &sizeIn, &out, &outLeft); -#else - status = iconv(cd, &bufIn, &sizeIn, &out, &outLeft); -#endif - - DynBuf_SetSize(db, size + out - outOrig); - - /* - * If all input characters were consumed, we are done. - * Otherwise if at least one character was produced by conversion - * then just increase buffer size and try again - with //IGNORE - * iconv() returns an error (EILSEQ) but still processes as - * many characters as possible. If no characters were produced, - * then consult error code - do not consult return value in other - * cases, it can be either random positive value (if some - * characters were transliterated) or even -1 with errno set to - * EILSEQ (if some characters were ignored). - */ - if (sizeIn == 0) { - break; - } - if (out == outOrig) { - if (status != -1) { - goto error; - } - /* - * Some libc implementations (one on ESX3, and one on Ganesh's - * box) silently ignore //IGNORE. So if caller asked for - * getting conversion done at any cost, just return success - * even if failure occured. User will get truncated - * message, but that's our best. We have no idea whether - * incoming encoding is 8bit, 16bit, or what, so we cannot - * skip over characters in input stream and recover :-( - */ - if ((flags & CSGTG_IGNORE) && errno == EILSEQ) { - break; - } - if (errno != E2BIG) { - goto error; - } - } - /* Need a larger buffer --hpreg */ - } - - if (iconv_close(cd) < 0) { - return FALSE; - } - - return TRUE; - -error: - iconv_close(cd); + DynBuf db; + Bool ok; - return FALSE; + DynBuf_Init(&db); + ok = CodeSet_GenericToGenericDb(codeIn, bufIn, sizeIn, codeOut, flags, &db); + return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); } -#endif /* @@ -913,7 +915,7 @@ error: * CodeSet_Utf8ToCurrent -- * * Convert the content of a buffer (that uses the UTF-8 encoding) into - * another buffer (that uses the current encoding) --hpreg + * another buffer (that uses the current encoding). * * Results: * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. @@ -928,110 +930,30 @@ error: */ Bool -CodeSet_Utf8ToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_Utf8ToCurrent(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { -#if defined(CURRENT_IS_UTF8) - return CodeSetDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); -#elif defined(USE_ICONV) +#if !defined(CURRENT_IS_UTF8) DynBuf db; Bool ok; - - DynBuf_Init(&db); - ok = CodeSetGenericToGeneric("UTF-8", bufIn, sizeIn, - CodeSet_GetCurrentCodeSet(), &db, CSGTG_NORMAL); - return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); -#elif defined(_WIN32) - char *buf; - size_t size; - Bool status; - - if (CodeSet_Utf8ToUtf16le(bufIn, sizeIn, &buf, &size) == FALSE) { - if (IsWin95()) { - /* - * Win95 doesnt support UTF-8 by default. If we are here, - * it means that the application was not linked with unicows.lib. - * So simply copy the buffer as is. - */ - return CodeSetDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); - } - return FALSE; - } - - status = CodeSetUtf16leToCurrent(buf, size, bufOut, sizeOut); - free(buf); - - return status; -#else - return FALSE; #endif -} - -/* - *----------------------------------------------------------------------------- - * - * CodeSet_Utf8ToCurrentTranslit -- - * - * Convert the content of a buffer (that uses the UTF-8 encoding) into - * another buffer (that uses the current encoding). Transliterate - * characters which can be transliterated, and ignore characters which - * cannot be even transliterated. - * - * Results: - * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. - * If not NULL, '*sizeOut' contains the size of the buffer - * (excluding the NUL terminator) - * FALSE on failure - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf8ToCurrent(bufIn, sizeIn, bufOut, sizeOut); + } -Bool -CodeSet_Utf8ToCurrentTranslit(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT -{ #if defined(CURRENT_IS_UTF8) - return CodeSetDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); -#elif defined(USE_ICONV) - DynBuf db; - Bool ok; - + return CodeSetDuplicateUtf8Str(bufIn, sizeIn, bufOut, sizeOut); +#else DynBuf_Init(&db); - ok = CodeSetGenericToGeneric("UTF-8", bufIn, sizeIn, - CodeSet_GetCurrentCodeSet(), &db, - CSGTG_TRANSLIT | CSGTG_IGNORE); + ok = CodeSet_GenericToGenericDb("UTF-8", bufIn, sizeIn, + CodeSet_GetCurrentCodeSet(), 0, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); -#elif defined(_WIN32) - char *buf; - size_t size; - Bool status; - - if (CodeSet_Utf8ToUtf16le(bufIn, sizeIn, &buf, &size) == FALSE) { - if (IsWin95()) { - /* - * Win95 doesnt support UTF-8 by default. If we are here, - * it means that the application was not linked with unicows.lib. - * So simply copy the buffer as is. - */ - return CodeSetDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); - } - return FALSE; - } - - status = CodeSetUtf16leToCurrent(buf, size, bufOut, sizeOut); - free(buf); - - return status; -#else - return FALSE; #endif } @@ -1042,7 +964,7 @@ CodeSet_Utf8ToCurrentTranslit(char const *bufIn, // IN * CodeSet_CurrentToUtf8 -- * * Convert the content of a buffer (that uses the current encoding) into - * another buffer (that uses the UTF-8 encoding) --hpreg + * another buffer (that uses the UTF-8 encoding). * * Results: * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. @@ -1057,43 +979,30 @@ CodeSet_Utf8ToCurrentTranslit(char const *bufIn, // IN */ Bool -CodeSet_CurrentToUtf8(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_CurrentToUtf8(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { -#if defined(CURRENT_IS_UTF8) - return CodeSetDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); -#elif defined(USE_ICONV) +#if !defined(CURRENT_IS_UTF8) DynBuf db; Bool ok; +#endif - DynBuf_Init(&db); - ok = CodeSetGenericToGeneric(CodeSet_GetCurrentCodeSet(), bufIn, sizeIn, - "UTF-8", &db, CSGTG_NORMAL); - return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); -#elif defined(_WIN32) - char *buf; - size_t size; - Bool status; - - if (CodeSet_CurrentToUtf16le(bufIn, sizeIn, &buf, &size) == FALSE) { - return FALSE; + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_CurrentToUtf8(bufIn, sizeIn, bufOut, sizeOut); } - status = CodeSet_Utf16leToUtf8(buf, size, bufOut, sizeOut); - free(buf); - if (!status && IsWin95()) { - /* - * Win95 doesnt support UTF-8 by default. If we are here, - * it means that the application was not linked with unicows.lib. - * So simply copy the buffer as is. - */ - return CodeSetDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); - } - return status; +#if defined(CURRENT_IS_UTF8) + return CodeSetDuplicateUtf8Str(bufIn, sizeIn, bufOut, sizeOut); #else - return FALSE; + DynBuf_Init(&db); + ok = CodeSet_GenericToGenericDb(CodeSet_GetCurrentCodeSet(), bufIn, sizeIn, + "UTF-8", 0, &db); + return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); #endif } @@ -1104,7 +1013,7 @@ CodeSet_CurrentToUtf8(char const *bufIn, // IN * CodeSet_Utf16leToUtf8_Db -- * * Append the content of a buffer (that uses the UTF-16LE encoding) to a - * DynBuf (that uses the UTF-8 encoding). --hpreg + * DynBuf (that uses the UTF-8 encoding). * * Results: * TRUE on success @@ -1117,125 +1026,19 @@ CodeSet_CurrentToUtf8(char const *bufIn, // IN */ Bool -CodeSet_Utf16leToUtf8_Db(char const *bufIn, // IN - size_t sizeIn, // IN - DynBuf *db) // IN +CodeSet_Utf16leToUtf8_Db(const char *bufIn, // IN + size_t sizeIn, // IN + DynBuf *db) // IN { -#if defined(_WIN32) - return CodeSetUtf16leToGeneric(bufIn, sizeIn, CP_UTF8, db); -#else - const uint16 *utf16In; - size_t numCodeUnits; - size_t codeUnitIndex; - - if (sizeIn % sizeof *utf16In != 0) { - return FALSE; - } - - utf16In = (const uint16 *)bufIn; - numCodeUnits = sizeIn / 2; - - for (codeUnitIndex = 0; codeUnitIndex < numCodeUnits; codeUnitIndex++) { - uint32 codePoint; - uint8 *dbBytes; - size_t size; - - if ( utf16In[codeUnitIndex] < 0xD800 - || utf16In[codeUnitIndex] > 0xDFFF) { - // Non-surrogate UTF-16 code units directly represent a code point. - codePoint = utf16In[codeUnitIndex]; - } else { - static const uint32 SURROGATE_OFFSET = - (0xD800 << 10UL) + 0xDC00 - 0x10000; - - uint16 surrogateLead = utf16In[codeUnitIndex]; - uint16 surrogateTrail; - - // We need one more code unit for the trailing surrogate. - codeUnitIndex++; - if (codeUnitIndex == numCodeUnits) { - return FALSE; - } - - surrogateTrail = utf16In[codeUnitIndex]; - - // Ensure we have a lead surrogate followed by a trail surrogate. - if ( surrogateLead > 0xDBFF - || surrogateTrail < 0xDC00 - || surrogateTrail > 0xDFFF) { - return FALSE; - } - - /* - * To get a code point between 0x10000 and 0x10FFFF (2^16 to - * (2^21) - 1): - * - * 1) Ensure surrogateLead is in the range [0xD800, 0xDBFF] - * - * 2) Ensure surrogateTrail is in the range [0xDC00, 0xDFFF] - * - * 3) Mask off all but the low 10 bits of lead and shift that - * left 10 bits: ((surrogateLead << 10) - (0xD800 << 10)) - * -> result [0, 0xFFC00] - * - * 4) Add to that the low 10 bits of trail: (surrogateTrail - 0xDC00) - * -> result [0, 0xFFFFF] - * - * 5) Add to that 0x10000: - * -> result [0x10000, 0x10FFFF] - */ - codePoint = ((uint32)surrogateLead << 10UL) + - (uint32)surrogateTrail - SURROGATE_OFFSET; - - ASSERT(codePoint >= 0x10000 && codePoint <= 0x10FFFF); - } - - size = DynBuf_GetSize(db); - - // We'll need at most 4 more bytes for this code point. - if ( DynBuf_GetAllocatedSize(db) < size + 4 - && DynBuf_Enlarge(db, size + 4) == FALSE) { - return FALSE; - } - - dbBytes = (uint8 *)DynBuf_Get(db) + size; - - // Convert the code point to UTF-8. - if (codePoint <= 0x007F) { - // U+0000 - U+007F: 1 byte of UTF-8. - dbBytes[0] = codePoint; - size += 1; - } else if (codePoint <= 0x07FF) { - // U+0080 - U+07FF: 2 bytes of UTF-8. - dbBytes[0] = 0xC0 | (codePoint >> 6); - dbBytes[1] = 0x80 | (codePoint & 0x3F); - size += 2; - } else if (codePoint <= 0xFFFF) { - // U+0800 - U+FFFF: 3 bytes of UTF-8. - dbBytes[0] = 0xE0 | (codePoint >> 12); - dbBytes[1] = 0x80 | ((codePoint >> 6) & 0x3F); - dbBytes[2] = 0x80 | (codePoint & 0x3F); - size += 3; - } else { - /* - * U+10000 - U+10FFFF: 4 bytes of UTF-8. - * - * See the surrogate pair handling block above for the math - * that ensures we're in the range [0x10000, 0x10FFFF] here. - */ - ASSERT(codePoint <= 0x10FFFF); - dbBytes[0] = 0xF0 | (codePoint >> 18); - dbBytes[1] = 0x80 | ((codePoint >> 12) & 0x3F); - dbBytes[2] = 0x80 | ((codePoint >> 6) & 0x3F); - dbBytes[3] = 0x80 | (codePoint & 0x3F); - size += 4; - } - - DynBuf_SetSize(db, size); + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf16leToUtf8_Db(bufIn, sizeIn, db); } - return TRUE; -#endif + return CodeSet_GenericToGenericDb("UTF-16LE", bufIn, sizeIn, "UTF-8", 0, + db); } @@ -1245,7 +1048,7 @@ CodeSet_Utf16leToUtf8_Db(char const *bufIn, // IN * CodeSet_Utf16leToUtf8 -- * * Convert the content of a buffer (that uses the UTF-16LE encoding) into - * another buffer (that uses the UTF-8 encoding). --hpreg + * another buffer (that uses the UTF-8 encoding). * * The operation is inversible (its inverse is CodeSet_Utf8ToUtf16le). * @@ -1262,14 +1065,21 @@ CodeSet_Utf16leToUtf8_Db(char const *bufIn, // IN */ Bool -CodeSet_Utf16leToUtf8(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_Utf16leToUtf8(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { DynBuf db; Bool ok; + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf16leToUtf8(bufIn, sizeIn, bufOut, sizeOut); + } + DynBuf_Init(&db); ok = CodeSet_Utf16leToUtf8_Db(bufIn, sizeIn, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); @@ -1282,7 +1092,7 @@ CodeSet_Utf16leToUtf8(char const *bufIn, // IN * CodeSet_Utf8ToUtf16le -- * * Convert the content of a buffer (that uses the UTF-8 encoding) into - * another buffer (that uses the UTF-16LE encoding). --hpreg + * another buffer (that uses the UTF-16LE encoding). * * The operation is inversible (its inverse is CodeSet_Utf16leToUtf8). * @@ -1299,14 +1109,21 @@ CodeSet_Utf16leToUtf8(char const *bufIn, // IN */ Bool -CodeSet_Utf8ToUtf16le(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_Utf8ToUtf16le(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { DynBuf db; Bool ok; + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf8ToUtf16le(bufIn, sizeIn, bufOut, sizeOut); + } + DynBuf_Init(&db); ok = CodeSetUtf8ToUtf16le(bufIn, sizeIn, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); @@ -1336,16 +1153,23 @@ CodeSet_Utf8ToUtf16le(char const *bufIn, // IN */ Bool -CodeSet_Utf8FormDToUtf8FormC(char const *bufIn, // IN +CodeSet_Utf8FormDToUtf8FormC(const char *bufIn, // IN size_t sizeIn, // IN char **bufOut, // OUT size_t *sizeOut) // OUT { + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf8FormDToUtf8FormC(bufIn, sizeIn, bufOut, sizeOut); + } + #if defined(__APPLE__) DynBuf db; Bool ok; DynBuf_Init(&db); - ok = CodeSetUtf8Normalize(bufIn, sizeIn, TRUE, &db); + ok = CodeSet_Utf8Normalize(bufIn, sizeIn, TRUE, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); #else NOT_IMPLEMENTED(); @@ -1376,16 +1200,23 @@ CodeSet_Utf8FormDToUtf8FormC(char const *bufIn, // IN */ Bool -CodeSet_Utf8FormCToUtf8FormD(char const *bufIn, // IN +CodeSet_Utf8FormCToUtf8FormD(const char *bufIn, // IN size_t sizeIn, // IN char **bufOut, // OUT size_t *sizeOut) // OUT { + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf8FormCToUtf8FormD(bufIn, sizeIn, bufOut, sizeOut); + } + #if defined(__APPLE__) DynBuf db; Bool ok; DynBuf_Init(&db); - ok = CodeSetUtf8Normalize(bufIn, sizeIn, FALSE, &db); + ok = CodeSet_Utf8Normalize(bufIn, sizeIn, FALSE, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); #else NOT_IMPLEMENTED(); @@ -1414,26 +1245,24 @@ CodeSet_Utf8FormCToUtf8FormD(char const *bufIn, // IN */ Bool -CodeSet_CurrentToUtf16le(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_CurrentToUtf16le(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { DynBuf db; Bool ok; + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_CurrentToUtf16le(bufIn, sizeIn, bufOut, sizeOut); + } + DynBuf_Init(&db); -#if defined(CURRENT_IS_UTF8) - ok = CodeSetUtf8ToUtf16le(bufIn, sizeIn, &db); -#elif defined(USE_ICONV) - ok = CodeSetGenericToGeneric(CodeSet_GetCurrentCodeSet(), bufIn, sizeIn, - "UTF-16LE", &db, CSGTG_NORMAL); -#elif defined(_WIN32) - /* XXX We should probably use CP_THREAD_ACP on Windows 2000/XP. */ - ok = CodeSetGenericToUtf16le(CP_ACP, bufIn, sizeIn, &db); -#else - ok = FALSE; -#endif + ok = CodeSet_GenericToGenericDb(CodeSet_GetCurrentCodeSet(), bufIn, sizeIn, + "UTF-16LE", 0, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); } @@ -1459,24 +1288,25 @@ CodeSet_CurrentToUtf16le(char const *bufIn, // IN */ Bool -CodeSet_Utf16leToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_Utf16leToCurrent(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { -#if defined(USE_ICONV) DynBuf db; Bool ok; + /* + * Fallback if necessary. + */ + if (dontUseIcu) { + return CodeSetOld_Utf16leToCurrent(bufIn, sizeIn, bufOut, sizeOut); + } + DynBuf_Init(&db); - ok = CodeSetGenericToGeneric("UTF-16LE", bufIn, sizeIn, - CodeSet_GetCurrentCodeSet(), &db, CSGTG_NORMAL); + ok = CodeSet_GenericToGenericDb("UTF-16LE", bufIn, sizeIn, + CodeSet_GetCurrentCodeSet(), 0, &db); return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); -#elif defined(_WIN32) - return CodeSetUtf16leToCurrent(bufIn, sizeIn, bufOut, sizeOut); -#else // Not Windows or Linux or Solaris - return FALSE; -#endif } @@ -1501,167 +1331,67 @@ CodeSet_Utf16leToCurrent(char const *bufIn, // IN */ Bool -CodeSet_Utf16beToCurrent(char const *bufIn, // IN - size_t sizeIn, // IN - char **bufOut, // OUT - size_t *sizeOut) // OUT +CodeSet_Utf16beToCurrent(const char *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT { -#if defined(USE_ICONV) DynBuf db; Bool ok; - DynBuf_Init(&db); - ok = CodeSetGenericToGeneric("UTF-16BE", bufIn, sizeIn, - CodeSet_GetCurrentCodeSet(), &db, CSGTG_NORMAL); - return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); -#elif defined(_WIN32) - char c; - char *bufIn_dup; - int i; - Bool status = FALSE; - - bufIn_dup = NULL; - - /* sizeIn must be even */ - ASSERT((sizeIn & 1) == 0); - - /* Make a non-const copy */ - bufIn_dup = malloc(sizeIn); - if (bufIn_dup == NULL) { - goto error; - } - memcpy(bufIn_dup, bufIn, sizeIn); - - /* Swap pairs of bytes */ - for (i = 0; i < sizeIn; i += 2) { - c = bufIn_dup[i]; - bufIn_dup[i] = bufIn_dup[i + 1]; - bufIn_dup[i + 1] = c; - } - - status = CodeSetUtf16leToCurrent(bufIn_dup, sizeIn, bufOut, sizeOut); - - error: - free(bufIn_dup); - return status; -#else // Not Windows or Linux or Solaris - return FALSE; -#endif -} - - -#if defined(_WIN32) -/* - *----------------------------------------------------------------------------- - * - * IsWin95 -- - * - * Is the current OS Windows 95? - * - * Results: - * TRUE if this is Win95 - * FALSE if this is not Win95. - * - * Side effects: - * none - * - *----------------------------------------------------------------------------- - */ - -static Bool -IsWin95(void) -{ - OSVERSIONINFOEX osvi; - BOOL bOsVersionInfoEx; - /* - * Try calling GetVersionEx using the OSVERSIONINFOEX structure. - * If that fails, try using the OSVERSIONINFO structure. + * Fallback if necessary. */ - - ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - - if(!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi))) { - /* If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. */ - osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO *) &osvi)) { - return FALSE; - } - } - - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) { - return TRUE; - } + if (dontUseIcu) { + return CodeSetOld_Utf16beToCurrent(bufIn, sizeIn, bufOut, sizeOut); } - return FALSE; + DynBuf_Init(&db); + ok = CodeSet_GenericToGenericDb("UTF-16BE", bufIn, sizeIn, + CodeSet_GetCurrentCodeSet(), 0, &db); + return CodeSetDynBufFinalize(ok, &db, bufOut, sizeOut); } /* *----------------------------------------------------------------------------- * - * GetInvalidCharsFlag -- + * CodeSet_IsEncodingSupported -- * - * The flag MB_ERR_INVALID_CHARS can only be passed to MultiByteToWideChar - * on Win2000 SP4 or later. If it's passed to an NT or 9x system, - * MultiByteToWideChar fails with ERR_INVALID_FLAGS. + * Ask ICU if it supports the specific encoding. * * Results: - * returns MB_ERR_INVALID_CHARS if this flag is supported under current OS - * returns zero if the flag would case MultiByteToWideChar failure. + * TRUE on success + * FALSE on failure * * Side effects: - * none + * None * *----------------------------------------------------------------------------- */ -static DWORD -GetInvalidCharsFlag(void) +Bool +CodeSet_IsEncodingSupported(const char *name) // IN { - static volatile Bool bFirstCall = TRUE; - static DWORD retval; - - OSVERSIONINFOEX osvi; - BOOL bOsVersionInfoEx; - - if (!bFirstCall) { // We can return a cached result for subsequent calls - return retval; - } + UConverter *cv; + UErrorCode uerr; /* - * Try calling GetVersionEx using the OSVERSIONINFOEX structure. + * Fallback if necessary. */ - - ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - - if(!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) { - /* - * If GetVersionEx failed, we are running something earlier than NT4+SP6, - * thus we cannot use MB_ERR_INVALID_CHARS - */ - retval = 0; - bFirstCall = FALSE; - return retval; + if (dontUseIcu) { + return CodeSetOld_IsEncodingSupported(name); } - if (osvi.dwMajorVersion > 5) { - retval = MB_ERR_INVALID_CHARS; // Vista or later - } else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion > 0) { - retval = MB_ERR_INVALID_CHARS; // XP, 2003 - } else if (osvi.dwMajorVersion == 5 - && osvi.dwMinorVersion == 0 - && osvi.wServicePackMajor >= 4) { // Win2000 + SP4 - retval = MB_ERR_INVALID_CHARS; - } else { - retval = 0; // Do not use MB_ERR_INVALID_CHARS on this OS. + /* + * Try to open the encoding. + */ + uerr = U_ZERO_ERROR; + cv = ucnv_open(name, &uerr); + if (cv) { + ucnv_close(cv); + return TRUE; } - bFirstCall = FALSE; - return retval; + return FALSE; } -#endif diff --git a/open-vm-tools/lib/misc/codesetOld.c b/open-vm-tools/lib/misc/codesetOld.c new file mode 100644 index 000000000..cdb969ee6 --- /dev/null +++ b/open-vm-tools/lib/misc/codesetOld.c @@ -0,0 +1,1891 @@ +/********************************************************* + * Copyright (C) 1998 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 + * by the Free Software Foundation version 2.1 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + *********************************************************/ + +/* + * codesetOld.c -- + * + * The old codeset implementation that depends on system libraries. + * Used for fallback if ICU isn't available. + */ + + +/* + * Windows have their own logic for conversion. On Posix systems with iconv + * available we use iconv. On systems without iconv use simple 1:1 translation + * for UTF8 <-> Current. We also use 1:1 translation also for MacOS's conversion + * between 'current' and 'UTF-8', as MacOS is UTF-8 only. + */ + +#if defined(_WIN32) +# include +# include +# include +#else +# define _GNU_SOURCE +# include +# include +# include +# if !defined(CURRENT_IS_UTF8) +# include +# ifndef LC_CTYPE_MASK // Prior to glibc 2.3 +# define LC_CTYPE_MASK (1 << LC_CTYPE) +# define locale_t __locale_t +# define newlocale __newlocale +# define freelocale __freelocale +# define nl_langinfo_l __nl_langinfo_l +# endif +# if !defined(N_PLAT_NLM) && !defined(__FreeBSD__) +# define USE_ICONV +# include +# include +# include +# endif +# endif +#endif + +#if defined(__APPLE__) +# include /* for CFString */ +#endif + +#include "vm_assert.h" +#include "codeset.h" +#include "codesetOld.h" +#include "unicodeTypes.h" +#include "util.h" +#include "str.h" + +#define CSGTG_NORMAL 0x0000 /* Without any information loss. */ +#define CSGTG_TRANSLIT 0x0001 /* Transliterate unknown characters. */ +#define CSGTG_IGNORE 0x0002 /* Skip over untranslatable characters. */ + +#if defined(__FreeBSD__) || defined(sun) || defined(VMX86_SERVER) +static const char nul[] = {'\0', '\0'}; +#else +static const wchar_t nul = L'\0'; +#endif + + +#if defined(CURRENT_IS_UTF8) || defined(_WIN32) +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldDuplicateStr -- + * + * Duplicate input string, appending zero terminator to its end. Only + * used on Windows and on platforms where current encoding is always + * UTF-8, on other iconv-capable platforms we just use iconv even for + * UTF-8 to UTF-8 translation. Note that this function is more like + * memdup() than strdup(), so it can be used for duplicating UTF-16 + * strings as well - string is always terminated by wide character NUL, + * which is supposed to be longest NUL character occuring on specified + * host. + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static Bool +CodeSetOldDuplicateStr(const char *bufIn, // IN: Input string + size_t sizeIn, // IN: Input string length + char **bufOut, // OUT: "Converted" string + size_t *sizeOut) // OUT: Length of string +{ + char *myBufOut; + + myBufOut = malloc(sizeIn + sizeof nul); + if (myBufOut == NULL) { + return FALSE; + } + + memcpy(myBufOut, bufIn, sizeIn); + memset(myBufOut + sizeIn, 0, sizeof nul); + + *bufOut = myBufOut; + if (sizeOut) { + *sizeOut = sizeIn; + } + return TRUE; +} +#endif + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldDynBufFinalize -- + * + * Append NUL terminator to the buffer, and return pointer to buffer + * and its data size (before appending terminator). Destroys buffer + * on failure. + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static Bool +CodeSetOldDynBufFinalize(Bool ok, // IN: Earlier steps succeeded + DynBuf *db, // IN: Buffer with converted string + char **bufOut, // OUT: Converted string + size_t *sizeOut) // OUT: Length of string in bytes +{ + if (!ok || !DynBuf_Append(db, &nul, sizeof nul) || !DynBuf_Trim(db)) { + DynBuf_Destroy(db); + return FALSE; + } + + *bufOut = DynBuf_Get(db); + if (sizeOut) { + *sizeOut = DynBuf_GetSize(db) - sizeof nul; + } + return TRUE; +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldUtf8ToUtf16le -- + * + * Append the content of a buffer (that uses the UTF-8 encoding) to a + * DynBuf (that uses the UTF-16LE encoding) + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static Bool +CodeSetOldUtf8ToUtf16le(const char *bufIn, // IN + size_t sizeIn, // IN + DynBuf *db) // IN +{ + size_t currentSize; + size_t allocatedSize; + uint16 *buf; + + currentSize = DynBuf_GetSize(db); + allocatedSize = DynBuf_GetAllocatedSize(db); + buf = (uint16 *)((char *)DynBuf_Get(db) + currentSize); + while (sizeIn--) { + unsigned int uniChar = *bufIn++ & 0xFF; + size_t neededSize; + + if (uniChar >= 0x80) { + size_t charLen; + size_t idx; + + if (uniChar < 0xC2) { + /* 80-BF cannot start UTF8 sequence. C0-C1 cannot appear in UTF8 stream at all. */ + return FALSE; + } else if (uniChar < 0xE0) { + uniChar -= 0xC0; + charLen = 1; + } else if (uniChar < 0xF0) { + uniChar -= 0xE0; + charLen = 2; + } else if (uniChar < 0xF8) { + uniChar -= 0xF0; + charLen = 3; + } else if (uniChar < 0xFC) { + uniChar -= 0xF8; + charLen = 4; + } else if (uniChar < 0xFE) { + uniChar -= 0xFC; + charLen = 5; + } else { + return FALSE; + } + if (sizeIn < charLen) { + return FALSE; + } + for (idx = 0; idx < charLen; idx++) { + unsigned int nextChar; + + nextChar = *bufIn++ & 0xFF; + if (nextChar < 0x80 || nextChar >= 0xC0) { + return FALSE; + } + uniChar = (uniChar << 6) + nextChar - 0x80; + sizeIn--; + } + + /* + * Shorter encoding available. UTF-8 mandates that shortest possible encoding + * is used, as otherwise doing UTF-8 => anything => UTF-8 could bypass some + * important tests, like '/' for path separator or \0 for string termination. + * + * This test is not correct for charLen == 1, as its disallowed range is + * 0x00-0x7F, while this test disallows only 0x00-0x3F. But this part of + * problem is solved by stopping when 0xC1 is encountered, as 0xC1 0xXX + * describes just this range. This also means that 0xC0 and 0xC1 cannot + * ever occur in valid UTF-8 string. + */ + if (uniChar < 1U << (charLen * 5 + 1)) { + return FALSE; + } + } + + /* + * Here we have UCS-4 character in uniChar, between 0 and 0x7FFFFFFF. + * Let's convert it to UTF-16. + */ + + /* Non-paired surrogates are illegal in UTF-16. */ + if (uniChar >= 0xD800 && uniChar < 0xE000) { + return FALSE; + } + if (uniChar < 0x10000) { + neededSize = currentSize + sizeof *buf; + } else if (uniChar < 0x110000) { + neededSize = currentSize + 2 * sizeof *buf; + } else { + /* This character cannot be represented in UTF-16. */ + return FALSE; + } + if (allocatedSize < neededSize) { + if (DynBuf_Enlarge(db, neededSize) == FALSE) { + return FALSE; + } + allocatedSize = DynBuf_GetAllocatedSize(db); + ASSERT(neededSize <= allocatedSize); + buf = (uint16 *)((char *)DynBuf_Get(db) + currentSize); + } + if (uniChar < 0x10000) { + *buf++ = uniChar; + } else { + *buf++ = 0xD800 + ((uniChar - 0x10000) >> 10); + *buf++ = 0xDC00 + ((uniChar - 0x10000) & 0x3FF); + } + currentSize = neededSize; + } + /* All went fine, update buffer size. */ + DynBuf_SetSize(db, currentSize); + return TRUE; +} + + +#if defined(_WIN32) + +static Bool IsWin95(void); +static DWORD GetInvalidCharsFlag(void); + +/* + * Win32-specific remarks: here is my understanding of those terms as of + * 2002/02/12: + * + * ANSI code page + * The character set used internally by Windows applications (when they are + * not fully Unicode). + * + * OEM code page + * The character set used by MS-DOS and stored in the FAT filesystem. + * + * --hpreg + */ + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldGenericToUtf16le -- + * + * Append the content of a buffer (that uses the specified encoding) to a + * DynBuf (that uses the UTF-16LE encoding) --hpreg + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static Bool +CodeSetOldGenericToUtf16le(UINT codeIn, // IN + char const *bufIn, // IN + size_t sizeIn, // IN + DynBuf *db) // IN +{ + /* + * Undocumented: calling MultiByteToWideChar() with sizeIn == 0 returns 0 + * with GetLastError() set to ERROR_INVALID_PARAMETER. Isn't this API + * robust? --hpreg + */ + if (sizeIn) { + size_t initialSize; + DWORD flags = GetInvalidCharsFlag(); + Bool invalidCharsCheck = ((flags & MB_ERR_INVALID_CHARS) != 0); + + initialSize = DynBuf_GetSize(db); + for (;;) { + int result; + int resultReverse; + DWORD error = ERROR_SUCCESS; + + if (DynBuf_Enlarge(db, sizeof(wchar_t)) == FALSE) { + return FALSE; + } + + /* + * Must fail if bufIn has any invalid characters. + * So MB_ERR_INVALID_CHARS added, otherwise can + * lead to security issues see bug 154114. + */ + result = MultiByteToWideChar(codeIn, + flags, + bufIn, + sizeIn, + (wchar_t *)((char *)DynBuf_Get(db) + initialSize), + (DynBuf_GetAllocatedSize(db) - initialSize) / + sizeof(wchar_t)); + + if (0 == result) { + error = GetLastError(); // may be ERROR_NO_UNICODE_TRANSLATION + } + + /* + * Success if: result is > 0 and is the same number + * of characters as the input string contains. If there + * are any invalid characters, the Win2K SP4 or later will + * fail, but for earlier OS versions, these invalid characters + * will be dropped. Thus only succeed if we have no dropped + * characters. + * For the older platforms which don't fail for invalid characters + * we see if the reverse conversion of the converted string + * yields the same string size that was passed in. + * If not, then dropped characters so fail. + */ + if (!invalidCharsCheck) { + resultReverse = WideCharToMultiByte(codeIn, 0, + (wchar_t *)((char *)DynBuf_Get(db) + initialSize), + result, NULL, 0, 0, 0); + } + if (result > 0 && + (invalidCharsCheck || + (sizeIn == resultReverse))) { + DynBuf_SetSize(db, initialSize + result * sizeof(wchar_t)); + break; + } + + if (result > 0 && (!invalidCharsCheck && sizeIn != resultReverse)) { + return FALSE; + } + + ASSERT(result == 0); + + if (error != ERROR_INSUFFICIENT_BUFFER) { + return FALSE; + } + + /* Need a larger buffer --hpreg */ + } + } + + return TRUE; +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldUtf16leToGeneric -- + * + * Append the content of a buffer (that uses the UTF-16LE encoding) to a + * DynBuf (that uses the specified encoding) --hpreg + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static Bool +CodeSetOldUtf16leToGeneric(char const *bufIn, // IN + size_t sizeIn, // IN + UINT codeOut, // IN + DynBuf *db) // IN +{ + /* + * Undocumented: calling WideCharToMultiByte() with sizeIn == 0 returns 0 + * with GetLastError() set to ERROR_INVALID_PARAMETER. Isn't this API + * robust? --hpreg + */ + if (sizeIn) { + size_t initialSize; + + initialSize = DynBuf_GetSize(db); + for (;;) { + int result; + DWORD error; + + if (DynBuf_Enlarge(db, 1) == FALSE) { + return FALSE; + } + + result = WideCharToMultiByte(codeOut, + 0, + (wchar_t const *)bufIn, + sizeIn / sizeof(wchar_t), + (char *)DynBuf_Get(db) + initialSize, + DynBuf_GetAllocatedSize(db) - initialSize, + NULL, + /* + * XXX We may need to pass that argument + * to know when the conversion was + * not possible --hpreg + */ + NULL); + if (result > 0) { + DynBuf_SetSize(db, initialSize + result); + break; + } + + ASSERT(result == 0); + + /* Must come first --hpreg */ + error = GetLastError(); + + if (error != ERROR_INSUFFICIENT_BUFFER) { + return FALSE; + } + + /* Need a larger buffer --hpreg */ + } + } + + /* + * Undocumented: if the input buffer is not NUL-terminated, the output + * buffer will not be NUL-terminated either --hpreg + */ + return TRUE; +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldUtf16leToCurrent -- + * + * Convert the content of a buffer (that uses the UTF-16LE encoding) into + * another buffer (that uses the current encoding) --hpreg + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static Bool +CodeSetOldUtf16leToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + /* XXX We should probably use CP_THREAD_ACP on Windows 2000/XP --hpreg */ + ok = CodeSetOldUtf16leToGeneric(bufIn, sizeIn, CP_ACP, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +} +#endif + + +#if defined(__APPLE__) +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf8Normalize -- + * + * Convert the content of a buffer (that uses the UTF-8 encoding) into + * another buffer (that uses the UTF-8 encoding) that is in precomposed + (Normalization Form C) or decomposed (Normalization Form D). + * + * Results: + * TRUE on success: '*bufOut' contains a NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * '*bufOut' contains the allocated, NUL terminated buffer. + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf8Normalize(char const *bufIn, // IN + size_t sizeIn, // IN + Bool precomposed, // IN + DynBuf *db) // OUT +{ + Bool ok = FALSE; + CFStringRef str = NULL; + CFMutableStringRef mutStr = NULL; + CFIndex len, lenMut; + size_t initialSize = DynBuf_GetSize(db); + + str = CFStringCreateWithCString(NULL, + bufIn, + kCFStringEncodingUTF8); + if (str == NULL) { + goto exit; + } + + mutStr = CFStringCreateMutableCopy(NULL, 0, str); + if (mutStr == NULL) { + goto exit; + } + + /* + * Normalize the string, Form C - precomposed or D, not. + */ + CFStringNormalize(mutStr, + (precomposed ? kCFStringNormalizationFormC : + kCFStringNormalizationFormD)); + + /* + * Get the number (in terms of UTF-16 code units) + * of characters in a string. + */ + lenMut = CFStringGetLength(mutStr); + + /* + * Retrieve the maximum number of bytes a string of a + * specified length (in UTF-16 code units) will take up + * if encoded in a specified encoding. + */ + len = CFStringGetMaximumSizeForEncoding(lenMut, + kCFStringEncodingUTF8); + if (len + 1 > initialSize) { + if (DynBuf_Enlarge(db, len + 1 - initialSize) == FALSE) { + ok = FALSE; + goto exit; + } + } + + /* + * Copies the character contents of a string to a local C + * string buffer after converting the characters to UTF-8. + */ + ok = CFStringGetCString(mutStr, + (char *)DynBuf_Get(db), + len + 1, + kCFStringEncodingUTF8); + if (ok) { + /* Remove the NUL terminator that the above includes. */ + DynBuf_SetSize(db, strlen((char *)DynBuf_Get(db))); + } + +exit: + if (str) { + CFRelease(str); + } + if (mutStr) { + CFRelease(mutStr); + } + + return ok; +} +#endif /* defined(__APPLE__) */ + + +/* + * Linux-specific remarks: + * + * We use UTF-16 instead of UCS-2, because Windows 2000 introduces support + * for basic input, output, and simple sorting of surrogates. + * + * We use UTF-16LE instead of UTF-16 so that iconv() does not prepend a BOM. + * + * --hpreg + */ + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_GetCurrentCodeSet -- + * + * Return native code set name - always "UTF-8" on Apple, FreeBSD, + * old Linux, and ESX. Obtained from GetACP on Windows and + * nl_langinfo on Linux, Solaris, etc. On first invocation + * initialize a cache with the code set name. + * + * Results: + * + * The name of the current code set on success. On systems that + * use iconv the return value depends on how LC_CTYPE is set in the + * locale, even if setlocale has not been previously called. + * + * Side effects: + * + * During first invocation may briefly set and restore locale on + * some systems, which is not thread-safe. + * + *----------------------------------------------------------------------------- + */ + +const char * +CodeSetOld_GetCurrentCodeSet(void) +{ +#if defined(CURRENT_IS_UTF8) + return "UTF-8"; +#elif defined(_WIN32) + static char ret[20]; // max is "windows-4294967296" + if (ret[0] == '\0') { + Str_Sprintf(ret, sizeof(ret), "windows-%u", GetACP()); + } + + return ret; +#elif defined(__linux__) && (defined(GLIBC_VERSION_21) || \ + defined(GLIBC_VERSION_22) || defined(GLIBC_VERSION_23)) + static char *cachedCodeset; + + if (!cachedCodeset) { + locale_t new = newlocale(LC_CTYPE_MASK, "", NULL); + cachedCodeset = Util_SafeStrdup(nl_langinfo_l(CODESET, new)); + freelocale(new); + } + + return cachedCodeset; +#else // Solaris, Netware + static char *cachedCodeset; + + if (!cachedCodeset) { + char *locale; + + locale = setlocale(LC_CTYPE, NULL); + setlocale(LC_CTYPE, ""); + cachedCodeset = Util_SafeStrdup(nl_langinfo(CODESET)); + setlocale(LC_CTYPE, locale); + } + + return cachedCodeset; + +#endif +} + +#if defined(USE_ICONV) + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOldIconvOpen -- + * + * Open iconv translator with requested flags. Currently only no flags, + * and both CSGTG_TRANSLIT and CSGTG_IGNORE together are supported, as + * this is only thing we need. If translit/ignore convertor fails, + * then non-transliterating conversion is used. + * + * Results: + * (iconv_t)-1 on failure + * iconv handle on success + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static INLINE_SINGLE_CALLER iconv_t +CodeSetOldIconvOpen(const char *codeIn, // IN + const char *codeOut, // IN + unsigned int flags) // IN +{ +#ifdef __linux__ + if (flags) { + char *codeOutExt; + + ASSERT(flags == (CSGTG_TRANSLIT | CSGTG_IGNORE)); + /* + * We should be using //TRANSLIT,IGNORE, but glibc versions older than + * 2.3.4 (in particular, the version that ships with redhat linux 9.0) + * are subtly broken when passing options with a comma, in such a way + * that iconv_open will succeed but iconv_close can crash. For now, we + * only use TRANSLIT and bail out after the first non-translitible + * character. + */ + codeOutExt = Str_Asprintf(NULL, "%s//TRANSLIT", codeOut); + if (codeOutExt) { + iconv_t cd = iconv_open(codeOutExt, codeIn); + free(codeOutExt); + if (cd != (iconv_t)-1) { + return cd; + } + } + } +#endif + return iconv_open(codeOut, codeIn); +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_GenericToGenericDb -- + * + * Append the content of a buffer (that uses the specified encoding) to a + * DynBuf (that uses the specified encoding). --hpreg + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_GenericToGenericDb(char const *codeIn, // IN + char const *bufIn, // IN + size_t sizeIn, // IN + char const *codeOut, // IN + unsigned int flags, // IN + DynBuf *db) // IN/OUT +{ + iconv_t cd; + + ASSERT(codeIn); + ASSERT(sizeIn == 0 || bufIn); + ASSERT(codeOut); + ASSERT(db); + + cd = CodeSetOldIconvOpen(codeIn, codeOut, flags); + if (cd == (iconv_t)-1) { + return FALSE; + } + + for (;;) { + size_t size; + char *out; + char *outOrig; + size_t outLeft; + size_t status; + + /* + * Every character we care about can occupy at most + * 4 bytes - UCS-4 is 4 bytes, UTF-16 is 2+2 bytes, + * and UTF-8 is also at most 4 bytes for all + * characters under 0x1FFFFF. + * + * If we allocate too small buffer nothing critical + * happens except that in //IGNORE case some + * implementations might return EILSEQ instead of + * E2BIG. By having at least 4 bytes available we + * can be sure that at least one character is + * converted each call to iconv(). + */ + size = DynBuf_GetSize(db); + if (DynBuf_Enlarge(db, size + 4) == FALSE) { + goto error; + } + + out = (int8 *)DynBuf_Get(db) + size; + outOrig = out; + outLeft = DynBuf_GetAllocatedSize(db) - size; + + /* + * From glibc 2.2 onward bufIn is no longer const due to a change + * in the standard. However, the implementation of iconv doesn't + * change bufIn so a simple cast is safe. --plangdale + */ +#if defined(GLIBC_VERSION_22) + status = iconv(cd, (char **)&bufIn, &sizeIn, &out, &outLeft); +#else + status = iconv(cd, &bufIn, &sizeIn, &out, &outLeft); +#endif + + DynBuf_SetSize(db, size + out - outOrig); + + /* + * If all input characters were consumed, we are done. + * Otherwise if at least one character was produced by conversion + * then just increase buffer size and try again - with //IGNORE + * iconv() returns an error (EILSEQ) but still processes as + * many characters as possible. If no characters were produced, + * then consult error code - do not consult return value in other + * cases, it can be either random positive value (if some + * characters were transliterated) or even -1 with errno set to + * EILSEQ (if some characters were ignored). + */ + if (sizeIn == 0) { + break; + } + if (out == outOrig) { + if (status != -1) { + goto error; + } + /* + * Some libc implementations (one on ESX3, and one on Ganesh's + * box) silently ignore //IGNORE. So if caller asked for + * getting conversion done at any cost, just return success + * even if failure occured. User will get truncated + * message, but that's our best. We have no idea whether + * incoming encoding is 8bit, 16bit, or what, so we cannot + * skip over characters in input stream and recover :-( + */ + if ((flags & CSGTG_IGNORE) && errno == EILSEQ) { + break; + } + if (errno != E2BIG) { + goto error; + } + } + /* Need a larger buffer --hpreg */ + } + + if (iconv_close(cd) < 0) { + return FALSE; + } + + return TRUE; + +error: + iconv_close(cd); + + return FALSE; +} + +#else // USE_ICONV + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_GenericToGenericDb + * + * This non-iconv version can only handle common encodings. + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_GenericToGenericDb(char const *codeIn, // IN + char const *bufIn, // IN + size_t sizeIn, // IN + char const *codeOut, // IN + unsigned int flags, // IN + DynBuf *db) // IN/OUT +{ + Bool ret = FALSE; + StringEncoding encIn = Unicode_EncodingNameToEnum(codeIn); + StringEncoding encOut = Unicode_EncodingNameToEnum(codeOut); + StringEncoding rawCurEnc = Unicode_GetCurrentEncoding(); + char *bufOut = NULL; + size_t sizeOut; + + /* + * Trivial case. + */ + if ((0 == sizeIn) || (NULL == bufIn)) { + ret = TRUE; + goto exit; + } + + /* + * No support for non-default flags. + */ + if (flags != CSGTG_NORMAL) { + goto exit; + } + + if (encIn == encOut) { + if (!DynBuf_Append(db, bufIn, sizeIn)) { + goto exit; + } + } else if (rawCurEnc == encIn) { + if (STRING_ENCODING_UTF8 == encOut) { + if (!CodeSetOld_CurrentToUtf8(bufIn, sizeIn, &bufOut, &sizeOut)) { + goto exit; + } + } else if ((STRING_ENCODING_UTF16 == encOut) || + (STRING_ENCODING_UTF16_LE == encOut)) { + if (!CodeSetOld_CurrentToUtf16le(bufIn, sizeIn, &bufOut, &sizeOut)) { + goto exit; + } + } else { + goto exit; + } + } else if (STRING_ENCODING_UTF8 == encIn) { + if (rawCurEnc == encOut) { + if (!CodeSetOld_Utf8ToCurrent(bufIn, sizeIn, &bufOut, &sizeOut)) { + goto exit; + } + } else if ((STRING_ENCODING_UTF16 == encOut) || + (STRING_ENCODING_UTF16_LE == encOut)) { + if (!CodeSetOldUtf8ToUtf16le(bufIn, sizeIn, db)) { + goto exit; + } + } else { + goto exit; + } + } else if ((STRING_ENCODING_UTF16 == encIn) || + (STRING_ENCODING_UTF16_LE == encIn)) { + if (rawCurEnc == encOut) { + if (!CodeSetOld_Utf16leToCurrent(bufIn, sizeIn, &bufOut, &sizeOut)) { + goto exit; + } + } else if (STRING_ENCODING_UTF8 == encOut) { + if (!CodeSetOld_Utf16leToUtf8_Db(bufIn, sizeIn, db)) { + goto exit; + } + } else { + goto exit; + } + } + + if (bufOut != NULL && !DynBuf_Append(db, bufOut, sizeOut)) { + goto exit; + } + + ret = TRUE; + + exit: + free(bufOut); + return ret; +} + +#endif // USE_ICONV + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_GenericToGeneric -- + * + * Non-db version of CodeSetOld_GenericToGenericDb. + * + * Results: + * TRUE on success, plus allocated string + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_GenericToGeneric(const char *codeIn, // IN + const char *bufIn, // IN + size_t sizeIn, // IN + const char *codeOut, // IN + unsigned int flags, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_GenericToGenericDb(codeIn, bufIn, sizeIn, codeOut, 0, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +} + + +/* + * Generic remarks: here is my understanding of those terms as of 2001/12/27: + * + * BOM + * Byte-Order Mark + * + * BMP + * Basic Multilingual Plane. This plane comprises the first 2^16 code + * positions of ISO/IEC 10646's canonical code space + * + * UCS + * Universal Character Set. Encoding form specified by ISO/IEC 10646 + * + * UCS-2 + * Directly store all Unicode scalar value (code point) from U+0000 to + * U+FFFF on 2 bytes. Consequently, this representation can only hold + * characters in the BMP + * + * UCS-4 + * Directly store a Unicode scalar value (code point) from U-00000000 to + * U-FFFFFFFF on 4 bytes + * + * UTF + * Abbreviation for Unicode (or UCS) Transformation Format + * + * UTF-8 + * Unicode (or UCS) Transformation Format, 8-bit encoding form. UTF-8 is the + * Unicode Transformation Format that serializes a Unicode scalar value + * (code point) as a sequence of 1 to 6 bytes + * + * UTF-16 + * UCS-2 + surrogate mechanism: allow to encode some non-BMP Unicode + * characters in a UCS-2 string, by using 2 2-byte units. See the Unicode + * standard, v2.0 + * + * UTF-32 + * Directly store all Unicode scalar value (code point) from U-00000000 to + * U-0010FFFF on 4 bytes. This is a subset of UCS-4 + * + * --hpreg + */ + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf8ToCurrent -- + * + * Convert the content of a buffer (that uses the UTF-8 encoding) into + * another buffer (that uses the current encoding) --hpreg + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf8ToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(CURRENT_IS_UTF8) + return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); +#elif defined(USE_ICONV) + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_GenericToGenericDb("UTF-8", bufIn, sizeIn, + CodeSetOld_GetCurrentCodeSet(), + 0, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#elif defined(_WIN32) + char *buf; + size_t size; + Bool status; + + if (CodeSetOld_Utf8ToUtf16le(bufIn, sizeIn, &buf, &size) == FALSE) { + if (IsWin95()) { + /* + * Win95 doesnt support UTF-8 by default. If we are here, + * it means that the application was not linked with unicows.lib. + * So simply copy the buffer as is. + */ + return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); + } + return FALSE; + } + + status = CodeSetOldUtf16leToCurrent(buf, size, bufOut, sizeOut); + free(buf); + + return status; +#else + return FALSE; +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf8ToCurrentTranslit -- + * + * Convert the content of a buffer (that uses the UTF-8 encoding) into + * another buffer (that uses the current encoding). Transliterate + * characters which can be transliterated, and ignore characters which + * cannot be even transliterated. + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf8ToCurrentTranslit(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(CURRENT_IS_UTF8) + return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); +#elif defined(USE_ICONV) + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_GenericToGenericDb("UTF-8", bufIn, sizeIn, + CodeSetOld_GetCurrentCodeSet(), + CSGTG_TRANSLIT | CSGTG_IGNORE, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#elif defined(_WIN32) + char *buf; + size_t size; + Bool status; + + if (CodeSetOld_Utf8ToUtf16le(bufIn, sizeIn, &buf, &size) == FALSE) { + if (IsWin95()) { + /* + * Win95 doesnt support UTF-8 by default. If we are here, + * it means that the application was not linked with unicows.lib. + * So simply copy the buffer as is. + */ + return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); + } + return FALSE; + } + + status = CodeSetOldUtf16leToCurrent(buf, size, bufOut, sizeOut); + free(buf); + + return status; +#else + return FALSE; +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_CurrentToUtf8 -- + * + * Convert the content of a buffer (that uses the current encoding) into + * another buffer (that uses the UTF-8 encoding) --hpreg + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_CurrentToUtf8(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(CURRENT_IS_UTF8) + return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); +#elif defined(USE_ICONV) + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_GenericToGenericDb(CodeSetOld_GetCurrentCodeSet(), bufIn, + sizeIn, "UTF-8", 0, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#elif defined(_WIN32) + char *buf; + size_t size; + Bool status; + + if (CodeSetOld_CurrentToUtf16le(bufIn, sizeIn, &buf, &size) == FALSE) { + return FALSE; + } + + status = CodeSetOld_Utf16leToUtf8(buf, size, bufOut, sizeOut); + free(buf); + if (!status && IsWin95()) { + /* + * Win95 doesnt support UTF-8 by default. If we are here, + * it means that the application was not linked with unicows.lib. + * So simply copy the buffer as is. + */ + return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut); + } + return status; +#else + return FALSE; +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf16leToUtf8_Db -- + * + * Append the content of a buffer (that uses the UTF-16LE encoding) to a + * DynBuf (that uses the UTF-8 encoding). --hpreg + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf16leToUtf8_Db(char const *bufIn, // IN + size_t sizeIn, // IN + DynBuf *db) // IN +{ +#if defined(_WIN32) + return CodeSetOldUtf16leToGeneric(bufIn, sizeIn, CP_UTF8, db); +#else + const uint16 *utf16In; + size_t numCodeUnits; + size_t codeUnitIndex; + + if (sizeIn % sizeof *utf16In != 0) { + return FALSE; + } + + utf16In = (const uint16 *)bufIn; + numCodeUnits = sizeIn / 2; + + for (codeUnitIndex = 0; codeUnitIndex < numCodeUnits; codeUnitIndex++) { + uint32 codePoint; + uint8 *dbBytes; + size_t size; + + if ( utf16In[codeUnitIndex] < 0xD800 + || utf16In[codeUnitIndex] > 0xDFFF) { + // Non-surrogate UTF-16 code units directly represent a code point. + codePoint = utf16In[codeUnitIndex]; + } else { + static const uint32 SURROGATE_OFFSET = + (0xD800 << 10UL) + 0xDC00 - 0x10000; + + uint16 surrogateLead = utf16In[codeUnitIndex]; + uint16 surrogateTrail; + + // We need one more code unit for the trailing surrogate. + codeUnitIndex++; + if (codeUnitIndex == numCodeUnits) { + return FALSE; + } + + surrogateTrail = utf16In[codeUnitIndex]; + + // Ensure we have a lead surrogate followed by a trail surrogate. + if ( surrogateLead > 0xDBFF + || surrogateTrail < 0xDC00 + || surrogateTrail > 0xDFFF) { + return FALSE; + } + + /* + * To get a code point between 0x10000 and 0x10FFFF (2^16 to + * (2^21) - 1): + * + * 1) Ensure surrogateLead is in the range [0xD800, 0xDBFF] + * + * 2) Ensure surrogateTrail is in the range [0xDC00, 0xDFFF] + * + * 3) Mask off all but the low 10 bits of lead and shift that + * left 10 bits: ((surrogateLead << 10) - (0xD800 << 10)) + * -> result [0, 0xFFC00] + * + * 4) Add to that the low 10 bits of trail: (surrogateTrail - 0xDC00) + * -> result [0, 0xFFFFF] + * + * 5) Add to that 0x10000: + * -> result [0x10000, 0x10FFFF] + */ + codePoint = ((uint32)surrogateLead << 10UL) + + (uint32)surrogateTrail - SURROGATE_OFFSET; + + ASSERT(codePoint >= 0x10000 && codePoint <= 0x10FFFF); + } + + size = DynBuf_GetSize(db); + + // We'll need at most 4 more bytes for this code point. + if ( DynBuf_GetAllocatedSize(db) < size + 4 + && DynBuf_Enlarge(db, size + 4) == FALSE) { + return FALSE; + } + + dbBytes = (uint8 *)DynBuf_Get(db) + size; + + // Convert the code point to UTF-8. + if (codePoint <= 0x007F) { + // U+0000 - U+007F: 1 byte of UTF-8. + dbBytes[0] = codePoint; + size += 1; + } else if (codePoint <= 0x07FF) { + // U+0080 - U+07FF: 2 bytes of UTF-8. + dbBytes[0] = 0xC0 | (codePoint >> 6); + dbBytes[1] = 0x80 | (codePoint & 0x3F); + size += 2; + } else if (codePoint <= 0xFFFF) { + // U+0800 - U+FFFF: 3 bytes of UTF-8. + dbBytes[0] = 0xE0 | (codePoint >> 12); + dbBytes[1] = 0x80 | ((codePoint >> 6) & 0x3F); + dbBytes[2] = 0x80 | (codePoint & 0x3F); + size += 3; + } else { + /* + * U+10000 - U+10FFFF: 4 bytes of UTF-8. + * + * See the surrogate pair handling block above for the math + * that ensures we're in the range [0x10000, 0x10FFFF] here. + */ + ASSERT(codePoint <= 0x10FFFF); + dbBytes[0] = 0xF0 | (codePoint >> 18); + dbBytes[1] = 0x80 | ((codePoint >> 12) & 0x3F); + dbBytes[2] = 0x80 | ((codePoint >> 6) & 0x3F); + dbBytes[3] = 0x80 | (codePoint & 0x3F); + size += 4; + } + + DynBuf_SetSize(db, size); + } + + return TRUE; +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf16leToUtf8 -- + * + * Convert the content of a buffer (that uses the UTF-16LE encoding) into + * another buffer (that uses the UTF-8 encoding). --hpreg + * + * The operation is inversible (its inverse is CodeSetOld_Utf8ToUtf16le). + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf16leToUtf8(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_Utf16leToUtf8_Db(bufIn, sizeIn, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf8ToUtf16le -- + * + * Convert the content of a buffer (that uses the UTF-8 encoding) into + * another buffer (that uses the UTF-16LE encoding). --hpreg + * + * The operation is inversible (its inverse is CodeSetOld_Utf16leToUtf8). + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf8ToUtf16le(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOldUtf8ToUtf16le(bufIn, sizeIn, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf8FormDToUtf8FormC -- + * + * Convert the content of a buffer (that uses the UTF-8 encoding) + * which is in normal form D (decomposed) into another buffer + * (that uses the UTF-8 encoding) and is normalized as + * precomposed (Normalization Form C). + * + * Results: + * TRUE on success: '*bufOut' contains a NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * '*bufOut' contains the allocated, NUL terminated buffer. + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf8FormDToUtf8FormC(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(__APPLE__) + DynBuf db; + Bool ok; + DynBuf_Init(&db); + ok = CodeSetOld_Utf8Normalize(bufIn, sizeIn, TRUE, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#else + NOT_IMPLEMENTED(); +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf8FormCToUtf8FormD -- + * + * Convert the content of a buffer (that uses the UTF-8 encoding) + * which is in normal form C (precomposed) into another buffer + * (that uses the UTF-8 encoding) and is normalized as + * decomposed (Normalization Form D). + * + * Results: + * TRUE on success: '*bufOut' contains a NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * '*bufOut' contains the allocated, NUL terminated buffer. + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf8FormCToUtf8FormD(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(__APPLE__) + DynBuf db; + Bool ok; + DynBuf_Init(&db); + ok = CodeSetOld_Utf8Normalize(bufIn, sizeIn, FALSE, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#else + NOT_IMPLEMENTED(); +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_CurrentToUtf16le -- + * + * Convert the content of a buffer (that uses the current encoding) into + * another buffer (that uses the UTF-16LE encoding). + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_CurrentToUtf16le(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ + DynBuf db; + Bool ok; + + DynBuf_Init(&db); +#if defined(CURRENT_IS_UTF8) + ok = CodeSetOldUtf8ToUtf16le(bufIn, sizeIn, &db); +#elif defined(USE_ICONV) + ok = CodeSetOld_GenericToGenericDb(CodeSetOld_GetCurrentCodeSet(), bufIn, + sizeIn, "UTF-16LE", 0, &db); +#elif defined(_WIN32) + /* XXX We should probably use CP_THREAD_ACP on Windows 2000/XP. */ + ok = CodeSetOldGenericToUtf16le(CP_ACP, bufIn, sizeIn, &db); +#else + ok = FALSE; +#endif + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf16leToCurrent -- + * + * Convert the content of a buffer (that uses the UTF-16 little endian + * encoding) into another buffer (that uses the current encoding) + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf16leToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(USE_ICONV) + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_GenericToGenericDb("UTF-16LE", bufIn, sizeIn, + CodeSetOld_GetCurrentCodeSet(), 0, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#elif defined(_WIN32) + return CodeSetOldUtf16leToCurrent(bufIn, sizeIn, bufOut, sizeOut); +#else // Not Windows or Linux or Solaris + return FALSE; +#endif +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Utf16beToCurrent -- + * + * Convert the content of a buffer (that uses the UTF-16 big endian + * encoding) into another buffer (that uses the current encoding) + * + * Results: + * TRUE on success: '*bufOut' contains the allocated, NUL terminated buffer. + * If not NULL, '*sizeOut' contains the size of the buffer + * (excluding the NUL terminator) + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Utf16beToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut) // OUT +{ +#if defined(USE_ICONV) + DynBuf db; + Bool ok; + + DynBuf_Init(&db); + ok = CodeSetOld_GenericToGenericDb("UTF-16BE", bufIn, sizeIn, + CodeSetOld_GetCurrentCodeSet(), 0, &db); + return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut); +#elif defined(_WIN32) + char c; + char *bufIn_dup; + int i; + Bool status = FALSE; + + bufIn_dup = NULL; + + /* sizeIn must be even */ + ASSERT((sizeIn & 1) == 0); + + /* Make a non-const copy */ + bufIn_dup = malloc(sizeIn); + if (bufIn_dup == NULL) { + goto error; + } + memcpy(bufIn_dup, bufIn, sizeIn); + + /* Swap pairs of bytes */ + for (i = 0; i < sizeIn; i += 2) { + c = bufIn_dup[i]; + bufIn_dup[i] = bufIn_dup[i + 1]; + bufIn_dup[i + 1] = c; + } + + status = CodeSetOldUtf16leToCurrent(bufIn_dup, sizeIn, bufOut, sizeOut); + + error: + free(bufIn_dup); + return status; +#else // Not Windows or Linux or Solaris + return FALSE; +#endif +} + + +#if defined(_WIN32) +/* + *----------------------------------------------------------------------------- + * + * IsWin95 -- + * + * Is the current OS Windows 95? + * + * Results: + * TRUE if this is Win95 + * FALSE if this is not Win95. + * + * Side effects: + * none + * + *----------------------------------------------------------------------------- + */ + +static Bool +IsWin95(void) +{ + OSVERSIONINFOEX osvi; + BOOL bOsVersionInfoEx; + + /* + * Try calling GetVersionEx using the OSVERSIONINFOEX structure. + * If that fails, try using the OSVERSIONINFO structure. + */ + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if(!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi))) { + /* If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. */ + osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (!GetVersionEx((OSVERSIONINFO *) &osvi)) { + return FALSE; + } + } + + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) { + return TRUE; + } + } + + return FALSE; +} + + +/* + *----------------------------------------------------------------------------- + * + * GetInvalidCharsFlag -- + * + * The flag MB_ERR_INVALID_CHARS can only be passed to MultiByteToWideChar + * on Win2000 SP4 or later. If it's passed to an NT or 9x system, + * MultiByteToWideChar fails with ERR_INVALID_FLAGS. + * + * Results: + * returns MB_ERR_INVALID_CHARS if this flag is supported under current OS + * returns zero if the flag would case MultiByteToWideChar failure. + * + * Side effects: + * none + * + *----------------------------------------------------------------------------- + */ + +static DWORD +GetInvalidCharsFlag(void) +{ + static volatile Bool bFirstCall = TRUE; + static DWORD retval; + + OSVERSIONINFOEX osvi; + BOOL bOsVersionInfoEx; + + if (!bFirstCall) { // We can return a cached result for subsequent calls + return retval; + } + + /* + * Try calling GetVersionEx using the OSVERSIONINFOEX structure. + */ + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if(!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) { + /* + * If GetVersionEx failed, we are running something earlier than NT4+SP6, + * thus we cannot use MB_ERR_INVALID_CHARS + */ + retval = 0; + bFirstCall = FALSE; + return retval; + } + + if (osvi.dwMajorVersion > 5) { + retval = MB_ERR_INVALID_CHARS; // Vista or later + } else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion > 0) { + retval = MB_ERR_INVALID_CHARS; // XP, 2003 + } else if (osvi.dwMajorVersion == 5 + && osvi.dwMinorVersion == 0 + && osvi.wServicePackMajor >= 4) { // Win2000 + SP4 + retval = MB_ERR_INVALID_CHARS; + } else { + retval = 0; // Do not use MB_ERR_INVALID_CHARS on this OS. + } + + bFirstCall = FALSE; + return retval; +} +#endif + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_IsEncodingSupported -- + * + * Not really from the old codeset file, but we need a non-ICU way + * of doing this. Asking lib/unicode to cross-reference the + * encoding name with its internal list is functionally equivalent + * to what Unicode_IsEncodingSupported used to do (and still does + * if no ICU support is built-in). + * + * Results: + * TRUE on success + * FALSE on failure + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_IsEncodingSupported(const char *name) // IN +{ + ASSERT(name); + return (STRING_ENCODING_UNKNOWN != Unicode_EncodingNameToEnum(name)); +} + + +/* + *----------------------------------------------------------------------------- + * + * CodeSetOld_Init -- + * + * No-op. + * + * Results: + * TRUE. + * + * Side effects: + * See above + * + *----------------------------------------------------------------------------- + */ + +Bool +CodeSetOld_Init(void) +{ + return TRUE; +} diff --git a/open-vm-tools/lib/misc/codesetOld.h b/open-vm-tools/lib/misc/codesetOld.h new file mode 100644 index 000000000..56f1553cc --- /dev/null +++ b/open-vm-tools/lib/misc/codesetOld.h @@ -0,0 +1,163 @@ +/********************************************************* + * Copyright (C) 1998 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 + * by the Free Software Foundation version 2.1 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + *********************************************************/ + +/* + * codesetOld.h -- + * + * The old codeset implementation that depends on system libraries. + * Used for fallback if ICU isn't available. + * + */ + +#ifndef __CODESET_OLD_H__ +# define __CODESET_OLD_H__ + +#include "vm_basic_types.h" +#include "vm_assert.h" +#include "dynbuf.h" + +/* + * NO_CORE_ICU is currently only used by oddball Tools builds + * (non-Linux, non-Windows, non-Mac, source). It means "don't compile + * our borrowed ICU source". Even if we don't do that, however, it's + * still possible to use the system ICU libraries if USE_ICU is + * defined (currently only for open-source tools builds. + * + * Since codeset.c is the ICU layer over codesetOld.c, if we are NOT + * using either variety of ICU, then we won't be compiling codeset.c, + * and thus need to transparently convert codeset calls to old codeset + * calls. + */ + +#if defined(NO_CORE_ICU) && !defined(USE_ICU) +#define CodeSetOld_GenericToGenericDb CodeSet_GenericToGenericDb +#define CodeSetOld_GenericToGeneric CodeSet_GenericToGeneric +#define CodeSetOld_Utf8ToCurrent CodeSet_Utf8ToCurrent +#define CodeSetOld_Utf8ToCurrentTranslit CodeSet_Utf8ToCurrentTranslit +#define CodeSetOld_CurrentToUtf8 CodeSet_CurrentToUtf8 +#define CodeSetOld_Utf16leToUtf8_Db CodeSet_Utf16leToUtf8_Db +#define CodeSetOld_Utf16leToUtf8 CodeSet_Utf16leToUtf8 +#define CodeSetOld_Utf8ToUtf16le CodeSet_Utf8ToUtf16le +#define CodeSetOld_CurrentToUtf16le CodeSet_CurrentToUtf16le +#define CodeSetOld_Utf16leToCurrent CodeSet_Utf16leToCurrent +#define CodeSetOld_Utf16beToCurrent CodeSet_Utf16beToCurrent +#define CodeSetOld_Utf8FormDToUtf8FormC CodeSet_Utf8FormDToUtf8FormC +#define CodeSetOld_Utf8FormCToUtf8FormD CodeSet_Utf8FormCToUtf8FormD +#define CodeSetOld_GetCurrentCodeSet CodeSet_GetCurrentCodeSet +#define CodeSetOld_IsEncodingSupported CodeSet_IsEncodingSupported +#define CodeSetOld_Init CodeSet_Init +#endif + +Bool +CodeSetOld_GenericToGenericDb(char const *codeIn, // IN + char const *bufIn, // IN + size_t sizeIn, // IN + char const *codeOut, // IN + unsigned int flags, // IN + DynBuf *db); // IN/OUT + +Bool +CodeSet_OldGenericToGeneric(const char *codeIn, // IN + const char *bufIn, // IN + size_t sizeIn, // IN + const char *codeOut, // IN + unsigned int flags, // IN + char **bufOut, // IN/OUT + size_t *sizeOut); // IN/OUT + +Bool +CodeSetOld_Utf8ToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf8ToCurrentTranslit(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_CurrentToUtf8(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf16leToUtf8_Db(char const *bufIn, // IN + size_t sizeIn, // IN + DynBuf *db); // IN + +Bool +CodeSetOld_Utf16leToUtf8(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf8ToUtf16le(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_CurrentToUtf16le(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf16leToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf16beToCurrent(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf8Normalize(const char *bufIn, // IN + size_t sizeIn, // IN + Bool precomposed, // IN + DynBuf *db); // OUT + +Bool +CodeSetOld_Utf8FormDToUtf8FormC(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +Bool +CodeSetOld_Utf8FormCToUtf8FormD(char const *bufIn, // IN + size_t sizeIn, // IN + char **bufOut, // OUT + size_t *sizeOut); // OUT + +const char * +CodeSetOld_GetCurrentCodeSet(void); + +Bool +CodeSetOld_IsEncodingSupported(const char *name); // IN + +Bool +CodeSetOld_Init(void); + +#endif /* __CODESET_OLD_H__ */ diff --git a/open-vm-tools/lib/misc/posixPosix.c b/open-vm-tools/lib/misc/posixPosix.c index 737393f87..1a45e22be 100644 --- a/open-vm-tools/lib/misc/posixPosix.c +++ b/open-vm-tools/lib/misc/posixPosix.c @@ -43,16 +43,23 @@ #include #include #include +#include #else +#if !defined(N_PLAT_NLM) +#include +#endif #if defined(__FreeBSD__) #include #include #else #if !defined(N_PLAT_NLM) #include +#include #if !defined(sun) #include -#include +#include +#else +#include #endif #endif #endif @@ -74,11 +81,13 @@ #endif -#if !defined(N_PLAT_NLM) && !defined(__FreeBSD__) && !defined(sun) +#if !defined(N_PLAT_NLM) static struct passwd *GetpwInternal(struct passwd *pw); +#if !defined(sun) && !defined(__FreeBSD__) static int GetpwInternal_r(struct passwd *pw, char *buf, size_t size, struct passwd **ppw); #endif +#endif /* @@ -426,7 +435,64 @@ Posix_Utime(ConstUnicode pathName, // IN: } +/* + *---------------------------------------------------------------------- + * + * Posix_Perror -- + * + * POSIX perror() + * + * Results: + * Appends error message corresponding to errno to the passed in string, + * and puts the result on stderr. + * + * Side effects: + * Message printed to stderr. + * + *---------------------------------------------------------------------- + */ + +void +Posix_Perror(ConstUnicode str) // IN: +{ + char *tmpstr = Unicode_GetAllocBytes(str, STRING_ENCODING_DEFAULT); + + perror(tmpstr); + + free(tmpstr); +} + + #if !defined(N_PLAT_NLM) // { +/* + *---------------------------------------------------------------------- + * + * Posix_Pathconf -- + * + * POSIX pathconf() + * + * Results: + * Returns the limit, -1 if limit doesn't exist or on error + * + * Side effects: + * errno is set on error. + * + *---------------------------------------------------------------------- + */ + +long +Posix_Pathconf(ConstUnicode pathName, // IN: + int name) // IN: +{ + char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); + + long ret = pathconf(path, name); + + free(path); + return ret; +} + + /* *---------------------------------------------------------------------- * @@ -765,6 +831,72 @@ exit: return ret; } +/* + *---------------------------------------------------------------------- + * + * Posix_Execlp -- + * + * POSIX execlp(). + * + * Results: + * -1 Error + * 0 Success + * + * Side effects: + * errno is set on error + * + *---------------------------------------------------------------------- + */ + +int +Posix_Execlp(ConstUnicode fileName, // IN: + ConstUnicode arg0, ...) // IN: +{ + int ret = -1; + char *file = Unicode_GetAllocBytes(fileName, STRING_ENCODING_DEFAULT); + va_list vl; + char **argv = NULL; + int i, count = 0; + + if (arg0) { + count = 1; + va_start(vl, arg0); + while (va_arg(vl, char *)) { + count ++; + } + va_end(vl); + } + + argv = (char **) malloc(sizeof(char *) * (count + 1)); + if (argv) { + if (count > 0) { + argv[0] = Unicode_GetAllocBytes(arg0, STRING_ENCODING_DEFAULT); + va_start(vl, arg0); + for (i = 1; i < count; i++) { + argv[i] = Unicode_GetAllocBytes(va_arg(vl, char *), + STRING_ENCODING_DEFAULT); + } + va_end(vl); + } + argv[count] = NULL; + } else { + errno = ENOMEM; + goto exit; + } + + ret = execvp(file, argv); + +exit: + if (argv) { + for (i = 0; i < count; i++) { + free(argv[i]); + } + free(argv); + } + free(file); + return ret; +} + /* *---------------------------------------------------------------------- @@ -790,33 +922,66 @@ Posix_Execv(ConstUnicode pathName, // IN: int ret = -1; char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); char **argv = NULL; - int i, count = 0; if (argVal) { - while (argVal[count]) { - count++; - } - argv = (char **) malloc(sizeof(char *) * (count + 1)); - if (argv) { - for (i = 0; i < count; i++) { - argv[i] = Unicode_GetAllocBytes(argVal[i], - STRING_ENCODING_DEFAULT); - } - argv[count] = NULL; - } else { - errno = ENOMEM; - goto exit; - } + argv = Unicode_GetAllocList(argVal, -1, + STRING_ENCODING_DEFAULT); } ret = execv(path, argv); -exit: if (argv) { - for (i = 0; i < count; i++) { - free(argv[i]); - } - free(argv); + Util_FreeStringList(argv, -1); + } + free(path); + return ret; +} + + +/* + *---------------------------------------------------------------------- + * + * Posix_Execve -- + * + * POSIX execve(). + * + * Results: + * -1 Error + * 0 Success + * + * Side effects: + * errno is set on error + * + *---------------------------------------------------------------------- + */ + +int +Posix_Execve(ConstUnicode pathName, // IN: + Unicode const argVal[], // IN: + Unicode const envPtr[]) // IN: +{ + int ret = -1; + char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); + char **argv = NULL; + char **envp = NULL; + + if (argVal) { + argv = Unicode_GetAllocList(argVal, -1, + STRING_ENCODING_DEFAULT); + } + + if (envPtr) { + envp = Unicode_GetAllocList(envPtr, -1, + STRING_ENCODING_DEFAULT); + } + + ret = execve(path, argv, envp); + + if (argv) { + Util_FreeStringList(argv, -1); + } + if (envp) { + Util_FreeStringList(envp, -1); } free(path); return ret; @@ -847,39 +1012,50 @@ Posix_Execvp(ConstUnicode fileName, // IN: int ret = -1; char *file = Unicode_GetAllocBytes(fileName, STRING_ENCODING_DEFAULT); char **argv = NULL; - int i, count = 0; if (argVal) { - while (argVal[count]) { - count++; - } - argv = (char **) malloc(sizeof(char *) * (count + 1)); - if (argv) { - for (i = 0; i < count; i++) { - argv[i] = Unicode_GetAllocBytes(argVal[i], - STRING_ENCODING_DEFAULT); - } - argv[count] = NULL; - } else { - errno = ENOMEM; - goto exit; - } + argv = Unicode_GetAllocList(argVal, -1, + STRING_ENCODING_DEFAULT); } ret = execvp(file, argv); -exit: if (argv) { - for (i = 0; i < count; i++) { - free(argv[i]); - } - free(argv); + Util_FreeStringList(argv, -1); } free(file); return ret; } +/* + *---------------------------------------------------------------------- + * + * Posix_System -- + * + * POSIX system() + * + * Results: + * Returns the status of command, or -1 on failure. + * + * Side effects: + * errno is set on error. + * + *---------------------------------------------------------------------- + */ + +int +Posix_System(ConstUnicode command) // IN: +{ + char *tmpcommand = Unicode_GetAllocBytes(command, STRING_ENCODING_DEFAULT); + + int ret = system(tmpcommand); + + free(tmpcommand); + return ret; +} + + /* *---------------------------------------------------------------------- * @@ -1063,7 +1239,6 @@ Posix_OpenDir(ConstUnicode pathName) // IN: } -#if !defined(sun) // { /* *---------------------------------------------------------------------- * @@ -1123,9 +1298,10 @@ Posix_Getenv(ConstUnicode name) // IN: /* *---------------------------------------------------------------------- * - * Posix_Setenv -- + * Posix_Putenv -- * - * POSIX setenv(). + * POSIX putenv(). This wrapper will only assert the string is ASCII. + * putenv() should not be used. * * Results: * -1 Error @@ -1138,57 +1314,13 @@ Posix_Getenv(ConstUnicode name) // IN: */ int -Posix_Setenv(ConstUnicode name, // IN: - ConstUnicode value, // IN: - int overWrite) // IN: -{ - int res; - char *rawData; - char *rawName; - - rawData = Unicode_GetAllocBytes(value, STRING_ENCODING_DEFAULT); - rawName = Unicode_GetAllocBytes(name, STRING_ENCODING_DEFAULT); - - res = setenv(rawName, rawData, overWrite); - - free(rawData); - free(rawName); - - return res; -} - - -/* - *---------------------------------------------------------------------- - * - * Posix_Statfs -- - * - * POSIX statfs() - * - * Results: - * -1 Error - * 0 Success - * - * Side effects: - * errno is set on error - * - *---------------------------------------------------------------------- - */ - -int -Posix_Statfs(ConstUnicode pathName, // IN: - struct statfs *statfsbuf) // IN: +Posix_Putenv(Unicode name) // IN: { - char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); - int ret = statfs(path, statfsbuf); - - free(path); - return ret; + ASSERT(Unicode_IsBufferValid(name, -1, STRING_ENCODING_US_ASCII)); + return putenv(name); } -#if !defined(__FreeBSD__) // { - /* *---------------------------------------------------------------------- * @@ -1250,7 +1382,7 @@ Posix_Getpwuid(uid_t uid) // IN: * * GetpwInternal -- * - * Helper function for Posix_Getpwnam and Posix_Getpwuid + * Helper function for Posix_Getpwnam, Posix_Getpwuid and Posix_Getpwent * * Results: * Pointer to updated passwd struct on NULL on error. @@ -1282,12 +1414,25 @@ GetpwInternal(struct passwd *pw) // IN: spw.pw_gecos = NULL; free(spw.pw_shell); spw.pw_shell = NULL; +#if defined(__FreeBSD__) + free(spw.pw_class); + spw.pw_class = NULL; +#endif /* Fill out structure with new values. */ spw.pw_uid = pw->pw_uid; spw.pw_gid = pw->pw_gid; +#if defined(__FreeBSD__) + spw.pw_change = pw->pw_change; + spw.pw_expire = pw->pw_expire; + spw.pw_fields = pw->pw_fields; +#endif +#if !defined(sun) ret = ENOMEM; +#else + ret = EIO; +#endif if (pw->pw_passwd && (spw.pw_passwd = Unicode_Alloc(pw->pw_passwd, STRING_ENCODING_DEFAULT)) == NULL) { goto exit; @@ -1308,6 +1453,12 @@ GetpwInternal(struct passwd *pw) // IN: (spw.pw_shell = Unicode_Alloc(pw->pw_shell, STRING_ENCODING_DEFAULT)) == NULL) { goto exit; } +#if defined(__FreeBSD__) + if (pw->pw_class && + (spw.pw_class = Unicode_Alloc(pw->pw_class, STRING_ENCODING_DEFAULT)) == NULL) { + goto exit; + } +#endif ret = 0; exit: @@ -1319,16 +1470,109 @@ exit: } +#if !defined(sun) // { /* *---------------------------------------------------------------------- * - * Posix_Getpwnam_r -- + * Posix_Statfs -- * - * POSIX getpwnam_r() + * POSIX statfs() * * Results: - * Returns 0 with success and pointer to updated passwd struct - * or returns error code. + * -1 Error + * 0 Success + * + * Side effects: + * errno is set on error + * + *---------------------------------------------------------------------- + */ + +int +Posix_Statfs(ConstUnicode pathName, // IN: + struct statfs *statfsbuf) // IN: +{ + char *path = Unicode_GetAllocBytes(pathName, STRING_ENCODING_DEFAULT); + int ret = statfs(path, statfsbuf); + + free(path); + return ret; +} + + +/* + *---------------------------------------------------------------------- + * + * Posix_Setenv -- + * + * POSIX setenv(). + * + * Results: + * -1 Error + * 0 Success + * + * Side effects: + * Environment may be changed. + * + *---------------------------------------------------------------------- + */ + +int +Posix_Setenv(ConstUnicode name, // IN: + ConstUnicode value, // IN: + int overWrite) // IN: +{ + int res; + char *rawData; + char *rawName; + + rawData = Unicode_GetAllocBytes(value, STRING_ENCODING_DEFAULT); + rawName = Unicode_GetAllocBytes(name, STRING_ENCODING_DEFAULT); + + res = setenv(rawName, rawData, overWrite); + + free(rawData); + free(rawName); + + return res; +} + + +#if !defined(__FreeBSD__) // { +/*---------------------------------------------------------------------- + * Posix_Getpwent -- + * + * POSIX getpwent() + * + * Results: + * Pointer to updated passwd struct or NULL on error. + * + * Side effects: + * errno is set on error + * + *---------------------------------------------------------------------- + */ + +struct passwd * +Posix_Getpwent(void) +{ + struct passwd *pw; + + pw = getpwent(); + return GetpwInternal(pw); +} + + +/* + *---------------------------------------------------------------------- + * + * Posix_Getpwnam_r -- + * + * POSIX getpwnam_r() + * + * Results: + * Returns 0 with success and pointer to updated passwd struct + * or returns error code. * * Side effects: * None. @@ -1422,7 +1666,7 @@ GetpwInternal_r(struct passwd *pw, // IN: char *gecos = NULL; char *dir = NULL; char *shell = NULL; - char *p; + size_t n; /* * Maybe getpwnam_r didn't use supplied struct, but we don't care. @@ -1462,51 +1706,51 @@ GetpwInternal_r(struct passwd *pw, // IN: */ ret = ERANGE; - p = buf; + n = 0; if (pwname) { size_t len = strlen(pwname) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - pw->pw_name = memcpy(p, pwname, len); - p += len; + pw->pw_name = memcpy(buf + n, pwname, len); + n += len; } if (passwd != NULL) { size_t len = strlen(passwd) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - pw->pw_passwd = memcpy(p, passwd, len); - p += len; + pw->pw_passwd = memcpy(buf + n, passwd, len); + n += len; } if (gecos) { size_t len = strlen(gecos) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - pw->pw_gecos = memcpy(p, gecos, len); - p += len; + pw->pw_gecos = memcpy(buf + n, gecos, len); + n += len; } if (dir) { size_t len = strlen(dir) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - pw->pw_dir = memcpy(p, dir, len); - p += len; + pw->pw_dir = memcpy(buf + n, dir, len); + n += len; } if (shell) { size_t len = strlen(shell) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - pw->pw_shell = memcpy(p, shell, len); - p += len; + pw->pw_shell = memcpy(buf + n, shell, len); + n += len; } ret = 0; @@ -1520,7 +1764,285 @@ exit: } +/* + *---------------------------------------------------------------------- + * + * Posix_GetGroupList -- + * + * POSIX getgrouplist() + * + * Results: + * Returns number of groups found, or -1 if *ngroups is + * smaller than number of groups found. Also returns + * the list of groups. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Posix_GetGroupList(ConstUnicode user, // IN: + gid_t group, // IN: + gid_t *groups, // OUT: + int *ngroups) // IN/OUT: +{ + char *tmpuser = Unicode_GetAllocBytes(user, STRING_ENCODING_DEFAULT); + + int ret = getgrouplist(tmpuser, group, groups, ngroups); + + free(tmpuser); + return ret; +} + +/* + *---------------------------------------------------------------------- + * Posix_Getgrnam -- + * + * POSIX getgrnam() + * + * Results: + * Pointer to updated group struct on NULL on error. + * + * Side effects: + * errno is set on error + * + *---------------------------------------------------------------------- + */ + +struct group * +Posix_Getgrnam(ConstUnicode name) // IN: +{ + struct group *gr; + char *tmpname; + int ret, i; + static struct group sgr = {0}; + + tmpname = Unicode_GetAllocBytes(name, STRING_ENCODING_DEFAULT); + gr = getgrnam(tmpname); + free(tmpname); + + if (!gr) { + return NULL; + } + + /* Free static structure string pointers before reuse. */ + free(sgr.gr_name); + sgr.gr_name = NULL; + free(sgr.gr_passwd); + sgr.gr_passwd = NULL; + for (i = 0; sgr.gr_mem[i]; i++) { + free(sgr.gr_mem[i]); + } + free(sgr.gr_mem); + sgr.gr_mem = NULL; + + /* Fill out structure with new values. */ + sgr.gr_gid = gr->gr_gid; + + ret = ENOMEM; + if (gr->gr_passwd && + (sgr.gr_passwd = Unicode_Alloc(gr->gr_passwd, STRING_ENCODING_DEFAULT)) == NULL) { + goto exit; + } + if (gr->gr_name && + (sgr.gr_name = Unicode_Alloc(gr->gr_name, STRING_ENCODING_DEFAULT)) == NULL) { + goto exit; + } + if (gr->gr_mem) { + sgr.gr_mem = Unicode_GetAllocList(gr->gr_mem, -1, + STRING_ENCODING_DEFAULT); + } + + ret = 0; + + exit: + if (ret != 0) { + errno = ret; + return NULL; + } + return &sgr; + +} + + +/* + *---------------------------------------------------------------------- + * + * Posix_Getgrnam_r -- + * + * POSIX getgrnam_r() + * + * Results: + * Returns 0 with success and pointer to updated group struct + * or returns error code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Posix_Getgrnam_r(ConstUnicode name, // IN: + struct group *gr, // IN: + char *buf, // IN: + size_t size, // IN: + struct group **pgr) // OUT: +{ + int ret, i; + char *tmpname; + char *grname = NULL; + char *grpasswd = NULL; + char **grmem = NULL; + size_t n; + + tmpname = Unicode_GetAllocBytes(name, STRING_ENCODING_DEFAULT); + ret = getgrnam_r(tmpname, gr, buf, size, pgr); + free(tmpname); + + if (ret != 0) { + return ret; + } + + /* + * Maybe getgrnam_r didn't use supplied struct, but we don't care. + * We just fix up the one it gives us. + */ + + gr = *pgr; + + /* + * Convert strings to UTF-8 + */ + + ret = ENOMEM; + if (gr->gr_name && + (grname = Unicode_Alloc(gr->gr_name, STRING_ENCODING_DEFAULT)) == NULL) { + goto exit; + } + if (gr->gr_passwd && + (grpasswd = Unicode_Alloc(gr->gr_passwd, STRING_ENCODING_DEFAULT)) == NULL) { + goto exit; + } + if (gr->gr_mem) { + grmem = Unicode_GetAllocList(gr->gr_mem, -1, + STRING_ENCODING_DEFAULT); + } + + /* + * Put UTF-8 strings into the structure. + */ + + ret = ERANGE; + n = 0; + + if (grname) { + size_t len = strlen(grname) + 1; + if (n + len > size || n + len < n ) { + goto exit; + } + gr->gr_name = memcpy(buf + n, grname, len); + n += len; + } + + if (grpasswd != NULL) { + size_t len = strlen(grpasswd) + 1; + if (n + len > size || n + len < n) { + goto exit; + } + gr->gr_passwd = memcpy(buf + n, grpasswd, len); + n += len; + } + + if (grmem) { + for (i = 0; grmem[i]; i++) { + size_t len = strlen(grmem[i]) + 1; + if (n + len > size || n + len < n) { + goto exit; + } + gr->gr_mem[i] = memcpy(buf + n, grmem[i], len); + n += len; + } + } + + ret = 0; + + exit: + free(grpasswd); + free(grname); + if (grmem) { + Util_FreeStringList(grmem, -1); + } + return ret; +} + + #if !defined(__APPLE__) // { +/* + *---------------------------------------------------------------------- + * + * Posix_Mount -- + * + * POSIX mount() + * + * Results: + * -1 Error + * 0 Success + * + * Side effects: + * errno is set on error. On success, filesystem is mounted. + * + *---------------------------------------------------------------------- + */ + +int +Posix_Mount(ConstUnicode source, // IN: + ConstUnicode target, // IN: + const char *filesystemtype, // IN: + unsigned long mountflags, // IN: + const void *data) // IN: +{ + char *tmpsource = Unicode_GetAllocBytes(source, STRING_ENCODING_DEFAULT); + char *tmptarget = Unicode_GetAllocBytes(target, STRING_ENCODING_DEFAULT); + + int ret = mount(tmpsource, tmptarget, filesystemtype, mountflags, data); + + free(tmpsource); + free(tmptarget); + return ret; +} + + +/* + *---------------------------------------------------------------------- + * + * Posix_Umount -- + * + * POSIX umount() + * + * Results: + * -1 Error + * 0 Success + * + * Side effects: + * errno is set on error. On success, filesystem is unmounted. + * + *---------------------------------------------------------------------- + */ + +int +Posix_Umount(ConstUnicode target) // IN: +{ + char *tmptarget = Unicode_GetAllocBytes(target, STRING_ENCODING_DEFAULT); + + int ret = umount(tmptarget); + + free(tmptarget); + return ret; +} + /* *---------------------------------------------------------------------- @@ -1652,7 +2174,7 @@ Posix_Getmntent_r(FILE *fp, // IN: char *dir = NULL; char *type = NULL; char *opts = NULL; - char *p; + size_t n; if (!getmntent_r(fp, m, buf, size)) { return NULL; @@ -1685,42 +2207,42 @@ Posix_Getmntent_r(FILE *fp, // IN: */ ret = ERANGE; - p = buf; + n = 0; if (fsname) { int len = strlen(fsname) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - m->mnt_fsname = memcpy(p, fsname, len); - p += len; + m->mnt_fsname = memcpy(buf + n, fsname, len); + n += len; } if (dir != NULL) { int len = strlen(dir) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < n) { goto exit; } - m->mnt_dir = memcpy(p, dir, len); - p += len; + m->mnt_dir = memcpy(buf + n, dir, len); + n += len; } if (type) { int len = strlen(type) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < size) { goto exit; } - m->mnt_type = memcpy(p, type, len); - p += len; + m->mnt_type = memcpy(buf + n, type, len); + n += len; } if (opts) { size_t len = strlen(opts) + 1; - if (p + len > buf + size) { + if (n + len > size || n + len < size) { goto exit; } - m->mnt_opts = memcpy(p, opts, len); - p += len; + m->mnt_opts = memcpy(buf + n, opts, len); + n += len; } ret = 0; @@ -1740,5 +2262,55 @@ exit: #endif // } !defined(__APPLE__) #endif // } !defined(__FreeBSD__) + + +#else // } !defined(sun) { +/* + *---------------------------------------------------------------------- + * + * Posix_Getmntent -- + * + * POSIX getmntent() for Solaris + * + * Results: + * -1 EOF + * 0 Success + * >0 Error + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Posix_Getmntent(FILE *fp, // IN: + struct mnttab *mp) // IN: +{ + int ret; + static struct mnttab m = {0}; + + ret = getmntent(fp, mp); + if (ret == 0) { + free(m.mnt_special); + free(m.mnt_mountp); + free(m.mnt_fstype); + free(m.mnt_mntopts); + free(m.mnt_time); + m.mnt_special = Unicode_Alloc(mp->mnt_special, STRING_ENCODING_DEFAULT); + m.mnt_mountp = Unicode_Alloc(mp->mnt_mountp, STRING_ENCODING_DEFAULT); + m.mnt_fstype = Unicode_Alloc(mp->mnt_fstype, STRING_ENCODING_DEFAULT); + m.mnt_mntopts = Unicode_Alloc(mp->mnt_mntopts, STRING_ENCODING_DEFAULT); + m.mnt_time = Unicode_Alloc(mp->mnt_time, STRING_ENCODING_DEFAULT); + mp->mnt_special = m.mnt_special; + mp->mnt_mountp = m.mnt_mountp; + mp->mnt_fstype = m.mnt_fstype; + mp->mnt_mntopts = m.mnt_mntopts; + mp->mnt_time = m.mnt_time; + } + + return ret; +} + #endif // } !defined(sun) #endif // } !defined(N_PLAT_NLM) diff --git a/open-vm-tools/lib/misc/shared/Makefile.am b/open-vm-tools/lib/misc/shared/Makefile.am index 03af173b8..be343cba7 100644 --- a/open-vm-tools/lib/misc/shared/Makefile.am +++ b/open-vm-tools/lib/misc/shared/Makefile.am @@ -20,7 +20,7 @@ noinst_LTLIBRARIES = libMisc.la libMisc_la_SOURCES = libMisc_la_SOURCES += ../atomic.c libMisc_la_SOURCES += ../base64.c -libMisc_la_SOURCES += ../codeset.c +libMisc_la_SOURCES += ../codesetOld.c libMisc_la_SOURCES += ../dbllnklst.c libMisc_la_SOURCES += ../dynarray.c libMisc_la_SOURCES += ../dynbuf.c @@ -37,6 +37,10 @@ libMisc_la_SOURCES += ../timeutil.c libMisc_la_SOURCES += ../util_misc.c libMisc_la_SOURCES += ../vmstdio.c +if NO_ICU +libMisc_la_SOURCES += ../codeset.c +endif + AM_CFLAGS = AM_CFLAGS += @COMMON_CFLAGS@ AM_CFLAGS += @LIB_MISC_CFLAGS@ diff --git a/open-vm-tools/lib/misc/shared/Makefile.in b/open-vm-tools/lib/misc/shared/Makefile.in index c334dd9ba..0561e3ff1 100644 --- a/open-vm-tools/lib/misc/shared/Makefile.in +++ b/open-vm-tools/lib/misc/shared/Makefile.in @@ -49,6 +49,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@NO_ICU_TRUE@am__append_1 = ../codeset.c subdir = lib/misc/shared DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -59,10 +60,16 @@ mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libMisc_la_LIBADD = -am_libMisc_la_OBJECTS = atomic.lo base64.lo codeset.lo dbllnklst.lo \ +am__libMisc_la_SOURCES_DIST = ../atomic.c ../base64.c ../codesetOld.c \ + ../dbllnklst.c ../dynarray.c ../dynbuf.c ../escape.c \ + ../hashTable.c ../hostinfo_misc.c ../hostname.c ../idLinux.c \ + ../iovector.c ../machineID.c ../miscSolaris.c ../random.c \ + ../timeutil.c ../util_misc.c ../vmstdio.c ../codeset.c +@NO_ICU_TRUE@am__objects_1 = codeset.lo +am_libMisc_la_OBJECTS = atomic.lo base64.lo codesetOld.lo dbllnklst.lo \ dynarray.lo dynbuf.lo escape.lo hashTable.lo hostinfo_misc.lo \ hostname.lo idLinux.lo iovector.lo machineID.lo miscSolaris.lo \ - random.lo timeutil.lo util_misc.lo vmstdio.lo + random.lo timeutil.lo util_misc.lo vmstdio.lo $(am__objects_1) libMisc_la_OBJECTS = $(am_libMisc_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -77,7 +84,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libMisc_la_SOURCES) -DIST_SOURCES = $(libMisc_la_SOURCES) +DIST_SOURCES = $(am__libMisc_la_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -119,6 +126,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -217,11 +227,11 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libMisc.la -libMisc_la_SOURCES = ../atomic.c ../base64.c ../codeset.c \ +libMisc_la_SOURCES = ../atomic.c ../base64.c ../codesetOld.c \ ../dbllnklst.c ../dynarray.c ../dynbuf.c ../escape.c \ ../hashTable.c ../hostinfo_misc.c ../hostname.c ../idLinux.c \ ../iovector.c ../machineID.c ../miscSolaris.c ../random.c \ - ../timeutil.c ../util_misc.c ../vmstdio.c + ../timeutil.c ../util_misc.c ../vmstdio.c $(am__append_1) AM_CFLAGS = @COMMON_CFLAGS@ @LIB_MISC_CFLAGS@ all: all-am @@ -277,6 +287,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codeset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codesetOld.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbllnklst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynarray.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynbuf.Plo@am__quote@ @@ -328,12 +339,12 @@ base64.lo: ../base64.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o base64.lo `test -f '../base64.c' || echo '$(srcdir)/'`../base64.c -codeset.lo: ../codeset.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codeset.lo -MD -MP -MF $(DEPDIR)/codeset.Tpo -c -o codeset.lo `test -f '../codeset.c' || echo '$(srcdir)/'`../codeset.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/codeset.Tpo $(DEPDIR)/codeset.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../codeset.c' object='codeset.lo' libtool=yes @AMDEPBACKSLASH@ +codesetOld.lo: ../codesetOld.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codesetOld.lo -MD -MP -MF $(DEPDIR)/codesetOld.Tpo -c -o codesetOld.lo `test -f '../codesetOld.c' || echo '$(srcdir)/'`../codesetOld.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/codesetOld.Tpo $(DEPDIR)/codesetOld.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../codesetOld.c' object='codesetOld.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codeset.lo `test -f '../codeset.c' || echo '$(srcdir)/'`../codeset.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codesetOld.lo `test -f '../codesetOld.c' || echo '$(srcdir)/'`../codesetOld.c dbllnklst.lo: ../dbllnklst.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbllnklst.lo -MD -MP -MF $(DEPDIR)/dbllnklst.Tpo -c -o dbllnklst.lo `test -f '../dbllnklst.c' || echo '$(srcdir)/'`../dbllnklst.c @@ -440,6 +451,13 @@ vmstdio.lo: ../vmstdio.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vmstdio.lo `test -f '../vmstdio.c' || echo '$(srcdir)/'`../vmstdio.c +codeset.lo: ../codeset.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codeset.lo -MD -MP -MF $(DEPDIR)/codeset.Tpo -c -o codeset.lo `test -f '../codeset.c' || echo '$(srcdir)/'`../codeset.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/codeset.Tpo $(DEPDIR)/codeset.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../codeset.c' object='codeset.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codeset.lo `test -f '../codeset.c' || echo '$(srcdir)/'`../codeset.c + mostlyclean-libtool: -rm -f *.lo diff --git a/open-vm-tools/lib/misc/util_misc.c b/open-vm-tools/lib/misc/util_misc.c index 5e1f23b21..7b297f1b6 100644 --- a/open-vm-tools/lib/misc/util_misc.c +++ b/open-vm-tools/lib/misc/util_misc.c @@ -47,7 +47,7 @@ # include #endif -#if __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) #include #endif @@ -354,7 +354,7 @@ pid_t gettid(void) *----------------------------------------------------------------------------- */ -uint32 +uintptr_t Util_GetCurrentThreadId(void) { #if defined(linux) @@ -371,32 +371,34 @@ Util_GetCurrentThreadId(void) // ESX with userworld VMX #if defined(VMX86_SERVER) if (HostType_OSIsVMK()) { - return User_GetTid(); + return (uintptr_t)User_GetTid(); } #endif if (useTid) { tid = gettid(); if (tid != (pid_t)-1) { - return tid; + return (uintptr_t)tid; } ASSERT(errno == ENOSYS); useTid = 0; } tid = getpid(); ASSERT(tid != (pid_t)-1); - return tid; -#elif __FreeBSD__ || sun + return (uintptr_t)tid; +#elif defined(sun) pid_t tid; tid = getpid(); ASSERT(tid != (pid_t)-1); - return tid; -#elif __APPLE__ - ASSERT_ON_COMPILE(sizeof(uint32) == sizeof(pthread_t)); - return (uint32)pthread_self(); + return (uintptr_t)tid; +#elif defined(__APPLE__) || defined(__FreeBSD__) + ASSERT_ON_COMPILE(sizeof(uintptr_t) == sizeof(pthread_t)); + return (uintptr_t)pthread_self(); +#elif defined(_WIN32) + return (uintptr_t)GetCurrentThreadId(); #else - return GetCurrentThreadId(); +#error "Unknown platform" #endif } diff --git a/open-vm-tools/lib/netUtil/Makefile.in b/open-vm-tools/lib/netUtil/Makefile.in index 3aadc5d05..9d50aac88 100644 --- a/open-vm-tools/lib/netUtil/Makefile.in +++ b/open-vm-tools/lib/netUtil/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/panic/Makefile.in b/open-vm-tools/lib/panic/Makefile.in index 8d97bf994..621e9c0a1 100644 --- a/open-vm-tools/lib/panic/Makefile.in +++ b/open-vm-tools/lib/panic/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/panic/panic.c b/open-vm-tools/lib/panic/panic.c index d6d19a4fd..8713848f1 100644 --- a/open-vm-tools/lib/panic/panic.c +++ b/open-vm-tools/lib/panic/panic.c @@ -44,6 +44,7 @@ #include "util.h" #ifdef _WIN32 #include "coreDump.h" +#include "win32u.h" #endif @@ -329,7 +330,7 @@ Panic_GetBreakOnPanic(void) { typedef BOOL (*pfnIsDebuggerPresent)(void); - HMODULE kernelLibrary = LoadLibrary("kernel32.dll"); + HMODULE kernelLibrary = Win32U_LoadLibrary("kernel32.dll"); if (kernelLibrary != NULL) { pfnIsDebuggerPresent IsDebuggerPresentFn = (pfnIsDebuggerPresent) GetProcAddress(kernelLibrary, "IsDebuggerPresent"); @@ -449,7 +450,7 @@ Panic_Panic(const char *format, fputs(buf, stderr); #ifdef _WIN32 - OutputDebugString(buf); + Win32U_OutputDebugString(buf); #endif /* @@ -544,7 +545,7 @@ Panic_Panic(const char *format, void Panic_DumpGuiResources(void) { - HANDLE hUser = GetModuleHandle("user32.dll"); + HANDLE hUser = Win32U_GetModuleHandle("user32.dll"); if (hUser) { typedef DWORD (WINAPI *fnGetGuiResources)(HANDLE, DWORD); fnGetGuiResources pGetGuiResources = diff --git a/open-vm-tools/lib/panicDefault/Makefile.in b/open-vm-tools/lib/panicDefault/Makefile.in index 3dda4d1f1..237b1bfd8 100644 --- a/open-vm-tools/lib/panicDefault/Makefile.in +++ b/open-vm-tools/lib/panicDefault/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/printer/Makefile.in b/open-vm-tools/lib/printer/Makefile.in index 1c198604d..9893c9d78 100644 --- a/open-vm-tools/lib/printer/Makefile.in +++ b/open-vm-tools/lib/printer/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/printer/printer.c b/open-vm-tools/lib/printer/printer.c index b91f56d83..140872551 100644 --- a/open-vm-tools/lib/printer/printer.c +++ b/open-vm-tools/lib/printer/printer.c @@ -39,6 +39,9 @@ #include "vmware.h" #include "err.h" #include "printer.h" +#ifdef _WIN32 +#include "win32u.h" +#endif #define LOGLEVEL_MODULE printer #include "loglevel_user.h" @@ -272,14 +275,14 @@ Printer_Init(void) /* * Try to load the necessary library. */ - winspoolDll = LoadLibrary("Winspool.drv"); + winspoolDll = Win32U_LoadLibrary("Winspool.drv"); if (!winspoolDll) { error = Err_Errno(); Log("Printer_Init: Failed to load Winspool.drv %d: %s\n", error, Err_Errno2String(error)); Log("Printer_Init: Trying to load Winspool as Winspool.dll...\n"); - winspoolDll = LoadLibrary("Winspool"); + winspoolDll = Win32U_LoadLibrary("Winspool"); if (!winspoolDll) { error = Err_Errno(); Log("Printer_Init: Failed to load Winspool.dll %d: %s\n", diff --git a/open-vm-tools/lib/procMgr/Makefile.in b/open-vm-tools/lib/procMgr/Makefile.in index d22b30969..995c0981e 100644 --- a/open-vm-tools/lib/procMgr/Makefile.in +++ b/open-vm-tools/lib/procMgr/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/rpcIn/Makefile.in b/open-vm-tools/lib/rpcIn/Makefile.in index e12992b27..e6c5e4bfa 100644 --- a/open-vm-tools/lib/rpcIn/Makefile.in +++ b/open-vm-tools/lib/rpcIn/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/rpcOut/Makefile.in b/open-vm-tools/lib/rpcOut/Makefile.in index 12f89eba5..5cceffe2d 100644 --- a/open-vm-tools/lib/rpcOut/Makefile.in +++ b/open-vm-tools/lib/rpcOut/Makefile.in @@ -128,6 +128,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/rpcOut/shared/Makefile.in b/open-vm-tools/lib/rpcOut/shared/Makefile.in index 080190118..702d06ee4 100644 --- a/open-vm-tools/lib/rpcOut/shared/Makefile.in +++ b/open-vm-tools/lib/rpcOut/shared/Makefile.in @@ -116,6 +116,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/rpcVmx/Makefile.in b/open-vm-tools/lib/rpcVmx/Makefile.in index b9a05d7a7..ab9aaa746 100644 --- a/open-vm-tools/lib/rpcVmx/Makefile.in +++ b/open-vm-tools/lib/rpcVmx/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/socketMgr/Makefile.in b/open-vm-tools/lib/socketMgr/Makefile.in index b474eca58..ad99be03d 100644 --- a/open-vm-tools/lib/socketMgr/Makefile.in +++ b/open-vm-tools/lib/socketMgr/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/strUtil/Makefile.in b/open-vm-tools/lib/strUtil/Makefile.in index 7ec8e02c8..401ce0f8a 100644 --- a/open-vm-tools/lib/strUtil/Makefile.in +++ b/open-vm-tools/lib/strUtil/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/string/Makefile.am b/open-vm-tools/lib/string/Makefile.am index 4c6d30b6b..a075e24ac 100644 --- a/open-vm-tools/lib/string/Makefile.am +++ b/open-vm-tools/lib/string/Makefile.am @@ -21,6 +21,7 @@ libString_a_SOURCES = libString_a_SOURCES += bsd_output_shared.c libString_a_SOURCES += bsd_vsnprintf.c libString_a_SOURCES += bsd_vsnwprintf.c +libString_a_SOURCES += convertutf.c libString_a_SOURCES += str.c AM_CFLAGS = diff --git a/open-vm-tools/lib/string/Makefile.in b/open-vm-tools/lib/string/Makefile.in index b85f01dcd..959579513 100644 --- a/open-vm-tools/lib/string/Makefile.in +++ b/open-vm-tools/lib/string/Makefile.in @@ -62,7 +62,8 @@ ARFLAGS = cru libString_a_AR = $(AR) $(ARFLAGS) libString_a_LIBADD = am_libString_a_OBJECTS = bsd_output_shared.$(OBJEXT) \ - bsd_vsnprintf.$(OBJEXT) bsd_vsnwprintf.$(OBJEXT) str.$(OBJEXT) + bsd_vsnprintf.$(OBJEXT) bsd_vsnwprintf.$(OBJEXT) \ + convertutf.$(OBJEXT) str.$(OBJEXT) libString_a_OBJECTS = $(am_libString_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -129,6 +130,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -228,7 +232,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libString.a libString_a_SOURCES = bsd_output_shared.c bsd_vsnprintf.c \ - bsd_vsnwprintf.c str.c + bsd_vsnwprintf.c convertutf.c str.c AM_CFLAGS = @COMMON_CFLAGS@ @LIB_STRING_CFLAGS@ SUBDIRS = shared all: all-recursive @@ -281,6 +285,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_output_shared.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_vsnprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_vsnwprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convertutf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@ .c.o: diff --git a/open-vm-tools/lib/string/bsd_vsnprintf.c b/open-vm-tools/lib/string/bsd_vsnprintf.c index d758459c5..97f5ac42a 100644 --- a/open-vm-tools/lib/string/bsd_vsnprintf.c +++ b/open-vm-tools/lib/string/bsd_vsnprintf.c @@ -70,6 +70,7 @@ #include "vmware.h" #include "bsd_output_int.h" #include "codeset.h" +#include "convertutf.h" static char *__ultoa(u_long, char *, int, int, const char *, int, char, const char *); @@ -84,6 +85,8 @@ char zeroes[PADSIZE] = const char xdigs_lower[17] = "0123456789abcdef?"; const char xdigs_upper[17] = "0123456789ABCDEF?"; +static Bool isLenientConversion = TRUE; + int BSDFmt_SFVWrite(BSDFmt_StrBuf *sbuf, BSDFmt_UIO *uio) { @@ -306,62 +309,95 @@ BSDFmt_UJToA(uintmax_t val, char *endp, int base, int octzero, } /* - * Convert a wide character string argument for the %ls format to a multibyte - * string representation. If not -1, prec specifies the maximum number of - * bytes to output, and also means that we can't assume that the wide char. - * string ends is null-terminated. + * Convert a wide character string argument to a UTF-8 string + * representation. If not -1, 'prec' specifies the maximum number of + * bytes to output. The returned string is always NUL-terminated, even + * if that results in the string exceeding 'prec' bytes. */ char * -BSDFmt_WCSConv(wchar_t *wcsarg, int prec) +BSDFmt_WCharToUTF8(wchar_t *wcsarg, int prec) { - static const mbstate_t initial; - mbstate_t mbs; - char buf[MB_LEN_MAX]; - wchar_t *p; - char *convbuf; - size_t clen, nbytes; - - /* Allocate space for the maximum number of bytes we could output. */ - if (prec < 0) { - p = wcsarg; - mbs = initial; - nbytes = wcsrtombs(NULL, (const wchar_t **)&p, 0, &mbs); - if (nbytes == (size_t)-1) - return (NULL); - } else { + ConversionResult cres; + char *sourceStart, *sourceEnd; + char *targStart, *targEnd; + char *targ = NULL; + size_t targSize; + size_t sourceSize = wcslen(wcsarg) * sizeof(wchar_t); + + targSize = (-1 == prec) ? sourceSize : MIN(sourceSize, prec); + + while (TRUE) + { /* - * Optimisation: if the output precision is small enough, - * just allocate enough memory for the maximum instead of - * scanning the string. + * Pad by 4, because we need to NUL-terminate. */ - if (prec < 128) - nbytes = prec; - else { - nbytes = 0; - p = wcsarg; - mbs = initial; - for (;;) { - clen = wcrtomb(buf, *p++, &mbs); - if (clen == 0 || clen == (size_t)-1 || - nbytes + clen > prec) - break; - nbytes += clen; + targ = realloc(targ, targSize + 4); + if (!targ) { + goto exit; + } + + targStart = targ; + targEnd = targStart + targSize; + sourceStart = (char *) wcsarg; + sourceEnd = sourceStart + sourceSize; + + if (2 == sizeof(wchar_t)) { + cres = ConvertUTF16toUTF8((const UTF16 **) &sourceStart, + (const UTF16 *) sourceEnd, + (UTF8 **) &targStart, + (UTF8 *) targEnd, + isLenientConversion); + } else if (4 == sizeof(wchar_t)) { + cres = ConvertUTF32toUTF8((const UTF32 **) &sourceStart, + (const UTF32 *) sourceEnd, + (UTF8 **) &targStart, + (UTF8 *) targEnd, + isLenientConversion); + } else { + NOT_IMPLEMENTED(); + } + + if (targetExhausted == cres) { + if (targSize == prec) { + /* + * We've got all the caller wants. + */ + break; + } else { + /* + * Double buffer. + */ + targSize = (-1 == prec) ? targSize * 2 : MIN(targSize * 2, prec); } + } else if ((sourceExhausted == cres) || + (sourceIllegal == cres)) { + /* + * If lenient, the API converted all it could, so just + * proceed, otherwise, barf. + */ + if (isLenientConversion) { + break; + } else { + free(targ); + targ = NULL; + goto exit; + } + } else if (conversionOK == cres) { + break; + } else { + NOT_IMPLEMENTED(); } } - if ((convbuf = malloc(nbytes + 1)) == NULL) - return (NULL); - - /* Fill the output buffer. */ - p = wcsarg; - mbs = initial; - nbytes = wcsrtombs(convbuf, (const wchar_t **)&p, nbytes, &mbs); - if (nbytes == (size_t)-1) { - free(convbuf); - return (NULL); - } - convbuf[nbytes] = '\0'; - return (convbuf); + + /* + * Success, NUL-terminate. (The API updated targStart for us). + */ + ASSERT(targStart <= targEnd); + targSize = targStart - targ; + memset(targ + targSize, 0, 4); + + exit: + return targ; } @@ -957,7 +993,7 @@ bsd_vsnprintf(char **outbuf, size_t bufSize, const char *fmt0, va_list ap) if ((wcp = GETARG(wchar_t *)) == NULL) cp = "(null)"; else { - convbuf = BSDFmt_WCSConv(wcp, prec); + convbuf = BSDFmt_WCharToUTF8(wcp, prec); if (convbuf == NULL) { sbuf.error = TRUE; goto error; diff --git a/open-vm-tools/lib/string/bsd_vsnwprintf.c b/open-vm-tools/lib/string/bsd_vsnwprintf.c index 43a19dd39..ef1e75d2d 100644 --- a/open-vm-tools/lib/string/bsd_vsnwprintf.c +++ b/open-vm-tools/lib/string/bsd_vsnwprintf.c @@ -63,6 +63,7 @@ #include "vmware.h" #include "bsd_output_int.h" #include "msgfmt.h" +#include "convertutf.h" typedef struct StrBuf { Bool alloc; @@ -78,15 +79,11 @@ static wchar_t *__ujtoa(uintmax_t, wchar_t *, int, int, const char *, int, char, const char *); static wchar_t *__ultoa(u_long, wchar_t *, int, int, const char *, int, char, const char *); -static wchar_t *__mbsconv(char *, int); +static wchar_t *BSDFmt_UTF8ToWChar(const char *, int); static void __find_arguments(const wchar_t *, va_list, union arg **); static void __grow_type_table(int, enum typeid **, int *); -#ifdef _WIN32 -#define mbstate_t int -#define mbsrtowcs(dest, srcp, n, state) mbstowcs(dest, *(srcp), n) -#define mbrtowc(dest, wc, size, state) mbtowc(dest, wc, size) -#endif +static Bool isLenientConversion = TRUE; static int __sfvwrite(StrBuf *sbuf, BSDFmt_UIO *uio) @@ -309,70 +306,114 @@ __ujtoa(uintmax_t val, wchar_t *endp, int base, int octzero, return (cp); } + /* - * Convert a multibyte character string argument for the %s format to a wide - * string representation. ``prec'' specifies the maximum number of characters - * to output. If ``prec'' is greater than or equal to zero, we can't assume - * that the multibyte char. string ends in a null character. + * Convert a UTF-8 string argument to a wide-character string + * representation. If not -1, 'prec' specifies the maximum number of + * wide characters to output. The returned string is always NUL-terminated, + * even if that results in the string exceeding 'prec' characters. */ -static wchar_t * -__mbsconv(char *mbsarg, int prec) +wchar_t * +BSDFmt_UTF8ToWChar(const char *arg, // IN + int prec) // IN { - static const mbstate_t initial; - mbstate_t mbs; - wchar_t buf[MB_LEN_MAX]; - const char *p; - wchar_t *convbuf; - size_t clen, n; - - if (mbsarg == NULL) - return (NULL); - - /* Allocate space for the maximum number of bytes we could output. */ - if (prec < 0) { - p = mbsarg; - mbs = initial; - n = mbsrtowcs(NULL, (const char **)&p, 0, &mbs); - if (n == (size_t)-1) - return (NULL); - } else { + ConversionResult cres; + const char *sourceStart, *sourceEnd; + wchar_t *targStart, *targEnd; + wchar_t *targ = NULL; + + /* + * targSize and sourceSize are measured in wchar_t units, excluding NUL. + */ + size_t targSize; + size_t sourceSize = strlen(arg); + + ASSERT(prec == -1 || prec >= 0); + + targSize = sourceSize; + if (prec >= 0) { + targSize = MIN(targSize, prec); + } + + while (TRUE) { /* - * Optimisation: if the output precision is small enough, - * just allocate enough memory for the maximum instead of - * scanning the string. + * Pad by 1 because we need to NUL-terminate. */ - if (prec < 128) - n = prec; - else { - n = 0; - p = mbsarg; - mbs = initial; - for (;;) { - clen = mbrtowc(buf, p, MB_LEN_MAX, &mbs); - if (clen == 0 || clen == (size_t)-1 || - clen == (size_t)-2 || - (n + 1) > prec) - break; - n += 1; - p += clen; + wchar_t *oldTarg = targ; + targ = realloc(oldTarg, (targSize + 1) * sizeof *targ); + if (!targ) { + free(oldTarg); + goto exit; + } + + targStart = targ; + targEnd = targStart + targSize; + sourceStart = arg; + sourceEnd = sourceStart + sourceSize; + + if (2 == sizeof(wchar_t)) { + cres = ConvertUTF8toUTF16((const UTF8 **) &sourceStart, + (const UTF8 *) sourceEnd, + (UTF16 **) &targStart, + (UTF16 *) targEnd, + isLenientConversion); + } else if (4 == sizeof(wchar_t)) { + cres = ConvertUTF8toUTF32((const UTF8 **) &sourceStart, + (const UTF8 *) sourceEnd, + (UTF32 **) &targStart, + (UTF32 *) targEnd, + isLenientConversion); + } else { + NOT_IMPLEMENTED(); + } + + if (targetExhausted == cres) { + if (targSize == prec) { + /* + * We've got all the caller wants. + */ + break; + } else { + /* + * Grow the buffer. + */ + ASSERT(FALSE); + targSize *= 2; + if (prec >= 0) { + targSize = MIN(targSize, prec); + } + } + } else if ((sourceExhausted == cres) || + (sourceIllegal == cres)) { + /* + * If lenient, the API converted all it could, so just + * proceed, otherwise, barf. + */ + if (isLenientConversion) { + break; + } else { + free(targ); + targ = NULL; + goto exit; } + } else if (conversionOK == cres) { + break; + } else { + NOT_IMPLEMENTED(); } } - if ((convbuf = malloc((n + 1) * sizeof(wchar_t))) == NULL) - return (NULL); - - /* Fill the output buffer. */ - p = mbsarg; - mbs = initial; - n = mbsrtowcs(convbuf, (const char **)&p, n, &mbs); - if (n == (size_t)-1) { - free(convbuf); - return (NULL); - } - convbuf[n] = L'\0'; - return (convbuf); + + /* + * Success, NUL-terminate. (The API updated targStart for us). + */ + ASSERT(targStart <= targEnd); + *targStart = L'\0'; + + exit: + return targ; } + #ifndef NO_FLOATING_POINT static int exponent(wchar_t *, int, wchar_t); @@ -851,7 +892,7 @@ bsd_vsnwprintf(wchar_t **outBuf, size_t bufSize, const wchar_t *fmt0, expt = INT_MAX; } ndig = dtoaend - dtoaresult; - cp = convbuf = __mbsconv(dtoaresult, -1); + cp = convbuf = BSDFmt_UTF8ToWChar(dtoaresult, -1); freedtoa(dtoaresult); if (signflag) sign = '-'; @@ -986,7 +1027,7 @@ bsd_vsnwprintf(wchar_t **outBuf, size_t bufSize, const wchar_t *fmt0, if ((mbp = GETARG(char *)) == NULL) cp = L"(null)"; else { - convbuf = __mbsconv(mbp, prec); + convbuf = BSDFmt_UTF8ToWChar(mbp, prec); if (convbuf == NULL) { sbuf.error = TRUE; goto error; diff --git a/open-vm-tools/lib/string/convertutf.c b/open-vm-tools/lib/string/convertutf.c new file mode 100644 index 000000000..1c63b5456 --- /dev/null +++ b/open-vm-tools/lib/string/convertutf.c @@ -0,0 +1,542 @@ +/* ********************************************************** + * Copyright 2008 VMware, Inc. All rights reserved. + * **********************************************************/ +/* + * Copyright 2001-2004 Unicode, Inc. + * + * Disclaimer + * + * This source code is provided as is by Unicode, Inc. No claims are + * made as to fitness for any particular purpose. No warranties of any + * kind are expressed or implied. The recipient agrees to determine + * applicability of information provided. If this file has been + * purchased on magnetic or optical media from Unicode, Inc., the + * sole remedy for any claim will be exchange of defective media + * within 90 days of receipt. + * + * Limitations on Rights to Redistribute This Code + * + * Unicode, Inc. hereby grants the right to freely use the information + * supplied in this file in the creation of products supporting the + * Unicode Standard, and to make copies of this file in any form + * for internal or external distribution as long as this notice + * remains attached. + */ + +/* --------------------------------------------------------------------- + + Conversions between UTF32, UTF-16, and UTF-8. Source code file. + Author: Mark E. Davis, 1994. + Rev History: Rick McGowan, fixes & updates May 2001. + Sept 2001: fixed const & error conditions per + mods suggested by S. Parent & A. Lillich. + June 2002: Tim Dodd added detection and handling of incomplete + source sequences, enhanced error detection, added casts + to eliminate compiler warnings. + July 2003: slight mods to back out aggressive FFFE detection. + Jan 2004: updated switches in from-UTF8 conversions. + Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions. + + See the header file "ConvertUTF.h" for complete documentation. + +------------------------------------------------------------------------ */ + + +#include "convertutf.h" +#ifdef CVTUTF_DEBUG +#include +#endif + +static const int halfShift = 10; /* used for shifting by 10 bits */ + +static const UTF32 halfBase = 0x0010000UL; +static const UTF32 halfMask = 0x3FFUL; + +#define UNI_SUR_HIGH_START (UTF32)0xD800 +#define UNI_SUR_HIGH_END (UTF32)0xDBFF +#define UNI_SUR_LOW_START (UTF32)0xDC00 +#define UNI_SUR_LOW_END (UTF32)0xDFFF +#define false 0 +#define true 1 + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF32toUTF16 ( + const UTF32** sourceStart, const UTF32* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF32* source = *sourceStart; + UTF16* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch; + if (target >= targetEnd) { + result = targetExhausted; break; + } + ch = *source++; + if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */ + /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { + if (flags == strictConversion) { + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } else { + *target++ = UNI_REPLACEMENT_CHAR; + } + } else { + *target++ = (UTF16)ch; /* normal case */ + } + } else if (ch > UNI_MAX_LEGAL_UTF32) { + if (flags == strictConversion) { + result = sourceIllegal; + } else { + *target++ = UNI_REPLACEMENT_CHAR; + } + } else { + /* target is a character in range 0xFFFF - 0x10FFFF. */ + if (target + 1 >= targetEnd) { + --source; /* Back up source pointer! */ + result = targetExhausted; break; + } + ch -= halfBase; + *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START); + *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START); + } + } + *sourceStart = source; + *targetStart = target; + return result; +} + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF16toUTF32 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF16* source = *sourceStart; + UTF32* target = *targetStart; + UTF32 ch, ch2; + while (source < sourceEnd) { + const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ + ch = *source++; + /* If we have a surrogate pair, convert to UTF32 first. */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { + /* If the 16 bits following the high surrogate are in the source buffer... */ + if (source < sourceEnd) { + ch2 = *source; + /* If it's a low surrogate, convert to UTF32. */ + if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { + ch = ((ch - UNI_SUR_HIGH_START) << halfShift) + + (ch2 - UNI_SUR_LOW_START) + halfBase; + ++source; + } else if (flags == strictConversion) { /* it's an unpaired high surrogate */ + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + } else { /* We don't have the 16 bits following the high surrogate. */ + --source; /* return to the high surrogate */ + result = sourceExhausted; + break; + } + } else if (flags == strictConversion) { + /* UTF-16 surrogate values are illegal in UTF-32 */ + if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) { + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + } + if (target >= targetEnd) { + source = oldSource; /* Back up source pointer! */ + result = targetExhausted; break; + } + *target++ = ch; + } + *sourceStart = source; + *targetStart = target; +#ifdef CVTUTF_DEBUG +if (result == sourceIllegal) { + fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2); + fflush(stderr); +} +#endif + return result; +} + +/* --------------------------------------------------------------------- */ + +/* + * Index into the table below with the first byte of a UTF-8 sequence to + * get the number of trailing bytes that are supposed to follow it. + * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is + * left as-is for anyone who may want to do such conversion, which was + * allowed in earlier algorithms. + */ +static const char trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +/* + * Magic values subtracted from a buffer value during UTF8 conversion. + * This table contains as many values as there might be trailing bytes + * in a UTF-8 sequence. + */ +static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, + 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; + +/* + * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed + * into the first byte, depending on how many bytes follow. There are + * as many entries in this table as there are UTF-8 sequence types. + * (I.e., one byte sequence, two byte... etc.). Remember that sequencs + * for *legal* UTF-8 will be 4 or fewer bytes total. + */ +static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + +/* --------------------------------------------------------------------- */ + +/* The interface converts a whole buffer to avoid function-call overhead. + * Constants have been gathered. Loops & conditionals have been removed as + * much as possible for efficiency, in favor of drop-through switches. + * (See "Note A" at the bottom of the file for equivalent code.) + * If your compiler supports it, the "isLegalUTF8" call can be turned + * into an inline function. + */ + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF16toUTF8 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF16* source = *sourceStart; + UTF8* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch; + unsigned short bytesToWrite = 0; + const UTF32 byteMask = 0xBF; + const UTF32 byteMark = 0x80; + const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ + ch = *source++; + /* If we have a surrogate pair, convert to UTF32 first. */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) { + /* If the 16 bits following the high surrogate are in the source buffer... */ + if (source < sourceEnd) { + UTF32 ch2 = *source; + /* If it's a low surrogate, convert to UTF32. */ + if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { + ch = ((ch - UNI_SUR_HIGH_START) << halfShift) + + (ch2 - UNI_SUR_LOW_START) + halfBase; + ++source; + } else if (flags == strictConversion) { /* it's an unpaired high surrogate */ + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + } else { /* We don't have the 16 bits following the high surrogate. */ + --source; /* return to the high surrogate */ + result = sourceExhausted; + break; + } + } else if (flags == strictConversion) { + /* UTF-16 surrogate values are illegal in UTF-32 */ + if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) { + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + } + /* Figure out how many bytes the result will require */ + if (ch < (UTF32)0x80) { bytesToWrite = 1; + } else if (ch < (UTF32)0x800) { bytesToWrite = 2; + } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; + } else if (ch < (UTF32)0x110000) { bytesToWrite = 4; + } else { bytesToWrite = 3; + ch = UNI_REPLACEMENT_CHAR; + } + + target += bytesToWrite; + if (target > targetEnd) { + source = oldSource; /* Back up source pointer! */ + target -= bytesToWrite; result = targetExhausted; break; + } + switch (bytesToWrite) { /* note: everything falls through. */ + case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; + case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; + case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; + case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]); + } + target += bytesToWrite; + } + *sourceStart = source; + *targetStart = target; + return result; +} + +/* --------------------------------------------------------------------- */ + +/* + * Utility routine to tell whether a sequence of bytes is legal UTF-8. + * This must be called with the length pre-determined by the first byte. + * If not calling this from ConvertUTF8to*, then the length can be set by: + * length = trailingBytesForUTF8[*source]+1; + * and the sequence is illegal right away if there aren't that many bytes + * available. + * If presented with a length > 4, this returns false. The Unicode + * definition of UTF-8 goes up to 4-byte sequences. + */ + +static Boolean isLegalUTF8(const UTF8 *source, int length) { + UTF8 a; + const UTF8 *srcptr = source+length; + switch (length) { + default: return false; + /* Everything else falls through when "true"... */ + case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; + case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; + case 2: if ((a = (*--srcptr)) > 0xBF) return false; + + switch (*source) { + /* no fall-through in this inner switch */ + case 0xE0: if (a < 0xA0) return false; break; + case 0xED: if (a > 0x9F) return false; break; + case 0xF0: if (a < 0x90) return false; break; + case 0xF4: if (a > 0x8F) return false; break; + default: if (a < 0x80) return false; + } + + case 1: if (*source >= 0x80 && *source < 0xC2) return false; + } + if (*source > 0xF4) return false; + return true; +} + +/* --------------------------------------------------------------------- */ + +/* + * Exported function to return whether a UTF-8 sequence is legal or not. + * This is not used here; it's just exported. + */ +Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) { + int length = trailingBytesForUTF8[*source]+1; + if (source+length > sourceEnd) { + return false; + } + return isLegalUTF8(source, length); +} + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF8toUTF16 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF8* source = *sourceStart; + UTF16* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch = 0; + unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; + if (source + extraBytesToRead >= sourceEnd) { + result = sourceExhausted; break; + } + /* Do this check whether lenient or strict */ + if (! isLegalUTF8(source, extraBytesToRead+1)) { + result = sourceIllegal; + break; + } + /* + * The cases all fall through. See "Note A" below. + */ + switch (extraBytesToRead) { + case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ + case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ + case 3: ch += *source++; ch <<= 6; + case 2: ch += *source++; ch <<= 6; + case 1: ch += *source++; ch <<= 6; + case 0: ch += *source++; + } + ch -= offsetsFromUTF8[extraBytesToRead]; + + if (target >= targetEnd) { + source -= (extraBytesToRead+1); /* Back up source pointer! */ + result = targetExhausted; break; + } + if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */ + /* UTF-16 surrogate values are illegal in UTF-32 */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { + if (flags == strictConversion) { + source -= (extraBytesToRead+1); /* return to the illegal value itself */ + result = sourceIllegal; + break; + } else { + *target++ = UNI_REPLACEMENT_CHAR; + } + } else { + *target++ = (UTF16)ch; /* normal case */ + } + } else if (ch > UNI_MAX_UTF16) { + if (flags == strictConversion) { + result = sourceIllegal; + source -= (extraBytesToRead+1); /* return to the start */ + break; /* Bail out; shouldn't continue */ + } else { + *target++ = UNI_REPLACEMENT_CHAR; + } + } else { + /* target is a character in range 0xFFFF - 0x10FFFF. */ + if (target + 1 >= targetEnd) { + source -= (extraBytesToRead+1); /* Back up source pointer! */ + result = targetExhausted; break; + } + ch -= halfBase; + *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START); + *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START); + } + } + *sourceStart = source; + *targetStart = target; + return result; +} + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF32toUTF8 ( + const UTF32** sourceStart, const UTF32* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF32* source = *sourceStart; + UTF8* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch; + unsigned short bytesToWrite = 0; + const UTF32 byteMask = 0xBF; + const UTF32 byteMark = 0x80; + ch = *source++; + if (flags == strictConversion ) { + /* UTF-16 surrogate values are illegal in UTF-32 */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + } + /* + * Figure out how many bytes the result will require. Turn any + * illegally large UTF32 things (> Plane 17) into replacement chars. + */ + if (ch < (UTF32)0x80) { bytesToWrite = 1; + } else if (ch < (UTF32)0x800) { bytesToWrite = 2; + } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; + } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4; + } else { bytesToWrite = 3; + ch = UNI_REPLACEMENT_CHAR; + result = sourceIllegal; + } + + target += bytesToWrite; + if (target > targetEnd) { + --source; /* Back up source pointer! */ + target -= bytesToWrite; result = targetExhausted; break; + } + switch (bytesToWrite) { /* note: everything falls through. */ + case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; + case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; + case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; + case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]); + } + target += bytesToWrite; + } + *sourceStart = source; + *targetStart = target; + return result; +} + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF8toUTF32 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF8* source = *sourceStart; + UTF32* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch = 0; + unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; + if (source + extraBytesToRead >= sourceEnd) { + result = sourceExhausted; break; + } + /* Do this check whether lenient or strict */ + if (! isLegalUTF8(source, extraBytesToRead+1)) { + result = sourceIllegal; + break; + } + /* + * The cases all fall through. See "Note A" below. + */ + switch (extraBytesToRead) { + case 5: ch += *source++; ch <<= 6; + case 4: ch += *source++; ch <<= 6; + case 3: ch += *source++; ch <<= 6; + case 2: ch += *source++; ch <<= 6; + case 1: ch += *source++; ch <<= 6; + case 0: ch += *source++; + } + ch -= offsetsFromUTF8[extraBytesToRead]; + + if (target >= targetEnd) { + source -= (extraBytesToRead+1); /* Back up the source pointer! */ + result = targetExhausted; break; + } + if (ch <= UNI_MAX_LEGAL_UTF32) { + /* + * UTF-16 surrogate values are illegal in UTF-32, and anything + * over Plane 17 (> 0x10FFFF) is illegal. + */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) { + if (flags == strictConversion) { + source -= (extraBytesToRead+1); /* return to the illegal value itself */ + result = sourceIllegal; + break; + } else { + *target++ = UNI_REPLACEMENT_CHAR; + } + } else { + *target++ = ch; + } + } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */ + result = sourceIllegal; + *target++ = UNI_REPLACEMENT_CHAR; + } + } + *sourceStart = source; + *targetStart = target; + return result; +} + +/* --------------------------------------------------------------------- + + Note A. + The fall-through switches in UTF-8 reading code save a + temp variable, some decrements & conditionals. The switches + are equivalent to the following loop: + { + int tmpBytesToRead = extraBytesToRead+1; + do { + ch += *source++; + --tmpBytesToRead; + if (tmpBytesToRead) ch <<= 6; + } while (tmpBytesToRead > 0); + } + In UTF-8 writing code, the switches on "bytesToWrite" are + similarly unrolled loops. + + --------------------------------------------------------------------- */ diff --git a/open-vm-tools/lib/string/convertutf.h b/open-vm-tools/lib/string/convertutf.h new file mode 100644 index 000000000..7d173427d --- /dev/null +++ b/open-vm-tools/lib/string/convertutf.h @@ -0,0 +1,152 @@ +/* ********************************************************** + * Copyright 2008 VMware, Inc. All rights reserved. + * **********************************************************/ +/* + * Copyright 2001-2004 Unicode, Inc. + * + * Disclaimer + * + * This source code is provided as is by Unicode, Inc. No claims are + * made as to fitness for any particular purpose. No warranties of any + * kind are expressed or implied. The recipient agrees to determine + * applicability of information provided. If this file has been + * purchased on magnetic or optical media from Unicode, Inc., the + * sole remedy for any claim will be exchange of defective media + * within 90 days of receipt. + * + * Limitations on Rights to Redistribute This Code + * + * Unicode, Inc. hereby grants the right to freely use the information + * supplied in this file in the creation of products supporting the + * Unicode Standard, and to make copies of this file in any form + * for internal or external distribution as long as this notice + * remains attached. + */ + +/* --------------------------------------------------------------------- + + Conversions between UTF32, UTF-16, and UTF-8. Header file. + + Several funtions are included here, forming a complete set of + conversions between the three formats. UTF-7 is not included + here, but is handled in a separate source file. + + Each of these routines takes pointers to input buffers and output + buffers. The input buffers are const. + + Each routine converts the text between *sourceStart and sourceEnd, + putting the result into the buffer between *targetStart and + targetEnd. Note: the end pointers are *after* the last item: e.g. + *(sourceEnd - 1) is the last item. + + The return result indicates whether the conversion was successful, + and if not, whether the problem was in the source or target buffers. + (Only the first encountered problem is indicated.) + + After the conversion, *sourceStart and *targetStart are both + updated to point to the end of last text successfully converted in + the respective buffers. + + Input parameters: + sourceStart - pointer to a pointer to the source buffer. + The contents of this are modified on return so that + it points at the next thing to be converted. + targetStart - similarly, pointer to pointer to the target buffer. + sourceEnd, targetEnd - respectively pointers to the ends of the + two buffers, for overflow checking only. + + These conversion functions take a ConversionFlags argument. When this + flag is set to strict, both irregular sequences and isolated surrogates + will cause an error. When the flag is set to lenient, both irregular + sequences and isolated surrogates are converted. + + Whether the flag is strict or lenient, all illegal sequences will cause + an error return. This includes sequences such as: , , + or in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code + must check for illegal sequences. + + When the flag is set to lenient, characters over 0x10FFFF are converted + to the replacement character; otherwise (when the flag is set to strict) + they constitute an error. + + Output parameters: + The value "sourceIllegal" is returned from some routines if the input + sequence is malformed. When "sourceIllegal" is returned, the source + value will point to the illegal value that caused the problem. E.g., + in UTF-8 when a sequence is malformed, it points to the start of the + malformed sequence. + + Author: Mark E. Davis, 1994. + Rev History: Rick McGowan, fixes & updates May 2001. + Fixes & updates, Sept 2001. + +------------------------------------------------------------------------ */ + +/* --------------------------------------------------------------------- + The following 4 definitions are compiler-specific. + The C standard does not guarantee that wchar_t has at least + 16 bits, so wchar_t is no less portable than unsigned short! + All should be unsigned values to avoid sign extension during + bit mask & shift operations. +------------------------------------------------------------------------ */ + +typedef unsigned long UTF32; /* at least 32 bits */ +typedef unsigned short UTF16; /* at least 16 bits */ +typedef unsigned char UTF8; /* typically 8 bits */ +typedef unsigned char Boolean; /* 0 or 1 */ + +/* Some fundamental constants */ +#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD +#define UNI_MAX_BMP (UTF32)0x0000FFFF +#define UNI_MAX_UTF16 (UTF32)0x0010FFFF +#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF +#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF + +typedef enum { + conversionOK, /* conversion successful */ + sourceExhausted, /* partial character in source, but hit end */ + targetExhausted, /* insuff. room in target for conversion */ + sourceIllegal /* source sequence is illegal/malformed */ +} ConversionResult; + +typedef enum { + strictConversion = 0, + lenientConversion +} ConversionFlags; + +/* This is for C++ and does no harm in C */ +#ifdef __cplusplus +extern "C" { +#endif + +ConversionResult ConvertUTF8toUTF16 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF16toUTF8 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF8toUTF32 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF32toUTF8 ( + const UTF32** sourceStart, const UTF32* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF16toUTF32 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF32toUTF16 ( + const UTF32** sourceStart, const UTF32* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); + +Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); + +#ifdef __cplusplus +} +#endif + +/* --------------------------------------------------------------------- */ diff --git a/open-vm-tools/lib/string/shared/Makefile.am b/open-vm-tools/lib/string/shared/Makefile.am index 4a46a7ed1..968f03189 100644 --- a/open-vm-tools/lib/string/shared/Makefile.am +++ b/open-vm-tools/lib/string/shared/Makefile.am @@ -21,6 +21,7 @@ libString_la_SOURCES = libString_la_SOURCES += ../bsd_output_shared.c libString_la_SOURCES += ../bsd_vsnprintf.c libString_la_SOURCES += ../bsd_vsnwprintf.c +libString_la_SOURCES += ../convertutf.c libString_la_SOURCES += ../str.c AM_CFLAGS = diff --git a/open-vm-tools/lib/string/shared/Makefile.in b/open-vm-tools/lib/string/shared/Makefile.in index 0ce093ccc..1e69b01df 100644 --- a/open-vm-tools/lib/string/shared/Makefile.in +++ b/open-vm-tools/lib/string/shared/Makefile.in @@ -60,7 +60,7 @@ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libString_la_LIBADD = am_libString_la_OBJECTS = bsd_output_shared.lo bsd_vsnprintf.lo \ - bsd_vsnwprintf.lo str.lo + bsd_vsnwprintf.lo convertutf.lo str.lo libString_la_OBJECTS = $(am_libString_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -117,6 +117,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -216,7 +219,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libString.la libString_la_SOURCES = ../bsd_output_shared.c ../bsd_vsnprintf.c \ - ../bsd_vsnwprintf.c ../str.c + ../bsd_vsnwprintf.c ../convertutf.c ../str.c AM_CFLAGS = @COMMON_CFLAGS@ @LIB_STRING_CFLAGS@ all: all-am @@ -272,6 +275,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_output_shared.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_vsnprintf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_vsnwprintf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convertutf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Plo@am__quote@ .c.o: @@ -316,6 +320,13 @@ bsd_vsnwprintf.lo: ../bsd_vsnwprintf.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsd_vsnwprintf.lo `test -f '../bsd_vsnwprintf.c' || echo '$(srcdir)/'`../bsd_vsnwprintf.c +convertutf.lo: ../convertutf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT convertutf.lo -MD -MP -MF $(DEPDIR)/convertutf.Tpo -c -o convertutf.lo `test -f '../convertutf.c' || echo '$(srcdir)/'`../convertutf.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/convertutf.Tpo $(DEPDIR)/convertutf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../convertutf.c' object='convertutf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o convertutf.lo `test -f '../convertutf.c' || echo '$(srcdir)/'`../convertutf.c + str.lo: ../str.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT str.lo -MD -MP -MF $(DEPDIR)/str.Tpo -c -o str.lo `test -f '../str.c' || echo '$(srcdir)/'`../str.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/str.Tpo $(DEPDIR)/str.Plo diff --git a/open-vm-tools/lib/sync/Makefile.in b/open-vm-tools/lib/sync/Makefile.in index 7dabb0447..8bb2d1dfb 100644 --- a/open-vm-tools/lib/sync/Makefile.in +++ b/open-vm-tools/lib/sync/Makefile.in @@ -128,6 +128,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/sync/shared/Makefile.in b/open-vm-tools/lib/sync/shared/Makefile.in index 62d3b74b1..1b32c96c2 100644 --- a/open-vm-tools/lib/sync/shared/Makefile.in +++ b/open-vm-tools/lib/sync/shared/Makefile.in @@ -116,6 +116,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/sync/syncWaitQPosix.c b/open-vm-tools/lib/sync/syncWaitQPosix.c index f8d58df7b..d21c6a1e2 100644 --- a/open-vm-tools/lib/sync/syncWaitQPosix.c +++ b/open-vm-tools/lib/sync/syncWaitQPosix.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #ifdef __APPLE__ @@ -33,7 +34,9 @@ #include "vm_assert.h" #include "str.h" +#include "util.h" #include "syncWaitQ.h" +#include "posix.h" /* @@ -106,8 +109,6 @@ * */ -#define WAITQ_MAX_NAME (WAITQ_MAX_PATH + 40) - typedef union { uint32 fd[2]; uint64 i64; @@ -116,8 +117,7 @@ typedef union { static INLINE Bool SyncWaitQWakeUpNamed(SyncWaitQ *that); static INLINE Bool SyncWaitQWakeUpAnon(SyncWaitQ *that); -static INLINE void SyncWaitQMakeName(const char *path, uint64 seq, - char name[], size_t nameSize); +static INLINE char *SyncWaitQMakeName(const char *path, uint64 seq); #if __APPLE__ @@ -307,11 +307,11 @@ SyncWaitQ_Init(SyncWaitQ *that, // OUT char const *path) // IN/OPT { ASSERT(that); - ASSERT(!path || path[0] ); + ASSERT(!path || path[0]); memset(that, 0, sizeof(SyncWaitQ)); - if( !path ) { + if (!path) { /* * Anonymous */ @@ -335,13 +335,13 @@ SyncWaitQ_Init(SyncWaitQ *that, // OUT } Atomic_Write64(&that->rwHandles, rwHandles.i64); - + that->pathName = NULL; } else { /* * Named */ - strncpy(that->path, path, sizeof that->path); + that->pathName = Util_SafeStrdup(path); } that->initialized = TRUE; @@ -371,7 +371,7 @@ SyncWaitQ_Destroy(SyncWaitQ *that) return; } - if (!that->path[0]) { + if (that->pathName == NULL) { /* * Anonymous */ @@ -395,11 +395,14 @@ SyncWaitQ_Destroy(SyncWaitQ *that) * Named */ uint64 seq; - char name[WAITQ_MAX_NAME]; - + char *name; + seq = Atomic_Read64(&that->seq); - SyncWaitQMakeName(that->path, seq, name, sizeof name); - unlink(name); + name = SyncWaitQMakeName(that->pathName, seq); + Posix_Unlink(name); + free(name); + free(that->pathName); + that->pathName = NULL; } that->initialized = FALSE; @@ -427,7 +430,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN { uint64 seq; int ret = -1; - char name[WAITQ_MAX_NAME]; + char *name = NULL; ASSERT(that); ASSERT(that->initialized); @@ -445,7 +448,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN * has changed, we manufacture our own fd, so any error is harmless. */ - if (!that->path[0]) { + if (that->pathName == NULL) { /* * Anonymous */ @@ -479,7 +482,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN * Named */ - SyncWaitQMakeName(that->path, seq, name, sizeof name); + name = SyncWaitQMakeName(that->pathName, seq); /* * Create fifo object with the generated name @@ -493,7 +496,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN * directory. -- Ticho. */ - ret = mkfifo(name, S_IRUSR | S_IWUSR); + ret = Posix_Mkfifo(name, S_IRUSR | S_IWUSR); if (ret >= 0 || errno == EEXIST) { /* * We open in non-blocking mode so that we won't block if nobody @@ -510,7 +513,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN * -- Ticho. */ - ret = open(name, O_RDONLY | O_NONBLOCK); + ret = Posix_Open(name, O_RDONLY | O_NONBLOCK); if (ret < 0) { SyncWaitQPanicOnFdLimit(errno); } @@ -527,13 +530,14 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN if (ret >= 0) { close(ret); - if (that->path[0]) { - unlink(name); + if (that->pathName != NULL) { + Posix_Unlink(name); } } if (pipe(fd) < 0) { SyncWaitQPanicOnFdLimit(errno); + free(name); return -1; } @@ -541,6 +545,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN fcntl(fd[1], F_SETFL, O_WRONLY | O_NONBLOCK) < 0 ) { close(fd[0]); close(fd[1]); + free(name); return -1; } @@ -558,6 +563,7 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN close(fd[1]); } else { if (ret < 0) { + free(name); return -1; } @@ -589,6 +595,8 @@ SyncWaitQ_Add(SyncWaitQ *that) // IN Atomic_Write(&that->waiters, TRUE); } + free(name); + return ret; } @@ -669,9 +677,8 @@ SyncWaitQ_WakeUp(SyncWaitQ *that) // IN * Slow path --hpreg */ - return that->path[0] ? - SyncWaitQWakeUpNamed(that) : - SyncWaitQWakeUpAnon(that); + return (that->pathName == NULL) ? SyncWaitQWakeUpAnon(that) : + SyncWaitQWakeUpNamed(that); } @@ -692,7 +699,7 @@ SyncWaitQ_WakeUp(SyncWaitQ *that) // IN *---------------------------------------------------------------------------- */ -Bool +static Bool SyncWaitQWakeUpAnon(SyncWaitQ *that) // IN { HandlesAsI64 rwHandles, wakeupHandles; @@ -759,18 +766,18 @@ SyncWaitQWakeUpAnon(SyncWaitQ *that) // IN *---------------------------------------------------------------------------- */ -Bool +static Bool SyncWaitQWakeUpNamed(SyncWaitQ *that) // IN { uint64 seq; - char name[WAITQ_MAX_NAME]; + char *name; int wakeupHandle = -1; int ret; int error; // The following statement is the demarcation line for wakeup seq = Atomic_FetchAndInc64(&that->seq); - SyncWaitQMakeName(that->path, seq, name, sizeof name); + name = SyncWaitQMakeName(that->pathName, seq); /* * We open in non-blocking mode so that we won't block if there is @@ -779,9 +786,11 @@ SyncWaitQWakeUpNamed(SyncWaitQ *that) // IN * system call. */ - wakeupHandle = open(name, O_WRONLY | O_NONBLOCK); + wakeupHandle = Posix_Open(name, O_WRONLY | O_NONBLOCK); error = errno; - unlink(name); + Posix_Unlink(name); + free(name); + if (wakeupHandle < 0) { SyncWaitQPanicOnFdLimit(error); @@ -830,11 +839,9 @@ SyncWaitQWakeUpNamed(SyncWaitQ *that) // IN *---------------------------------------------------------------------- */ -void +static char * SyncWaitQMakeName(const char *path, // IN - uint64 seq, // IN - char name[], // OUT - size_t nameSize) // OUT + uint64 seq) // IN { - Str_Snprintf(name, nameSize, "%s.%"FMT64"x", path, seq); + return Str_SafeAsprintf(NULL, "%s.%"FMT64"x", path, seq); } diff --git a/open-vm-tools/lib/syncDriver/Makefile.in b/open-vm-tools/lib/syncDriver/Makefile.in index fe9c899a4..4833db770 100644 --- a/open-vm-tools/lib/syncDriver/Makefile.in +++ b/open-vm-tools/lib/syncDriver/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/system/Makefile.in b/open-vm-tools/lib/system/Makefile.in index 5dfd018b6..1b797aa3d 100644 --- a/open-vm-tools/lib/system/Makefile.in +++ b/open-vm-tools/lib/system/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/toolsLogger/Makefile.in b/open-vm-tools/lib/toolsLogger/Makefile.in index 1ec273693..edc71a3e7 100644 --- a/open-vm-tools/lib/toolsLogger/Makefile.in +++ b/open-vm-tools/lib/toolsLogger/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/unicode/Makefile.am b/open-vm-tools/lib/unicode/Makefile.am index 2db2ad2b7..be3b27262 100644 --- a/open-vm-tools/lib/unicode/Makefile.am +++ b/open-vm-tools/lib/unicode/Makefile.am @@ -26,5 +26,9 @@ libUnicode_a_SOURCES += unicodeSimpleOperations.c libUnicode_a_SOURCES += unicodeSimpleTransforms.c libUnicode_a_SOURCES += unicodeStatic.c +if NO_ICU +libUnicode_a_SOURCES += unicodeICU.c +endif + AM_CFLAGS = AM_CFLAGS += @COMMON_CFLAGS@ diff --git a/open-vm-tools/lib/unicode/Makefile.in b/open-vm-tools/lib/unicode/Makefile.in index 749bf1296..b559daf9a 100644 --- a/open-vm-tools/lib/unicode/Makefile.in +++ b/open-vm-tools/lib/unicode/Makefile.in @@ -49,6 +49,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@NO_ICU_TRUE@am__append_1 = unicodeICU.c subdir = lib/unicode DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -61,10 +62,16 @@ LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libUnicode_a_AR = $(AR) $(ARFLAGS) libUnicode_a_LIBADD = +am__libUnicode_a_SOURCES_DIST = unicodeCommon.c unicodeSimpleBase.c \ + unicodeSimpleCaseFolding.c unicodeSimpleTypes.c \ + unicodeSimpleOperations.c unicodeSimpleTransforms.c \ + unicodeStatic.c unicodeICU.c +@NO_ICU_TRUE@am__objects_1 = unicodeICU.$(OBJEXT) am_libUnicode_a_OBJECTS = unicodeCommon.$(OBJEXT) \ unicodeSimpleBase.$(OBJEXT) unicodeSimpleCaseFolding.$(OBJEXT) \ unicodeSimpleTypes.$(OBJEXT) unicodeSimpleOperations.$(OBJEXT) \ - unicodeSimpleTransforms.$(OBJEXT) unicodeStatic.$(OBJEXT) + unicodeSimpleTransforms.$(OBJEXT) unicodeStatic.$(OBJEXT) \ + $(am__objects_1) libUnicode_a_OBJECTS = $(am_libUnicode_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -79,7 +86,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libUnicode_a_SOURCES) -DIST_SOURCES = $(libUnicode_a_SOURCES) +DIST_SOURCES = $(am__libUnicode_a_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -121,6 +128,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -222,7 +232,7 @@ noinst_LIBRARIES = libUnicode.a libUnicode_a_SOURCES = unicodeCommon.c unicodeSimpleBase.c \ unicodeSimpleCaseFolding.c unicodeSimpleTypes.c \ unicodeSimpleOperations.c unicodeSimpleTransforms.c \ - unicodeStatic.c + unicodeStatic.c $(am__append_1) AM_CFLAGS = @COMMON_CFLAGS@ all: all-am @@ -272,6 +282,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicodeCommon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicodeICU.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicodeSimpleBase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicodeSimpleCaseFolding.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicodeSimpleOperations.Po@am__quote@ diff --git a/open-vm-tools/lib/unicode/unicodeCommon.c b/open-vm-tools/lib/unicode/unicodeCommon.c index 2c5cb9bc8..3e4e4ebb1 100644 --- a/open-vm-tools/lib/unicode/unicodeCommon.c +++ b/open-vm-tools/lib/unicode/unicodeCommon.c @@ -55,13 +55,6 @@ static const int NonPrintableBytesToEscape[256] = { }; -char * Unicode_EscapeBuffer(const void *buffer, - ssize_t lengthInBytes, - StringEncoding encoding); -static Bool UnicodeSanityCheck(const void *buffer, - ssize_t lengthInBytes, - StringEncoding encoding); - /* *----------------------------------------------------------------------------- * @@ -383,6 +376,10 @@ Unicode_IsBufferValid(const void *buffer, // IN { Unicode result; + if (buffer == NULL) { + return TRUE; + } + if (!UnicodeSanityCheck(buffer, lengthInBytes, encoding)) { return FALSE; } @@ -419,9 +416,12 @@ Bool Unicode_CanGetBytesWithEncoding(ConstUnicode ustr, // IN StringEncoding encoding) // IN { - char *tmp; + void *tmp; - if ((tmp = Unicode_GetAllocBytes(ustr, encoding)) == NULL) { + if (ustr == NULL) { + return TRUE; + } + if ((tmp = UnicodeGetAllocBytesInternal(ustr, encoding, NULL)) == NULL) { return FALSE; } free(tmp); diff --git a/open-vm-tools/lib/unicode/unicodeICU.c b/open-vm-tools/lib/unicode/unicodeICU.c new file mode 100644 index 000000000..c0089d917 --- /dev/null +++ b/open-vm-tools/lib/unicode/unicodeICU.c @@ -0,0 +1,493 @@ +/********************************************************* + * Copyright (C) 2008 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 + * by the Free Software Foundation version 2.1 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + *********************************************************/ + +/* + * unicodeICU.c -- + * + * Unicode functionality that depends on the third-party ICU + * library. + */ + +#include +#include +#include +#include +#include + +#include "util.h" +#include "unicodeBase.h" +#include "unicodeICU.h" + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_CompareWithLocale -- + * + * Compares two strings for equivalence under the collation rules + * of the specified locale. + * + * The caller can specify ignoring differences in accents, case, + * or punctuation. + * + * Results: + * -1 if str1 < str2, 0 if str1 == str2, 1 if str1 > str2. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +int +Unicode_CompareWithLocale(ConstUnicode str1, // IN + ConstUnicode str2, // IN + const char *locale, // IN + UnicodeCompareOption compareOption) // IN +{ + UCollationResult compareResult; + UColAttributeValue comparisonStrength; + UErrorCode status = U_ZERO_ERROR; + int result; + UCollator *coll; + UCharIterator str1Iter; + UCharIterator str2Iter; + + uiter_setUTF8(&str1Iter, (const char *)str1, -1); + uiter_setUTF8(&str2Iter, (const char *)str2, -1); + + switch (compareOption) { + case UNICODE_COMPARE_DEFAULT: + comparisonStrength = UCOL_DEFAULT; + break; + case UNICODE_COMPARE_IGNORE_ACCENTS: + comparisonStrength = UCOL_PRIMARY; + break; + case UNICODE_COMPARE_IGNORE_CASE: + comparisonStrength = UCOL_SECONDARY; + break; + case UNICODE_COMPARE_IGNORE_PUNCTUATION: + comparisonStrength = UCOL_TERTIARY; + break; + default: + NOT_IMPLEMENTED(); + } + + coll = ucol_open(locale, &status); + + ASSERT(U_SUCCESS(status)); + ASSERT(coll); + + if (U_FAILURE(status) || !coll) { + return -1; + } + + // Normalize all strings to NFD before comparing. + ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status); + ucol_setAttribute(coll, UCOL_STRENGTH, comparisonStrength, &status); + + ASSERT(U_SUCCESS(status)); + + compareResult = ucol_strcollIter(coll, &str1Iter, &str2Iter, &status); + + ucol_close(coll); + + if (U_FAILURE(status)) { + // We'll probably only get here if the input wasn't UTF-8. + ASSERT(U_SUCCESS(status)); + return -1; + } + + switch (compareResult) { + case UCOL_LESS: + result = -1; + break; + case UCOL_EQUAL: + result = 0; + break; + case UCOL_GREATER: + result = 1; + break; + default: + NOT_IMPLEMENTED(); + } + + return result; +} + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_Normalize -- + * + * Creates a Unicode string by normalizing the input string + * into a Unicode normal form. + * + * Normalization Form C ("precomposed") ensures that accented + * characters use as few Unicode code points as possible. This + * form is often used on Windows and Linux hosts. + * + * Example: small letter e with acute -> U+00E9 + * + * Normalization Form D ("decomposed") ensures that accented + * characters (e with accent acute) use separate Unicode code + * points for the base letter and accents. This form is used on + * Mac OS hosts. + * + * Example: small letter e with acute -> U+0065 U+0301 + * + * Results: + * The allocated Unicode string, or NULL on failure. + * Caller must free with Unicode_Free(). + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Unicode +Unicode_Normalize(ConstUnicode str, // IN + UnicodeNormalizationForm form) // IN +{ + UNormalizationMode mode; + UChar *uchars; + Unicode result; + int32_t normalizedLen; + UErrorCode status = U_ZERO_ERROR; + UCharIterator strIter; + UBool neededToNormalize = FALSE; + + uiter_setUTF8(&strIter, (const char *)str, -1); + + switch (form) { + case UNICODE_NORMAL_FORM_C: + mode = UNORM_NFC; + break; + case UNICODE_NORMAL_FORM_D: + mode = UNORM_NFD; + break; + default: + NOT_REACHED(); + } + + normalizedLen = unorm_next(&strIter, + NULL, + 0, + mode, + 0, + TRUE, + &neededToNormalize, + &status); + + if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) { + // We expect U_BUFFER_OVERFLOW_ERROR here. Anything else is a problem. + ASSERT(U_SUCCESS(status)); + return NULL; + } + + uchars = Util_SafeMalloc(sizeof *uchars * normalizedLen); + + // Reset back to the beginning of the UTF-8 input. + (*strIter.move)(&strIter, 0, UITER_START); + + status = U_ZERO_ERROR; + normalizedLen = unorm_next(&strIter, + uchars, + normalizedLen, + mode, + 0, + TRUE, + &neededToNormalize, + &status); + + if (U_FAILURE(status)) { + ASSERT(U_SUCCESS(status)); + return NULL; + } + + result = Unicode_AllocWithLength(uchars, + normalizedLen * 2, + STRING_ENCODING_UTF16); + free(uchars); + + return result; +} + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_ToLower -- + * + * Creates a Unicode string by lower-casing the input string using + * the rules of the specified locale. + * + * The resulting string may not be the same length as the input + * string. + * + * Pass NULL for the locale to use the process's default locale. + * + * Results: + * The allocated Unicode string, or NULL on failure. + * Caller must free with Unicode_Free(). + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Unicode +Unicode_ToLower(ConstUnicode str, // IN + const char *locale) // IN +{ + UCaseMap *caseMap; + UErrorCode status = U_ZERO_ERROR; + char *utf8Dest; + const char *utf8Src = (const char *)str; + int32_t utf8SrcLen = strlen(utf8Src); + int32_t destCapacity = utf8SrcLen + 1; + int32_t destLen; + Unicode result = NULL; + + /* + * XXX TODO: This and the two following functions are substantially + * identical. Refactor them! (Note that ucasemap_utf8ToTitle + * takes a non-const UCaseMap, so we can't just use pointers to + * functions unless we cast.) + */ + + // Most lower-case operations don't change the length of the string. + utf8Dest = (char *)Util_SafeMalloc(destCapacity); + + caseMap = ucasemap_open(locale, 0, &status); + if (U_FAILURE(status)) { + goto out; + } + + destLen = ucasemap_utf8ToLower(caseMap, + utf8Dest, + destCapacity, + utf8Src, + utf8SrcLen, + &status); + + if (status != U_BUFFER_OVERFLOW_ERROR) { + goto out; + } + + // If we need a bigger buffer, then reallocate and retry. + destCapacity = destLen + 1; + utf8Dest = (char *)Util_SafeRealloc(utf8Dest, destCapacity); + + status = U_ZERO_ERROR; + destLen = ucasemap_utf8ToLower(caseMap, + utf8Dest, + destCapacity, + utf8Src, + utf8SrcLen, + &status); + + out: + ucasemap_close(caseMap); + + if (U_SUCCESS(status) && status != U_STRING_NOT_TERMINATED_WARNING) { + result = (Unicode)utf8Dest; + } else { + ASSERT(U_SUCCESS(status)); + ASSERT(status != U_STRING_NOT_TERMINATED_WARNING); + } + + return result; +} + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_ToUpper -- + * + * Creates a Unicode string by upper-casing the input string using + * the rules of the specified locale. + * + * The resulting string may not be the same length as the input + * string. + * + * Pass NULL for the locale to use the process's default locale. + * + * Results: + * The allocated Unicode string, or NULL on failure. + * Caller must free with Unicode_Free(). + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Unicode +Unicode_ToUpper(ConstUnicode str, // IN + const char *locale) // IN +{ + UCaseMap *caseMap; + UErrorCode status = U_ZERO_ERROR; + char *utf8Dest; + const char *utf8Src = (const char *)str; + int32_t utf8SrcLen = strlen(utf8Src); + int32_t destCapacity = utf8SrcLen + 1; + int32_t destLen; + Unicode result = NULL; + + // Most upper-case operations don't change the length of the string. + utf8Dest = (char *)Util_SafeMalloc(destCapacity); + + caseMap = ucasemap_open(locale, 0, &status); + if (U_FAILURE(status)) { + goto out; + } + + destLen = ucasemap_utf8ToUpper(caseMap, + utf8Dest, + destCapacity, + utf8Src, + utf8SrcLen, + &status); + + if (status != U_BUFFER_OVERFLOW_ERROR) { + goto out; + } + + // If we need a bigger buffer, then reallocate and retry. + destCapacity = destLen + 1; + utf8Dest = (char *)Util_SafeRealloc(utf8Dest, destCapacity); + + status = U_ZERO_ERROR; + destLen = ucasemap_utf8ToUpper(caseMap, + utf8Dest, + destCapacity, + utf8Src, + utf8SrcLen, + &status); + + out: + ucasemap_close(caseMap); + + if (U_SUCCESS(status) && status != U_STRING_NOT_TERMINATED_WARNING) { + result = (Unicode)utf8Dest; + } else { + ASSERT(U_SUCCESS(status)); + ASSERT(status != U_STRING_NOT_TERMINATED_WARNING); + } + + return result; +} + +/* + * "ucasemap_utf8ToTitle" is not in version 3.6 of the ICU library, + * which appears to be the default on many systems... + * + * XXX Currently HAVE_ICU_38 is only set by the open-source tools + * build (based on what it detects on the current system) because that + * is the only entity currently capable of compiling with USE_ICU. + */ + +#ifdef HAVE_ICU_38 + +/* + *----------------------------------------------------------------------------- + * + * Unicode_ToTitle -- + * + * Creates a Unicode string by title-casing the input string using + * the rules of the specified locale. + * + * The resulting string may not be the same length as the input + * string. + * + * Pass NULL for the locale to use the process's default locale. + * + * Results: + * The allocated Unicode string, or NULL on failure. + * Caller must free with Unicode_Free(). + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Unicode +Unicode_ToTitle(ConstUnicode str, // IN + const char *locale) // IN +{ + UCaseMap *caseMap; + UErrorCode status = U_ZERO_ERROR; + char *utf8Dest; + const char *utf8Src = (const char *)str; + int32_t utf8SrcLen = strlen(utf8Src); + int32_t destCapacity = utf8SrcLen + 1; + int32_t destLen; + Unicode result = NULL; + + // Most title-case operations don't change the length of the string. + utf8Dest = (char *)Util_SafeMalloc(destCapacity); + + caseMap = ucasemap_open(locale, 0, &status); + if (U_FAILURE(status)) { + goto out; + } + + destLen = ucasemap_utf8ToTitle(caseMap, + utf8Dest, + destCapacity, + utf8Src, + utf8SrcLen, + &status); + + if (status != U_BUFFER_OVERFLOW_ERROR) { + goto out; + } + + // If we need a bigger buffer, then reallocate and retry. + destCapacity = destLen + 1; + utf8Dest = (char *)Util_SafeRealloc(utf8Dest, destCapacity); + + status = U_ZERO_ERROR; + destLen = ucasemap_utf8ToTitle(caseMap, + utf8Dest, + destCapacity, + utf8Src, + utf8SrcLen, + &status); + + out: + ucasemap_close(caseMap); + + if (U_SUCCESS(status) && status != U_STRING_NOT_TERMINATED_WARNING) { + result = (Unicode)utf8Dest; + } else { + ASSERT(U_SUCCESS(status)); + ASSERT(status != U_STRING_NOT_TERMINATED_WARNING); + } + + return result; +} + +#endif // HAVE_ICU_38 diff --git a/open-vm-tools/lib/unicode/unicodeInt.h b/open-vm-tools/lib/unicode/unicodeInt.h deleted file mode 100644 index 0a00a3a82..000000000 --- a/open-vm-tools/lib/unicode/unicodeInt.h +++ /dev/null @@ -1,50 +0,0 @@ -/********************************************************* - * Copyright (C) 2007 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 - * by the Free Software Foundation version 2.1 and no later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - *********************************************************/ - -/* - * unicodeInt.h -- - * - * Internal functions common to all implementations of the - * Unicode library. - */ - -#ifndef _UNICODE_INT_H -#define _UNICODE_INT_H - -#include "unicodeTypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -Unicode UnicodeAllocInternal(const void *buffer, - ssize_t lengthInBytes, - StringEncoding encoding); -Unicode UnicodeAllocStatic(const char *asciiBytes, - Bool unescape); - -void UnicodePinIndices(ConstUnicode str, - UnicodeIndex *strStart, - UnicodeIndex *strLength); -utf16_t UnicodeSimpleCaseFold(utf16_t codeUnit); - -#ifdef __cplusplus -} -#endif - -#endif // _UNICODE_INT_H diff --git a/open-vm-tools/lib/unicode/unicodeSimpleBase.c b/open-vm-tools/lib/unicode/unicodeSimpleBase.c index 7646df27f..da414d3f1 100644 --- a/open-vm-tools/lib/unicode/unicodeSimpleBase.c +++ b/open-vm-tools/lib/unicode/unicodeSimpleBase.c @@ -34,8 +34,9 @@ * ConstUnicode function on the same string. */ -#include "vmware.h" +#include +#include "vmware.h" #include "util.h" #include "codeset.h" #include "str.h" @@ -85,6 +86,8 @@ UnicodeAllocInternal(const void *buffer, // IN { char *utf8Result = NULL; + ASSERT(buffer != NULL); + switch (encoding) { case STRING_ENCODING_US_ASCII: /* @@ -124,12 +127,6 @@ UnicodeAllocInternal(const void *buffer, // IN NULL); break; default: - /* - * XXX TODO: This is not correct. We don't yet have a - * cross-platform library that can convert from an arbitrary - * encoding to UTF-8, so this is a stopgap measure to get us - * going in the meantime. - */ if (lengthInBytes == -1) { /* * TODO: This doesn't work for UTF-16 BE, UTF-32, and other @@ -137,11 +134,9 @@ UnicodeAllocInternal(const void *buffer, // IN */ lengthInBytes = strlen((const char *)buffer); } - - CodeSet_CurrentToUtf8((const char *)buffer, - lengthInBytes, - &utf8Result, - NULL); + CodeSet_GenericToGeneric(Unicode_EncodingEnumToName(encoding), + buffer, lengthInBytes, + "UTF-8", CSGTG_NORMAL, &utf8Result, NULL); break; } @@ -211,7 +206,8 @@ Unicode_Free(Unicode str) // IN * * Results: * An allocated list (vector) of Unicode strings. - * The result must be freed with Unicode_FreeList. + * The individual strings must be freed with Unicode_Free, + * or the entire list can be free with Unicode_FreeList. * * Side effects: * None @@ -264,7 +260,7 @@ Unicode_AllocList(char **srcList, // IN: list of strings * None * * Side effects: - * None + * errno or Windows last error is preserved. * *----------------------------------------------------------------------------- */ @@ -273,20 +269,58 @@ void Unicode_FreeList(Unicode *list, // IN: the list to free ssize_t length) // IN: the length { - if (length >= 0) { - ssize_t i; - for (i = 0; i < length; i++) { - Unicode_Free(list[i]); - DEBUG_ONLY(list[i] = NULL); - } - } else { - Unicode *s; - for (s = list; *s != NULL; s++) { - Unicode_Free(*s); - DEBUG_ONLY(*s = NULL); + Util_FreeStringList(list, length); +} + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_GetAllocList -- + * + * Allocates a list (actually a vector) of NUL terminated buffers from a + * list (vector) of strings of specified encoding. + * The input list has a specified length or can be an argv-style + * NULL-terminated list (if length is negative). + * + * Results: + * An allocated list (vector) of NUL terminated buffers. + * The caller is responsible to free the memory allocated by + * this routine. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +Unicode * +Unicode_GetAllocList(Unicode const srcList[], // IN: list of strings + ssize_t length, // IN: list + StringEncoding encoding) // IN: +{ + Unicode *dstList = NULL; + ssize_t i; + + ASSERT(srcList != NULL); + + if (length < 0) { + length = 0; + while (srcList[length] != NULL) { + length++; } + + /* Include the sentinel element. */ + length++; + } + + dstList = Util_SafeMalloc(length * sizeof *dstList); + + for (i = 0; i < length; i++) { + dstList[i] = Unicode_GetAllocBytes(srcList[i], encoding); } - free(list); + + return dstList; } @@ -488,6 +522,10 @@ Unicode_CopyBytes(void *destBuffer, // OUT switch (encoding) { case STRING_ENCODING_US_ASCII: + if (!UnicodeSanityCheck(utf8Str, -1, encoding)) { + break; + } + // fall through case STRING_ENCODING_UTF8: { size_t len = strlen(utf8Str); @@ -533,18 +571,17 @@ Unicode_CopyBytes(void *destBuffer, // OUT break; } - case STRING_ENCODING_DEFAULT: - defaultEncoding: + default: { char *currentBuf; size_t currentBufSize; - if (!CodeSet_Utf8ToCurrent(utf8Str, - strlen(utf8Str), - ¤tBuf, - ¤tBufSize)) { - break; - } + if (!CodeSet_GenericToGeneric("UTF-8", utf8Str, strlen(utf8Str), + Unicode_EncodingEnumToName(encoding), + CSGTG_NORMAL, + ¤tBuf, ¤tBufSize)) { + break; + } copyBytes = MIN(currentBufSize, maxLengthInBytes - 1); memcpy(destBuffer, currentBuf, copyBytes); free(currentBuf); @@ -560,14 +597,7 @@ Unicode_CopyBytes(void *destBuffer, // OUT if (copyBytes < currentBufSize) { notTruncated = FALSE; } - break; } - default: - /* - * XXX TODO: We need CodeSet_Utf8ToGeneric() to implement this. - */ - goto defaultEncoding; // XXX - for [254880] fix this when ICU - // converter work is finished. break; } @@ -578,6 +608,117 @@ Unicode_CopyBytes(void *destBuffer, // OUT } +/* + *----------------------------------------------------------------------------- + * + * Unicode_GetAllocBytes -- + * + * Allocates and returns a NUL terminated buffer into which the contents + * of the unicode string are extracted using the specified encoding. + * + * NOTE: The length of the NUL can depend on the encoding. + * UTF-16 NUL is "\0\0"; UTF-32 NUL is "\0\0\0\0". + * + * NULL is returned for NULL argument. + * + * Results: + * Pointer to the dynamically allocated memory, + * or NULL on NULL argument. + * The caller is responsible to free the memory allocated + * by this routine. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +void * +Unicode_GetAllocBytes(ConstUnicode str, // IN: + StringEncoding encoding) // IN: +{ + void *result; + + if (str == NULL) { + return NULL; + } + + result = UnicodeGetAllocBytesInternal(str, encoding, NULL); + ASSERT_NOT_IMPLEMENTED(result != NULL); + return result; +} + + +/* + *----------------------------------------------------------------------------- + * + * UnicodeGetAllocBytesInternal -- + * + * Encodes the Unicode string using the specified encoding into + * an allocated, null-terminated buffer. + * + * Results: + * The converted string in an allocated buffer, + * or NULL on conversion or memory allocation failure. + * + * The length of the result (in bytes, without termination) + * in retLength. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +void * +UnicodeGetAllocBytesInternal(ConstUnicode ustr, // IN + StringEncoding encoding, // IN + size_t *retLength) // OUT: optional +{ + const char *utf8Str = ustr; + size_t len; + char *result = NULL; + + ASSERT(ustr != NULL); + + len = strlen(utf8Str); + + switch (encoding) { + case STRING_ENCODING_US_ASCII: + if (!UnicodeSanityCheck(utf8Str, len, encoding)) { + break; + } + // fall through + case STRING_ENCODING_UTF8: + if ((result = malloc(len + 1)) == NULL) { + break; + } + memcpy(result, utf8Str, len + 1); + if (retLength != NULL) { + *retLength = len; + } + break; + + case STRING_ENCODING_UTF16: + case STRING_ENCODING_UTF16_LE: + if (!CodeSet_Utf8ToUtf16le(utf8Str, len, &result, retLength)) { + ASSERT(result == NULL); + } + break; + + default: + if (!CodeSet_GenericToGeneric("UTF-8", utf8Str, len, + Unicode_EncodingEnumToName(encoding), + CSGTG_NORMAL, + &result, retLength)) { + ASSERT(result == NULL); + } + } + + return result; +} + + /* *----------------------------------------------------------------------------- * diff --git a/open-vm-tools/lib/unicode/unicodeSimpleTypes.c b/open-vm-tools/lib/unicode/unicodeSimpleTypes.c index a3e80e270..694ee6096 100644 --- a/open-vm-tools/lib/unicode/unicodeSimpleTypes.c +++ b/open-vm-tools/lib/unicode/unicodeSimpleTypes.c @@ -2151,91 +2151,6 @@ static struct xRef { }; -/* - * Table generated from selected encodings supported by ICU: - * - * http://source.icu-project.org/repos/icu/icu/trunk/source/data/mappings/convrtrs.txt - * - * If you update this, you must keep the StringEncoding enum in - * lib/public/unicodeTypes.h in sync! - */ -static const char *SIMPLE_ENCODING_LIST[STRING_ENCODING_MAX_SPECIFIED] = { - /* - * Byte string encodings that support all characters in Unicode. - */ - "UTF-8", // STRING_ENCODING_UTF8 - "UTF-16", // STRING_ENCODING_UTF16 - "UTF-16LE", // STRING_ENCODING_UTF16_LE - "UTF-16BE", // STRING_ENCODING_UTF16_BE - - "UTF-32", // STRING_ENCODING_UTF32 - "UTF-32LE", // STRING_ENCODING_UTF32_LE - "UTF-32BE", // STRING_ENCODING_UTF32_BE - - /* - * Legacy byte string encodings that only support a subset of Unicode. - */ - - /* - * Latin encodings - */ - "US-ASCII", // STRING_ENCODING_US_ASCII - "ISO-8859-1", // STRING_ENCODING_ISO_8859_1 - "ISO-8859-2", // STRING_ENCODING_ISO_8859_2 - "ISO-8859-3", // STRING_ENCODING_ISO_8859_3 - "ISO-8859-4", // STRING_ENCODING_ISO_8859_4 - "ISO-8859-5", // STRING_ENCODING_ISO_8859_5 - "ISO-8859-6", // STRING_ENCODING_ISO_8859_6 - "ISO-8859-7", // STRING_ENCODING_ISO_8859_7 - "ISO-8859-8", // STRING_ENCODING_ISO_8859_8 - "ISO-8859-9", // STRING_ENCODING_ISO_8859_9 - "ISO-8859-10", // STRING_ENCODING_ISO_8859_10 - // ISO-8859-11 is unused - // Oddly, there is no ISO-8859-12. - "ISO-8859-13", // STRING_ENCODING_ISO_8859_13 - "ISO-8859-14", // STRING_ENCODING_ISO_8859_14 - "ISO-8859-15", // STRING_ENCODING_ISO_8859_15 - - /* - * Chinese encodings - */ - "GB18030", // STRING_ENCODING_GB_18030 - "Big5", // STRING_ENCODING_BIG_5 - "Big5-HKSCS", // STRING_ENCODING_BIG_5_HK - "GBK", // STRING_ENCODING_GBK - "GB2312", // STRING_ENCODING_GB_2312 - "ISO-2022-CN", // STRING_ENCODING_ISO_2022_CN - - /* - * Japanese encodings - */ - "Shift_JIS", // STRING_ENCODING_SHIFT_JIS - "EUC-JP", // STRING_ENCODING_EUC_JP - "ISO-2022-JP", // STRING_ENCODING_ISO_2022_JP - "ISO-2022-JP-1", // STRING_ENCODING_ISO_2022_JP_1 - "ISO-2022-JP-2", // STRING_ENCODING_ISO_2022_JP_2 - - /* - * Korean encodings - */ - "EUC-KR", // STRING_ENCODING_EUC_KR - "ISO-2022-KR", // STRING_ENCODING_ISO_2022_KR - - /* - * Windows encodings - */ - "windows-1250", // STRING_ENCODING_WINDOWS_1250 - "windows-1251", // STRING_ENCODING_WINDOWS_1251 - "windows-1252", // STRING_ENCODING_WINDOWS_1252 - "windows-1253", // STRING_ENCODING_WINDOWS_1253 - "windows-1254", // STRING_ENCODING_WINDOWS_1254 - "windows-1255", // STRING_ENCODING_WINDOWS_1255 - "windows-1256", // STRING_ENCODING_WINDOWS_1256 - "windows-1257", // STRING_ENCODING_WINDOWS_1257 - "windows-1258", // STRING_ENCODING_WINDOWS_1258 -}; - - /* *----------------------------------------------------------------------------- * @@ -2414,30 +2329,37 @@ UnicodeIANANameLookup(const char *encodingName) // IN const char * Unicode_EncodingEnumToName(StringEncoding encoding) // IN { + int i; + // STRING_ENCODING_UNKNOWN shouldn't be hit at runtime. ASSERT(encoding != STRING_ENCODING_UNKNOWN); switch (encoding) { + case STRING_ENCODING_UNKNOWN: /* * We will only get here in non-debug builds. Fall through to * the process-default encoding name. */ - case STRING_ENCODING_DEFAULT: + case STRING_ENCODING_DEFAULT: return UnicodeIANANameLookup(CodeSet_GetCurrentCodeSet()); break; + default: - ASSERT(Unicode_IsEncodingSupported(encoding)); - - if ( encoding < STRING_ENCODING_FIRST - || encoding >= STRING_ENCODING_MAX_SPECIFIED) { - const char *defaultEncoding = "UTF-8"; - Log("%s: Unknown encoding %d, returning default (%s).", - __FUNCTION__, encoding, defaultEncoding); - return defaultEncoding; + /* + * Look for a match in the xRef table. If found, return the + * preferred MIME name. Whether ICU supports this encoding or + * not isn't material here. + */ + for (i = 0; i < ARRAYSIZE(xRef); i++) { + if (encoding == xRef[i].encoding) { + return xRef[i].names[xRef[i].preferredMime]; + } } - return SIMPLE_ENCODING_LIST[encoding]; + Log("%s: Unknown encoding %d, returning default (UTF-8).", + __FUNCTION__, encoding); + return "UTF-8"; } } @@ -2515,7 +2437,175 @@ Unicode_GetCurrentEncoding(void) // IN Bool Unicode_IsEncodingSupported(StringEncoding encoding) // IN +{ + /* + * Get alias assumed to be understood by ICU. + */ + const char *name = Unicode_EncodingEnumToName(encoding); + + if (!name) { + return FALSE; + } + + /* + * Ask ICU (codeset will fall back onto a reverse-lookup into the + * above table if no ICU is available, which is functionally + * equivalent to what Unicode_IsEncodingSupported did pre-ICU + * anyways). + */ + return CodeSet_IsEncodingSupported(name); +} + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_IsEncodingValid -- + * + * Checks whether the specified encoding value is valid (not + * necessarily whether we support it). + * + * Results: + * TRUE if legal, FALSE otherwise. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +Bool +Unicode_IsEncodingValid(StringEncoding encoding) // IN { return encoding >= STRING_ENCODING_FIRST && encoding < STRING_ENCODING_MAX_SPECIFIED; } + + +/* + *----------------------------------------------------------------------------- + * + * Unicode_Init -- + * + * Convert argv and environment from default encoding into unicode + * and initialize the cache of the native code set name used to + * resolve STRING_ENCODING_DEFAULT. + * + * Results: + * returns on success + * errors are terminal + * + * Side effects: + * Calling Unicode_AllocList initializes the cache of the native code + * set name used in CodeSet_GetCurrentCodeSet(). The cached name is + * used to resolve references to STRING_ENCODING_DEFAULT in unicode + * functions. When Unicode_Init is called with NULL argv/envp, + * CodeSet_GetCurrentCodeSet is called explicitly to initialize the + * code set name. + * + *----------------------------------------------------------------------------- + */ + +void +Unicode_Init(int argc, // IN + char ***argv, // IN/OUT + char ***envp) // IN/OUT +{ +#if !defined(__APPLE__) && !defined(VMX86_SERVER) + char **list; +#endif + + /* + * Always init the codeset module first. + */ + + if (!CodeSet_Init()) { + Panic("Failed to initialize codeset.\n"); + exit(1); + } + +#if defined(__APPLE__) || defined(VMX86_SERVER) + + return; // native encoding is UTF-8 + +#else + + if (!argv && !envp) { + CodeSet_GetCurrentCodeSet(); + return; + } + + if (argv) { + list = Unicode_AllocList(*argv, argc + 1, STRING_ENCODING_DEFAULT); + if (!list) { + goto bail; + } + *argv = list; + } + + if (envp) { + list = Unicode_AllocList(*envp, -1, STRING_ENCODING_DEFAULT); + if (!list) { + goto bail; + } + *envp = list; + } + + return; + +bail: + Panic("Unsupported local character encoding \"%s\".\n", + Unicode_EncodingEnumToName(STRING_ENCODING_DEFAULT)); + exit(1); + +#endif // __APPLE__ +} + +#if defined(_WIN32) +void +Unicode_InitW(int argc, // IN + utf16_t **wargv, // IN + utf16_t **wenvp, // IN + char ***argv, // OUT + char ***envp) // OUT +{ + char **list; + + /* + * Always init the codeset module first. + */ + + if (!CodeSet_Init()) { + Panic("Failed to initialize codeset.\n"); + exit(1); + } + + if (!wargv && !wenvp) { + CodeSet_GetCurrentCodeSet(); + return; + } + + if (wargv) { + list = Unicode_AllocList((char **)wargv, argc + 1, STRING_ENCODING_UTF16); + if (!list) { + goto bail; + } + *argv = list; + } + + if (wenvp) { + list = Unicode_AllocList((char **)wenvp, -1, STRING_ENCODING_UTF16); + if (!list) { + goto bail; + } + *envp = list; + } + + return; + +bail: + Panic("Unsupported character encoding \"%s\".\n", + Unicode_EncodingEnumToName(STRING_ENCODING_UTF16)); + exit(1); +} +#endif diff --git a/open-vm-tools/lib/unicode/unicodeSimpleUTF16.h b/open-vm-tools/lib/unicode/unicodeSimpleUTF16.h deleted file mode 100644 index 2724e60c7..000000000 --- a/open-vm-tools/lib/unicode/unicodeSimpleUTF16.h +++ /dev/null @@ -1,222 +0,0 @@ -/* ********************************************************** - * Copyright 2007 VMware, Inc. All rights reserved. - * **********************************************************/ - -/* - * unicodeSimpleUTF16.h -- - * - * UTF-16 handling macros. Based on utf16.h from ICU 1.8.1. - * - * ICU 1.8.1 license follows: - * - * ICU License - ICU 1.8.1 and later - * - * COPYRIGHT AND PERMISSION NOTICE - * - * Copyright (c) 1995-2006 International Business Machines Corporation - * and others - * - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any - * person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all - * copies of the Software and that both the above copyright - * notice(s) and this permission notice appear in supporting - * documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT - * SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE - * BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR - * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Except as contained in this notice, the name of a - * copyright holder shall not be used in advertising or otherwise - * to promote the sale, use or other dealings in this Software - * without prior written authorization of the copyright holder. - */ - -#ifndef _UNICODE_SIMPLE_UTF16_H -#define _UNICODE_SIMPLE_UTF16_H - -#include "unicodeTypes.h" - -/** - * Is this code point a surrogate (U+d800..U+dfff)? - * @param c 32-bit code point - * @return TRUE or FALSE - * @stable ICU 2.4 - */ -#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) - -/** - * Does this code unit alone encode a code point (BMP, not a surrogate)? - * @param c 16-bit code unit - * @return TRUE or FALSE - * @stable ICU 2.4 - */ -#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) - -/** - * Is this code unit a lead surrogate (U+d800..U+dbff)? - * @param c 16-bit code unit - * @return TRUE or FALSE - * @stable ICU 2.4 - */ -#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) - -/** - * Is this code unit a trail surrogate (U+dc00..U+dfff)? - * @param c 16-bit code unit - * @return TRUE or FALSE - * @stable ICU 2.4 - */ -#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) - -/** - * Is this code unit a surrogate (U+d800..U+dfff)? - * @param c 16-bit code unit - * @return TRUE or FALSE - * @stable ICU 2.4 - */ -#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) - -/** - * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), - * is it a lead surrogate? - * @param c 16-bit code unit - * @return TRUE or FALSE - * @stable ICU 2.4 - */ -#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) - -/** - * Helper constant for U16_GET_SUPPLEMENTARY. - * @internal - */ -#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) - -/** - * Get a supplementary code point value (U+10000..U+10ffff) - * from its lead and trail surrogates. - * The result is undefined if the input values are not - * lead and trail surrogates. - * - * @param lead lead surrogate (U+d800..U+dbff) - * @param trail trail surrogate (U+dc00..U+dfff) - * @return supplementary code point (U+10000..U+10ffff) - * @stable ICU 2.4 - */ -#define U16_GET_SUPPLEMENTARY(lead, trail) \ - (((uint32)(lead)<<10UL)+(uint32)(trail)-U16_SURROGATE_OFFSET) - - -/** - * Get the lead surrogate (0xd800..0xdbff) for a - * supplementary code point (0x10000..0x10ffff). - * @param supplementary 32-bit code point (U+10000..U+10ffff) - * @return lead surrogate (U+d800..U+dbff) for supplementary - * @stable ICU 2.4 - */ -#define U16_LEAD(supplementary) (utf16_t)(((supplementary)>>10)+0xd7c0) - -/** - * Get the trail surrogate (0xdc00..0xdfff) for a - * supplementary code point (0x10000..0x10ffff). - * @param supplementary 32-bit code point (U+10000..U+10ffff) - * @return trail surrogate (U+dc00..U+dfff) for supplementary - * @stable ICU 2.4 - */ -#define U16_TRAIL(supplementary) (utf16_t)(((supplementary)&0x3ff)|0xdc00) - -/** - * How many 16-bit code units are used to encode this Unicode code point? (1 or 2) - * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff). - * @param c 32-bit code point - * @return 1 or 2 - * @stable ICU 2.4 - */ -#define U16_LENGTH(c) ((uint32)(c)<=0xffff ? 1 : 2) - -/** - * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff). - * @return 2 - * @stable ICU 2.4 - */ -#define U16_MAX_LENGTH 2 - -/** - * Get a code point from a string at a code point boundary offset, - * and advance the offset to the next code point boundary. - * (Post-incrementing forward iteration.) - * "Safe" macro, handles unpaired surrogates and checks for string boundaries. - * - * The offset may point to the lead surrogate unit - * for a supplementary code point, in which case the macro will read - * the following trail surrogate as well. - * If the offset points to a trail surrogate or - * to a single, unpaired lead surrogate, then that itself - * will be returned as the code point. - * - * @param s const utf16_t * string - * @param i string offset, must be i(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ - --(i); \ - (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ - } \ - } \ - } - -#endif // _UNICODE_SIMPLE_UTF16_H diff --git a/open-vm-tools/lib/unicode/unicodeStatic.c b/open-vm-tools/lib/unicode/unicodeStatic.c index 76368df3f..4f416df54 100644 --- a/open-vm-tools/lib/unicode/unicodeStatic.c +++ b/open-vm-tools/lib/unicode/unicodeStatic.c @@ -28,9 +28,9 @@ * * ConstUnicode c = U_UNESCAPE("Copyright \\u00A9 VMware, Inc."); * - * Uses two HashTables to hold static ConstUnicode strings, - * protected by a single mutex. Static ConstUnicode strings are - * keyed off the ASCII bytes passed to the static macros. + * Uses two HashTables to hold static ConstUnicode strings. Static + * ConstUnicode strings are keyed off the ASCII bytes passed to the + * static macros. * * Unescaped strings are kept separate from escaped strings so * users can expect a literal "\\" to stay as-is by default. @@ -49,49 +49,37 @@ #include "vmware.h" #include "hashTable.h" -#include "syncMutex.h" +#include "vm_atomic.h" +#include "hashTable.h" #include "unicodeBase.h" #include "unicodeInt.h" #include "util.h" -static HashTable *UnicodeStaticStringTable = NULL; -static HashTable *UnicodeStaticUnescapedStringTable = NULL; - -static void UnicodeStaticCreateTableIfNeeded(HashTable **table); +/* These are Implicitly initialized to NULL */ +static Atomic_Ptr UnicodeStringTable; +static Atomic_Ptr UnicodeUnescapedStringTable; /* *----------------------------------------------------------------------------- * - * UnicodeStaticCreateTableIfNeeded -- + * UnicodeHashFree -- * - * Helper function to create a static 7-bit ASCII -> Unicode - * string table if needed. + * Called by the hash table functions when a value must be replaced. * * Results: - * None + * The argument, a unicode, is freed. * * Side effects: - * If *table is NULL, allocates a HashTable to use ASCII string keys - * and stores the result in *table. + * None. * *----------------------------------------------------------------------------- */ -void -UnicodeStaticCreateTableIfNeeded(HashTable **table) // OUT +static void +UnicodeHashFree(void *v) // IN: { - if (!*table) { - /* - * We don't supply a free function, since these strings are - * never freed. - * - * We use HASH_STRING_KEY to use the 7-bit ASCII strings passed - * to Unicode_GetStatic() as the lookup key into the hash, to - * avoid creating the same string multiple times. - */ - *table = HashTable_Alloc(4096, HASH_STRING_KEY, NULL); - } + Unicode_Free((Unicode) v); } @@ -114,8 +102,8 @@ UnicodeStaticCreateTableIfNeeded(HashTable **table) // OUT * caller does not need to free. * * Side effects: - * Creates UnicodeStaticStringTable and UnicodeStaticUnescapedStringTable - * if they don't yet exist. + * Creates the UnicodeStringTable and UnicodeUnescapedStringTable hash + * tables if it don't yet exist. * Creates and inserts a Unicode string into the appropriate static * string table if the key 'asciiBytes' is not found in the table. * @@ -126,32 +114,40 @@ ConstUnicode Unicode_GetStatic(const char *asciiBytes, // IN Bool unescape) // IN { - static Atomic_Ptr lckStorage; - SyncMutex *lck; Unicode result = NULL; HashTable *stringTable; - lck = SyncMutex_CreateSingleton(&lckStorage); - SyncMutex_Lock(lck); - - UnicodeStaticCreateTableIfNeeded(&UnicodeStaticUnescapedStringTable); - UnicodeStaticCreateTableIfNeeded(&UnicodeStaticStringTable); - if (unescape) { - stringTable = UnicodeStaticUnescapedStringTable; + stringTable = HashTable_AllocOnce(&UnicodeUnescapedStringTable, 4096, + HASH_FLAG_ATOMIC | HASH_STRING_KEY, + UnicodeHashFree); } else { - stringTable = UnicodeStaticStringTable; + stringTable = HashTable_AllocOnce(&UnicodeStringTable, 4096, + HASH_FLAG_ATOMIC | HASH_STRING_KEY, + UnicodeHashFree); } - if (!HashTable_Lookup(stringTable, asciiBytes, (void **)&result)) { - result = UnicodeAllocStatic(asciiBytes, unescape); - - if (result) { - HashTable_Insert(stringTable, asciiBytes, result); + /* + * Attempt a lookup for the key value; if it is found things are easy and + * fine. Otherwise HashTable_LookupOrInsert is used to attempt to enter + * the data in a racey manner. Should multiple threads attempt to enter + * the same key concurrently one thread will get the entered data and the + * other threads will detect that their entries were rejected; they + * discard their copies of the data and use the entered data (values + * will be stable). + */ + + if (!HashTable_Lookup(stringTable, asciiBytes, (void **) &result)) { + Unicode newData = UnicodeAllocStatic(asciiBytes, unescape); + + if (newData) { + result = HashTable_LookupOrInsert(stringTable, asciiBytes, newData); + + if (result != newData) { + Unicode_Free(newData); + } } } - SyncMutex_Unlock(lck); - return result; } diff --git a/open-vm-tools/lib/unityStub/Makefile.in b/open-vm-tools/lib/unityStub/Makefile.in index a7b6bd2da..fd678ff86 100644 --- a/open-vm-tools/lib/unityStub/Makefile.in +++ b/open-vm-tools/lib/unityStub/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/user/Makefile.in b/open-vm-tools/lib/user/Makefile.in index e19ce4d44..ac528c843 100644 --- a/open-vm-tools/lib/user/Makefile.in +++ b/open-vm-tools/lib/user/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/user/hostinfoPosix.c b/open-vm-tools/lib/user/hostinfoPosix.c index 809406b24..ed3d3e612 100644 --- a/open-vm-tools/lib/user/hostinfoPosix.c +++ b/open-vm-tools/lib/user/hostinfoPosix.c @@ -457,7 +457,7 @@ Hostinfo_SystemUpTime(void) double uptime; FILE *f; - f = fopen("/proc/uptime", "r"); + f = Posix_Fopen("/proc/uptime", "r"); if (!f) { Warning(LGPFX" Failed to open /proc/uptime: %s\n", Msg_ErrString()); return 0; @@ -554,7 +554,7 @@ HostinfoReadProc(const char *str) ASSERT(!HostType_OSIsVMK()); // Don't use /proc/vmware - f = fopen("/proc/vmware/sched/ncpus", "r"); + f = Posix_Fopen("/proc/vmware/sched/ncpus", "r"); if (f != NULL) { while (StdIO_ReadNextLine(f, &line, 0, NULL) == StdIO_Success) { if (strstr(line, str)) { @@ -696,7 +696,7 @@ Hostinfo_NumCPUs(void) FILE *f; char *line; - f = fopen("/proc/cpuinfo", "r"); + f = Posix_Fopen("/proc/cpuinfo", "r"); if (f == NULL) { Msg_Post(MSG_ERROR, MSGID(hostlinux.opencpuinfo) @@ -864,7 +864,7 @@ HostinfoGetCpuInfo(int nCpu, // IN int cpu = 0; char *value = NULL; - f = fopen("/proc/cpuinfo", "r"); + f = Posix_Fopen("/proc/cpuinfo", "r"); if (f == NULL) { Warning(LGPFX" HostinfoGetCpuInfo: Unable to open /proc/cpuinfo\n"); return NULL; @@ -976,7 +976,7 @@ HostinfoGetMemSize(uint64 *memTotal, // OUT FILE *fp = NULL; Bool foundVal = FALSE; - if ((fp = fopen(memInfoFile, "r")) == NULL) { + if ((fp = Posix_Fopen(memInfoFile, "r")) == NULL) { Warning(LGPFX" Could not open meminfo file %s\n", memInfoFile); return FALSE; } @@ -1025,7 +1025,7 @@ HostinfoGetMemInfo(char *name, //IN size_t len; char buffer[4096]; - int fd = open("/proc/meminfo", O_RDONLY); + int fd = Posix_Open("/proc/meminfo", O_RDONLY); if (fd == -1) { Warning(LGPFX" HostinfoGetMemInfo: Unable to open /proc/meminfo\n"); @@ -1351,7 +1351,7 @@ Hostinfo_Execute(const char *command, if (pid == 0) { Hostinfo_ResetProcessState(NULL, 0); - execvp(command, args); + Posix_Execvp(command, args); exit(127); } @@ -1579,7 +1579,7 @@ Hostinfo_GetUser() char *env = NULL; Unicode name = NULL; - if ((getpwuid_r(getuid(), &pw, buffer, sizeof buffer, &ppw) == 0) && + if ((Posix_Getpwuid_r(getuid(), &pw, buffer, sizeof buffer, &ppw) == 0) && (ppw != NULL)) { if (pw.pw_name) { name = Unicode_Alloc(pw.pw_name, STRING_ENCODING_DEFAULT); @@ -1587,7 +1587,7 @@ Hostinfo_GetUser() } if (!name) { - env = getenv("USER"); + env = Posix_Getenv("USER"); if (env) { name = Unicode_Alloc(env, STRING_ENCODING_DEFAULT); } @@ -1613,7 +1613,7 @@ Hostinfo_GetUser() void Hostinfo_LogMemUsage(void) { - int fd = open("/proc/self/statm", O_RDONLY); + int fd = Posix_Open("/proc/self/statm", O_RDONLY); if (fd != -1) { size_t len; diff --git a/open-vm-tools/lib/user/util.c b/open-vm-tools/lib/user/util.c index a4bb4ed55..20d0a5c7a 100644 --- a/open-vm-tools/lib/user/util.c +++ b/open-vm-tools/lib/user/util.c @@ -53,11 +53,13 @@ /* For HARD_EXPIRE --hpreg */ #include "vm_version.h" #include "su.h" +#include "posix.h" #include "file.h" #include "util_shared.h" #include "escape.h" #include "base64.h" #include "unicode.h" +#include "posix.h" #ifndef O_BINARY #define O_BINARY 0 @@ -604,7 +606,7 @@ UtilDoTildeSubst(Unicode user) // IN - name of user Unicode str = NULL; if (*user == '\0') { - str = Util_GetEnv(U("HOME")); + str = Unicode_Duplicate(Posix_Getenv(U("HOME"))); if (str == NULL) { Log("Could not expand environment variable HOME.\n"); } @@ -767,7 +769,7 @@ Util_ExpandString(ConstUnicode fileName) // IN file path to expand * Others are just getenv(). */ - expand = Util_GetEnv(cp + 1); + expand = Unicode_Duplicate(Posix_Getenv(cp + 1)); if (expand != NULL) { } else if (strcasecmp(cp + 1, "PID") == 0) { Str_Snprintf(buf, sizeof buf, "%"FMTPID, getpid()); @@ -902,7 +904,7 @@ Util_MakeSureDirExistsAndAccessible(char const *path, // IN return FALSE; } - if (stat(epath, &statbuf) == 0) { + if (Posix_Stat(epath, &statbuf) == 0) { if (! S_ISDIR(statbuf.st_mode)) { Msg_Append(MSGID(util.msde.notDir) "The path \"%s\" exists, but it is not a directory.\n", @@ -911,7 +913,7 @@ Util_MakeSureDirExistsAndAccessible(char const *path, // IN return FALSE; } } else { - if (mkdir(epath, mode) != 0) { + if (Posix_Mkdir(epath, mode) != 0) { Msg_Append(MSGID(util.msde.mkdir) "Cannot create directory \"%s\": %s.\n", epath, Msg_ErrString()); @@ -1610,40 +1612,6 @@ Util_SeparateStrings(char *source, // IN #endif /* !defined(N_PLAT_NLM) */ -/* - *----------------------------------------------------------------------------- - * - * Util_GetEnv -- - * - * Unicode wrapper for posix getenv call. - * - * Results: - * Returns value of an environment variable or NULL if it fails. - * - * Side effects: - * None. - * - *----------------------------------------------------------------------------- - */ - -Unicode -Util_GetEnv(ConstUnicode name) // IN: environment variable name -{ - char *tmpname = NULL; - char *envnam = NULL; - - tmpname = Unicode_GetAllocBytes(name, STRING_ENCODING_DEFAULT); - - envnam = getenv(tmpname); - free(tmpname); - - if (!envnam) { - return NULL; - } - return Unicode_Alloc(envnam, STRING_ENCODING_DEFAULT); -} - - #if !defined(_WIN32) && !defined(N_PLAT_NLM) /* diff --git a/open-vm-tools/lib/user/utilPosix.c b/open-vm-tools/lib/user/utilPosix.c index d085c1a55..5b590b7d5 100644 --- a/open-vm-tools/lib/user/utilPosix.c +++ b/open-vm-tools/lib/user/utilPosix.c @@ -56,6 +56,7 @@ #include "escape.h" #include "unicodeOperations.h" #include "err.h" +#include "posix.h" /* For Util_GetProcessName() */ @@ -232,7 +233,7 @@ UtilGetUserName(uid_t uid) // IN return NULL; } - if ( getpwuid_r(uid, &pw, memPool, memPoolSize, &pw_p) != 0 + if ( Posix_Getpwuid_r(uid, &pw, memPool, memPoolSize, &pw_p) != 0 || pw_p != &pw) { free(memPool); Warning("UtilGetUserName: Unable to retrieve the username associated " @@ -326,7 +327,7 @@ UtilAcceptableSafeTmpDir(const char *dirname, // IN Bool result; static const mode_t mode = 0700; - result = (mkdir(dirname, mode) == 0); + result = (Posix_Mkdir(dirname, mode) == 0); if (!result) { int error = errno; @@ -342,7 +343,7 @@ UtilAcceptableSafeTmpDir(const char *dirname, // IN * the current effective user with permissions 'mode'. */ - if (0 == lstat(dirname, &st)) { + if (0 == Posix_Lstat(dirname, &st)) { /* * Our directory inherited S_ISGID if its parent had it. So it * is important to ignore that bit, and it is safe to do so @@ -666,7 +667,7 @@ Util_GetProcessName(pid_t pid, // IN : process id */ Str_Sprintf(fileName, sizeof fileName, "/proc/%"FMTPID"/" PROCFILE, pid); - fd = open(fileName, O_RDONLY); + fd = Posix_Open(fileName, O_RDONLY); if (fd < 0) { Log("Util_GetProcessName: Error: cannot open %s\n", fileName); return FALSE; diff --git a/open-vm-tools/lib/vixTools/Makefile.in b/open-vm-tools/lib/vixTools/Makefile.in index 3b48d2210..fbf6333ba 100644 --- a/open-vm-tools/lib/vixTools/Makefile.in +++ b/open-vm-tools/lib/vixTools/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/vixTools/vixTools.c b/open-vm-tools/lib/vixTools/vixTools.c index f8124f12a..23913b0af 100644 --- a/open-vm-tools/lib/vixTools/vixTools.c +++ b/open-vm-tools/lib/vixTools/vixTools.c @@ -211,6 +211,9 @@ static VixError VixToolsImpersonateUserImplEx(char const *credentialTypeStr, #if defined(_WIN32) || defined(linux) static char *ToolsDaemonGetCurrentUser(void); + +static VixError VixToolsAuthenticateUser(const char *username, + const char *password); #endif static Bool VixToolsPidRefersToThisProcess(ProcMgr_Pid pid); @@ -1698,7 +1701,6 @@ VixToolsMoveFile(VixCommandRequestHeader *requestMsg) // IN Bool impersonatingVMWareUser = FALSE; void *userToken = NULL; VixCommandRenameFileRequest *renameRequest; - Bool pathsAreSameFile; renameRequest = (VixCommandRenameFileRequest *) requestMsg; srcFilePathName = ((char *) renameRequest) + sizeof(*renameRequest); @@ -1717,42 +1719,21 @@ VixToolsMoveFile(VixCommandRequestHeader *requestMsg) // IN /* * Be careful. Renaming a file to itself can cause it to be deleted. * This should be a no-op anyway. - * - * TEMPORARY FIX (waiting for FileUtf8_IsSameFile). - * - * Ideally, we would use a FileUtf8_IsSameFile, but that doesn't exist (yet). - * However, we need to catch the case of symlinks, or on Windows the case - * of a long file name and a truncated 8.3 form of the same name. - * So, we use both a File_IsSameFile test and a strcmp. - * - * The strcmp will catch any identical paths, even if they are utf-8. - * The File_IsSameFile will consider any non-ASCII files different, but - * it will work with symlinks and long/short file names. - * - * So, if you have 2 different strings that are non-ASCII names for - * the same file, then we won't catch it and can delete the file. - * This is a data loss bug, the most severe kind. We need to fix this - * test soon. */ - pathsAreSameFile = FALSE; -#if defined(_WIN32) - if (0 == Str_Strcasecmp(srcFilePathName, destFilePathName)) { -#else - if (0 == strcmp(srcFilePathName, destFilePathName)) { -#endif - pathsAreSameFile = TRUE; - } - - if (!pathsAreSameFile) { #if !defined(sun) && !defined(__FreeBSD__) - pathsAreSameFile = File_IsSameFile(srcFilePathName, destFilePathName); -#endif - } // if (!pathsAreSameFile) - - if (pathsAreSameFile) { + if (File_IsSameFile(srcFilePathName, destFilePathName)) { + err = VIX_OK; + goto abort; + } +#else + /* + * Do something better for Solaris and FreeBSD once we support them. + */ + if (strcmp(srcFilePathName, destFilePathName) == 0) { err = VIX_OK; goto abort; } +#endif /* * pre-check the dest arg -- File_Rename() will return @@ -2015,7 +1996,6 @@ VixToolsListDirectory(VixCommandRequestHeader *requestMsg, // IN Bool impersonatingVMWareUser = FALSE; size_t formatStringLength; void *userToken = NULL; - char fullPathFileName[FILE_MAXPATH]; VixMsgListDirectoryRequest *listRequest = NULL; VixMsgSimpleFileRequest *legacyListRequest = NULL; Bool truncated = FALSE; @@ -2114,28 +2094,20 @@ VixToolsListDirectory(VixCommandRequestHeader *requestMsg, // IN } } + /* File_ListDirectory never returns "." or ".." */ for (fileNum = offset; fileNum < numFiles; fileNum++) { + char *pathName; + currentFileName = fileNameList[fileNum]; - /* - * Skip . and .., those aren't very useful and can confuse a - * simple client. - */ - if ('.' == currentFileName[0]) { - if (0 == currentFileName[1]) { - continue; - } - if (('.' == currentFileName[1]) && (0 == currentFileName[2])) { - continue; - } - } + pathName = Str_SafeAsprintf(NULL, "%s%s%s", dirPathName, DIRSEPS, + currentFileName); - Str_Sprintf(fullPathFileName, sizeof(fullPathFileName), "%s"DIRSEPS"%s", - dirPathName, currentFileName); + VixToolsPrintFileInfo(pathName, currentFileName, &destPtr, endDestPtr); - VixToolsPrintFileInfo(fullPathFileName, currentFileName, &destPtr, endDestPtr); + free(pathName); } // for (fileNum = 0; fileNum < numFiles; fileNum++) - *destPtr = 0; + *destPtr = '\0'; abort: if (impersonatingVMWareUser) { @@ -2252,14 +2224,14 @@ abort: *----------------------------------------------------------------------------- */ -void +static void VixToolsPrintFileInfo(char *filePathName, // IN char *fileName, // IN char **destPtr, // IN char *endDestPtr) // OUT { int64 fileSize = 0; - int64 modTime = 0; + int64 modTime; int32 fileProperties = 0; modTime = File_GetModTime(filePathName); @@ -2794,17 +2766,12 @@ VixToolsImpersonateUserImplEx(char const *credentialTypeStr, // IN goto abort; } - /* - * Check if this is a valid account on the guest. - */ - authToken = Auth_AuthenticateUser(unobfuscatedUserName, unobfuscatedPassword); - if (NULL == authToken) { - err = VIX_E_GUEST_USER_PERMISSIONS; + err = VixToolsAuthenticateUser(unobfuscatedUserName, + unobfuscatedPassword); + if (VIX_OK != err) { goto abort; } - Auth_CloseToken(authToken); - /* * Make sure that the user who requested the command is the * current user. @@ -3485,6 +3452,60 @@ ToolsDaemonGetCurrentUser(void) return currentUser; } + + +/* + *----------------------------------------------------------------------------- + * + * VixToolsAuthenticateUser -- + * + * Check if the supplied credentials match a valid user account. + * + * Return value: + * VixError. VIX_OK if the credentials are valid, or an appropriate + * error otherwise. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +VixError +VixToolsAuthenticateUser(const char *username, // IN + const char *password) // IN +{ + VixError err = VIX_OK; + +#ifdef _WIN32 + /* + * Check if this is a valid account on the guest. We cannot use + * Auth_AuthenticateUser() on Windows, because it uses LogonUser() + * which requires the SE_TCB_NAME privilege, which is basically root. + */ + err = VixToolsValidateUserCredentials(username, + password); + if (VIX_OK != err) { + goto abort; + } + +#else + AuthToken authToken; + + authToken = Auth_AuthenticateUser(username, + password); + if (NULL == authToken) { + err = VIX_E_GUEST_USER_PERMISSIONS; + goto abort; + } + + Auth_CloseToken(authToken); +#endif + +abort: + + return err; +} #endif // #if defined(_WIN32) || defined(linux) diff --git a/open-vm-tools/lib/vmBackupLib/Makefile.in b/open-vm-tools/lib/vmBackupLib/Makefile.in index 2374163df..bb2ee1565 100644 --- a/open-vm-tools/lib/vmBackupLib/Makefile.in +++ b/open-vm-tools/lib/vmBackupLib/Makefile.in @@ -119,6 +119,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/vmBackupLib/scriptOps.c b/open-vm-tools/lib/vmBackupLib/scriptOps.c index 69716a847..a9c956b76 100644 --- a/open-vm-tools/lib/vmBackupLib/scriptOps.c +++ b/open-vm-tools/lib/vmBackupLib/scriptOps.c @@ -157,11 +157,11 @@ VmBackupRunNextScript(VmBackupScriptOp *op) // IN/OUT ret = 1; break; } - } - /* This happens if all thaw/fail scripts failed to start. */ - if (index == -1 && scripts[0].proc == NULL) { - ret = -1; + /* This happens if all thaw/fail scripts failed to start. */ + if (index == -1 && scripts[0].proc == NULL) { + ret = -1; + } } return ret; diff --git a/open-vm-tools/lib/vmBackupLib/stateMachine.c b/open-vm-tools/lib/vmBackupLib/stateMachine.c index 301521703..6d967db78 100644 --- a/open-vm-tools/lib/vmBackupLib/stateMachine.c +++ b/open-vm-tools/lib/vmBackupLib/stateMachine.c @@ -51,11 +51,9 @@ #include "file.h" #include "fileIO.h" #include "guestApp.h" -#include "rpcin.h" #include "rpcout.h" #include "str.h" #include "strutil.h" -#include "unicode.h" #include "util.h" #include "vmstdio.h" @@ -81,6 +79,7 @@ static DblLnkLst_Links *gEventQueue = NULL; static VmBackupState *gBackupState = NULL; static VmBackupSyncProvider *gSyncProvider = NULL; +static void DebugOutput(const char *fmt, ...); /* *----------------------------------------------------------------------------- @@ -101,6 +100,7 @@ static VmBackupSyncProvider *gSyncProvider = NULL; static Bool VmBackupKeepAliveCallback(void *clientData) // IN { + DebugOutput("*** %s\n", __FUNCTION__); ASSERT(gBackupState != NULL); gBackupState->keepAlive = NULL; gBackupState->SendEvent(VMBACKUP_EVENT_KEEP_ALIVE, 0, ""); @@ -108,103 +108,6 @@ VmBackupKeepAliveCallback(void *clientData) // IN } -/* - *----------------------------------------------------------------------------- - * - * VmBackupReadConfig -- - * - * Reads the vmbackup config file. This file should contain the names of - * resources that will not be quiesced during the backup (for example, - * paths to be ignored by the sync driver or writers to be ignored by - * VSS). Each non-empty line not starting with a '#' character is - * considered an entry. - * - * The contents are stored in an array in the backup state structure. - * The data is expected to be in UTF-8 format. - * - * Note: currently, only the VSS subsystem uses this data. - * - * Results: - * TRUE on success, FALSE otherwise. - * - * Side effects: - * None. - * - *----------------------------------------------------------------------------- - */ - -static Bool -VmBackupReadConfig(VmBackupState *state) // OUT -{ - Bool ret = TRUE; - char *configDir; - char *cfgPath; - - ASSERT(state != NULL); - - configDir = GuestApp_GetConfPath(); - if (configDir == NULL) { - return FALSE; - } - - cfgPath = Str_Asprintf(NULL, "%s%c%s", configDir, DIRSEPC, "vmbackup.conf"); - free(configDir); - if (cfgPath == NULL) { - return FALSE; - } - - if (File_IsFile(cfgPath)) { - FILE *file; - StdIO_Status status; - - file = Posix_Fopen(cfgPath, "r"); - if (file == NULL) { - Debug("Can't open cfg file: %s\n", strerror(errno)); - ret = FALSE; - goto exit; - } - - while (TRUE) { - Bool skip = TRUE; - char *line; - char *c; - - status = StdIO_ReadNextLine(file, &line, 0, NULL); - if (status != StdIO_Success) { - break; - } - - /* Check if the line is empty or a comment. */ - for (c = line; *c != '\0'; c++) { - if (*c != ' ' && *c != '\t') { - skip = (*c == '#'); - break; - } - } - - if (!skip && !TargetArray_Push(&state->disabledTargets, line)) { - free(line); - break; - } - } - - ret = (ret && (status == StdIO_EOF)); - fclose(file); - } - -exit: - if (!ret) { - size_t i; - for (i = 0; i < TargetArray_Count(&state->disabledTargets); i++) { - free(*TargetArray_AddressOf(&state->disabledTargets, i)); - } - TargetArray_Destroy(&state->disabledTargets); - TargetArray_Init(&gBackupState->disabledTargets, 0); - } - return ret; -} - - /* *----------------------------------------------------------------------------- * @@ -230,6 +133,7 @@ VmBackupSendEvent(const char *event, // IN: event name Bool success; ASSERT(gBackupState != NULL); + DebugOutput("*** %s\n", __FUNCTION__); if (gBackupState->keepAlive != NULL) { EventManager_Remove(gBackupState->keepAlive); } @@ -239,7 +143,7 @@ VmBackupSendEvent(const char *event, // IN: event name event, code, desc); if (!success) { - Debug("VmBackup: failed to send event to the VMX.\n"); + DebugOutput("VmBackup: failed to send event to the VMX.\n"); } gBackupState->keepAlive = EventManager_Add(gEventQueue, @@ -271,10 +175,8 @@ VmBackupSendEvent(const char *event, // IN: event name static void VmBackupFinalize(void) { - size_t i; - ASSERT(gBackupState != NULL); - Debug("*** %s\n", __FUNCTION__); + DebugOutput("*** %s\n", __FUNCTION__); if (gBackupState->currentOp != NULL) { VmBackup_Cancel(gBackupState->currentOp); @@ -291,11 +193,6 @@ VmBackupFinalize(void) EventManager_Remove(gBackupState->keepAlive); } - for (i = 0; i < TargetArray_Count(&gBackupState->disabledTargets); i++) { - free(*TargetArray_AddressOf(&gBackupState->disabledTargets, i)); - } - TargetArray_Destroy(&gBackupState->disabledTargets); - free(gBackupState->volumes); free(gBackupState); gBackupState = NULL; @@ -323,7 +220,7 @@ VmBackupStartScripts(VmBackupScriptType type, // IN VmBackupCallback callback) // IN { const char *opName; - Debug("*** %s\n", __FUNCTION__); + DebugOutput("*** %s\n", __FUNCTION__); switch (type) { case VMBACKUP_SCRIPT_FREEZE: @@ -379,15 +276,16 @@ VmBackupAsyncCallback(void *clientData) // IN { Bool finalize = FALSE; + DebugOutput("*** %s\n", __FUNCTION__); ASSERT(gBackupState != NULL); - Debug("*** %s\n", __FUNCTION__); gBackupState->timerEvent = NULL; if (gBackupState->currentOp != NULL) { VmBackupOpStatus status; - Debug("VmBackupAsyncCallback: checking %s\n", gBackupState->currentOpName); + DebugOutput("VmBackupAsyncCallback: checking %s\n", + gBackupState->currentOpName); status = VmBackup_QueryStatus(gBackupState->currentOp); switch (status) { @@ -395,7 +293,7 @@ VmBackupAsyncCallback(void *clientData) // IN goto exit; case VMBACKUP_STATUS_FINISHED: - Debug("Async request completed\n"); + DebugOutput("Async request completed\n"); VmBackup_Release(gBackupState->currentOp); gBackupState->currentOp = NULL; break; @@ -419,6 +317,7 @@ VmBackupAsyncCallback(void *clientData) // IN VmBackup_Release(gBackupState->currentOp); gBackupState->currentOp = NULL; + gBackupState->syncProviderFailed = gBackupState->syncProviderRunning; /* * If we get an error when running the freeze scripts, we want to @@ -519,8 +418,8 @@ exit: static Bool VmBackupEnableSync(VmBackupState *state) { + DebugOutput("*** %s\n", __FUNCTION__); ASSERT(state != NULL); - Debug("*** %s\n", __FUNCTION__); if (!gSyncProvider->start(state, gSyncProvider->clientData)) { state->SendEvent(VMBACKUP_EVENT_REQUESTOR_ERROR, VMBACKUP_SYNC_ERROR, @@ -562,7 +461,7 @@ VmBackupStart(char const **result, // OUT size_t argsSize, // IN void *clientData) // IN { - Debug("*** %s\n", __FUNCTION__); + DebugOutput("*** %s\n", __FUNCTION__); if (gBackupState != NULL) { return RpcIn_SetRetVals(result, resultLen, @@ -575,7 +474,6 @@ VmBackupStart(char const **result, // OUT gBackupState->SendEvent = VmBackupSendEvent; gBackupState->pollPeriod = 100; - TargetArray_Init(&gBackupState->disabledTargets, 0); if (argsSize > 0) { int generateManifests = 0; @@ -590,12 +488,13 @@ VmBackupStart(char const **result, // OUT } } - if (!VmBackupReadConfig(gBackupState)) { + gBackupState->configDir = GuestApp_GetConfPath(); + if (gBackupState->configDir == NULL) { free(gBackupState); gBackupState = NULL; return RpcIn_SetRetVals(result, resultLen, - "Error when reading configuration file.", + "Error getting configuration directory.", FALSE); } @@ -641,8 +540,8 @@ VmBackupAbort(char const **result, // OUT size_t argsSize, // IN void *clientData) // IN { + DebugOutput("*** %s\n", __FUNCTION__); if (gBackupState != NULL) { - Debug("*** %s\n", __FUNCTION__); if (gBackupState->currentOp != NULL) { VmBackup_Cancel(gBackupState->currentOp); @@ -691,8 +590,8 @@ VmBackupSnapshotDone(char const **result, // OUT size_t argsSize, // IN void *clientData) // IN { + DebugOutput("*** %s\n", __FUNCTION__); if (gBackupState != NULL) { - Debug("*** %s\n", __FUNCTION__); if (!gSyncProvider->snapshotDone(gBackupState, gSyncProvider->clientData)) { gBackupState->syncProviderFailed = TRUE; gBackupState->SendEvent(VMBACKUP_EVENT_REQUESTOR_ERROR, @@ -730,6 +629,7 @@ VmBackup_Init(RpcIn *rpcin, // IN DblLnkLst_Links *eventQueue, // IN VmBackupSyncProvider *provider) // IN { + DebugOutput("*** %s\n", __FUNCTION__); ASSERT(gEventQueue == NULL); ASSERT(eventQueue != NULL); ASSERT(provider != NULL); @@ -775,6 +675,7 @@ VmBackup_Init(RpcIn *rpcin, // IN void VmBackup_Shutdown(RpcIn *rpcin) { + DebugOutput("*** %s\n", __FUNCTION__); if (gBackupState != NULL) { VmBackupFinalize(); } @@ -788,3 +689,41 @@ VmBackup_Shutdown(RpcIn *rpcin) gEventQueue = NULL; } + +/* + *----------------------------------------------------------------------------- + * + * DebugOutput -- + * + * Prints the given message using OutputDebugString in debug builds. + * + * Result + * None. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static void +DebugOutput(const char *fmt, ...) +{ +#ifdef VMX86_DEBUG + char *str; + + va_list args; + va_start(args, fmt); + str = Str_Vasprintf(NULL, fmt, args); + va_end(args); + if (str != NULL) { +#if defined(_WIN32) + OutputDebugString(str); +#else + fprintf(stderr, "%s", str); +#endif + free(str); + } +#endif +} + diff --git a/open-vm-tools/lib/vmCheck/Makefile.in b/open-vm-tools/lib/vmCheck/Makefile.in index c9dd54c7b..b172020fa 100644 --- a/open-vm-tools/lib/vmCheck/Makefile.in +++ b/open-vm-tools/lib/vmCheck/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/vmSignal/Makefile.in b/open-vm-tools/lib/vmSignal/Makefile.in index 76a2ff06a..eedeb02b6 100644 --- a/open-vm-tools/lib/vmSignal/Makefile.in +++ b/open-vm-tools/lib/vmSignal/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/wiper/Makefile.in b/open-vm-tools/lib/wiper/Makefile.in index 9b798d3aa..f6663a21e 100644 --- a/open-vm-tools/lib/wiper/Makefile.in +++ b/open-vm-tools/lib/wiper/Makefile.in @@ -118,6 +118,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/lib/wiper/wiperPosix.c b/open-vm-tools/lib/wiper/wiperPosix.c index 296c38a31..9b4ee1fff 100644 --- a/open-vm-tools/lib/wiper/wiperPosix.c +++ b/open-vm-tools/lib/wiper/wiperPosix.c @@ -48,6 +48,7 @@ #include "str.h" #include "fileIO.h" #include "mntinfo.h" +#include "posix.h" /* Number of bytes per disk sector */ @@ -314,7 +315,7 @@ WiperPartitionFilter(WiperPartition *item, // IN/OUT return; } - if (stat(MNTINFO_NAME(mnt), &s) < 0) { + if (Posix_Stat(MNTINFO_NAME(mnt), &s) < 0) { item->comment = "Unknown device"; return; } @@ -520,7 +521,7 @@ WiperSinglePartition_GetSpace(const WiperPartition *p, // IN #ifdef sun if (statvfs(p->mountPoint, &statfsbuf) < 0) { #else - if (statfs(p->mountPoint, &statfsbuf) < 0) { + if (Posix_Statfs(p->mountPoint, &statfsbuf) < 0) { #endif return "Unable to statfs() the mount point"; } diff --git a/open-vm-tools/libguestlib/Makefile.in b/open-vm-tools/libguestlib/Makefile.in index 045cfa5a7..b0dce7202 100644 --- a/open-vm-tools/libguestlib/Makefile.in +++ b/open-vm-tools/libguestlib/Makefile.in @@ -130,6 +130,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/modules/Makefile.in b/open-vm-tools/modules/Makefile.in index 6ab1f6165..c267c27db 100644 --- a/open-vm-tools/modules/Makefile.in +++ b/open-vm-tools/modules/Makefile.in @@ -80,6 +80,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/open-vm-tools/modules/freebsd/vmblock/vm_basic_types.h b/open-vm-tools/modules/freebsd/vmblock/vm_basic_types.h index d97550f43..c952cae99 100644 --- a/open-vm-tools/modules/freebsd/vmblock/vm_basic_types.h +++ b/open-vm-tools/modules/freebsd/vmblock/vm_basic_types.h @@ -499,8 +499,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/freebsd/vmhgfs/backdoor_def.h b/open-vm-tools/modules/freebsd/vmhgfs/backdoor_def.h index da052ec2b..fd7460213 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/backdoor_def.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/backdoor_def.h @@ -111,7 +111,8 @@ #define BDOOR_CMD_BIOSBBS 50 #define BDOOR_CMD_VASSERT 51 #define BDOOR_CMD_ISGOSDARWIN 52 -#define BDOOR_CMD_MAX 53 +#define BDOOR_CMD_DEBUGEVENT 53 +#define BDOOR_CMD_MAX 54 /* * IMPORTANT NOTE: When modifying the behavior of an existing backdoor command, diff --git a/open-vm-tools/modules/freebsd/vmhgfs/hgfsProto.h b/open-vm-tools/modules/freebsd/vmhgfs/hgfsProto.h index f27663838..244ec3115 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/hgfsProto.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/hgfsProto.h @@ -66,12 +66,12 @@ typedef enum { HGFS_OP_DELETE_DIR, /* Delete a directory */ HGFS_OP_RENAME, /* Rename a file or directory */ HGFS_OP_QUERY_VOLUME_INFO, /* Query volume information */ - + /* * The following operations are only available in version 2 of the hgfs - * protocol. The corresponding version 1 opcodes above are deprecated. + * protocol. The corresponding version 1 opcodes above are deprecated. */ - + HGFS_OP_OPEN_V2, /* Open file */ HGFS_OP_GETATTR_V2, /* Get file attributes */ HGFS_OP_SETATTR_V2, /* Set file attributes */ @@ -82,9 +82,9 @@ typedef enum { HGFS_OP_DELETE_FILE_V2, /* Delete a file */ HGFS_OP_DELETE_DIR_V2, /* Delete a directory */ HGFS_OP_RENAME_V2, /* Rename a file or directory */ - + /* - * Operations for version 3. + * Operations for version 3, deprecating version 2 operations. */ HGFS_OP_OPEN_V3, /* Open file */ @@ -175,10 +175,10 @@ typedef uint8 HgfsPermissions; * * The client can ask the server to acquire opportunistic locking/leasing * from the host FS on its behalf. This is communicated as part of an open request. - * + * * HGFS_LOCK_OPPORTUNISTIC means that the client trusts the server * to decide what kind of locking to request from the host FS. - * All other values tell the server explicitly the type of lock to + * All other values tell the server explicitly the type of lock to * request. * * The server will attempt to acquire the desired lock and will notify the client @@ -214,9 +214,9 @@ typedef uint8 HgfsAttrChanges; /* - * Hints to indicate in a getattr or setattr which attributes + * Hints to indicate in a getattr or setattr which attributes * are valid for the request. - * For setattr only, attributes should be set by host even if + * For setattr only, attributes should be set by host even if * no valid values are specified by the guest. */ @@ -227,7 +227,7 @@ typedef uint64 HgfsAttrHint; #define HGFS_ATTR_HINT_USE_FILE_DESC (1 << 2) /* - * Hint to determine using a name or a handle to determine + * Hint to determine using a name or a handle to determine * what to delete. */ @@ -236,7 +236,7 @@ typedef uint64 HgfsDeleteHint; #define HGFS_DELETE_HINT_USE_FILE_DESC (1 << 0) /* - * Hint to determine using a name or a handle to determine + * Hint to determine using a name or a handle to determine * what to renames. */ @@ -254,7 +254,7 @@ typedef uint64 HgfsRenameHint; * units of 100ns since Jan 1, 1601, UTC. */ -/* +/* * Version 1 attributes. Deprecated. * Version 2 should be using HgfsAttrV2. */ @@ -277,14 +277,14 @@ HgfsAttr; /* Various flags and Windows attributes. */ -typedef uint64 HgfsAttrFlags; +typedef uint64 HgfsAttrFlags; #define HGFS_ATTR_HIDDEN (1 << 0) #define HGFS_ATTR_SYSTEM (1 << 1) #define HGFS_ATTR_ARCHIVE (1 << 2) -/* +/* * Specifies which open request fields contain * valid values. */ @@ -293,7 +293,7 @@ typedef uint64 HgfsOpenValid; #define HGFS_OPEN_VALID_NONE 0 #define HGFS_OPEN_VALID_MODE (1 << 0) -#define HGFS_OPEN_VALID_FLAGS (1 << 1) +#define HGFS_OPEN_VALID_FLAGS (1 << 1) #define HGFS_OPEN_VALID_SPECIAL_PERMS (1 << 2) #define HGFS_OPEN_VALID_OWNER_PERMS (1 << 3) #define HGFS_OPEN_VALID_GROUP_PERMS (1 << 4) @@ -306,7 +306,7 @@ typedef uint64 HgfsOpenValid; #define HGFS_OPEN_VALID_FILE_NAME (1 << 11) -/* +/* * Specifies which attribute fields contain * valid values. */ @@ -326,12 +326,12 @@ typedef uint64 HgfsAttrValid; #define HGFS_ATTR_VALID_OTHER_PERMS (1 << 9) #define HGFS_ATTR_VALID_FLAGS (1 << 10) #define HGFS_ATTR_VALID_ALLOCATION_SIZE (1 << 11) -#define HGFS_ATTR_VALID_USERID (1 << 12) +#define HGFS_ATTR_VALID_USERID (1 << 12) #define HGFS_ATTR_VALID_GROUPID (1 << 13) #define HGFS_ATTR_VALID_FILEID (1 << 14) - -/* + +/* * Specifies which create dir request fields contain * valid values. */ @@ -345,12 +345,12 @@ typedef uint64 HgfsCreateDirValid; #define HGFS_CREATE_DIR_VALID_OTHER_PERMS (1 << 3) #define HGFS_CREATE_DIR_VALID_FILE_NAME (1 << 4) -/* +/* * Version 2 of HgfsAttr */ -typedef -#include "vmware_pack_begin.h" +typedef +#include "vmware_pack_begin.h" struct HgfsAttrV2 { HgfsAttrValid mask; /* A bit mask to determine valid attribute fields */ HgfsFileType type; /* File type */ @@ -360,12 +360,12 @@ struct HgfsAttrV2 { uint64 writeTime; /* Time of last write */ uint64 attrChangeTime; /* Time file attributes were last * changed. Ignored by Windows */ - HgfsPermissions specialPerms; /* Special permissions bits (suid, etc.). + HgfsPermissions specialPerms; /* Special permissions bits (suid, etc.). * Ignored by Windows */ HgfsPermissions ownerPerms; /* Owner permissions bits */ - HgfsPermissions groupPerms; /* Group permissions bits. Ignored by + HgfsPermissions groupPerms; /* Group permissions bits. Ignored by * Windows */ - HgfsPermissions otherPerms; /* Other permissions bits. Ignored by + HgfsPermissions otherPerms; /* Other permissions bits. Ignored by * Windows */ HgfsAttrFlags flags; /* Various flags and Windows 'attributes' */ uint64 allocationSize; /* Actual size of file on disk */ @@ -374,9 +374,9 @@ struct HgfsAttrV2 { uint64 hostFileId; /* File Id of the file on host: inode_t on Linux */ uint64 reserved1; /* Reserved for future use */ uint64 reserved2; /* Reserved for future use */ -} -#include "vmware_pack_end.h" -HgfsAttrV2; +} +#include "vmware_pack_end.h" +HgfsAttrV2; /* @@ -407,16 +407,16 @@ HgfsAttrV2; * SEARCH_OPEN. * * In the current HGFS server implementation, each request has a minimum packet - * size that must be met for it to be considered valid. This minimum is simply + * size that must be met for it to be considered valid. This minimum is simply * the sizeof the particular request, which includes the solitary byte from the * HgfsFileName struct. For these particular requests, clients add an extra * byte to their payload size, without that byte being present anywhere. * * It isn't clear that this behavior is correct, but the end result is that - * neither end malfunctions, as an extra byte gets sent by the client and is + * neither end malfunctions, as an extra byte gets sent by the client and is * ignored by the server. Unfortunately, it cannot be easily fixed. The * server's minimum packet size can be changed, but the client should continue - * to send an extra byte, otherwise older servers with a slightly longer + * to send an extra byte, otherwise older servers with a slightly longer * minimum packet size may consider the new client's packets to be too short. * * UTF-8 representation @@ -435,11 +435,11 @@ HgfsAttrV2; * * Precomposed (normal form C) versus Decomposed (normal form D) * ------------------------------------------------------------- - * Certain Unicode characters can be encoded in more than one way. + * Certain Unicode characters can be encoded in more than one way. * For example, an (A acute) can be encoded either precomposed, - * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, + * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, * as U+0041 U+0301 (LATIN CAPITAL LETTER A followed by a COMBINING ACUTE ACCENT). - * Precomposed characters are more common in the Windows world, + * Precomposed characters are more common in the Windows world, * whereas decomposed characters are more common on the Mac. * * See UAX 15 (http://unicode.org/reports/tr15/) @@ -456,15 +456,28 @@ HgfsFileName; /* - * HgfsFileNameV3 - new header to incorporate case-sensitivity flags along with + * Case-sensitiviy flags are only used when any lookup is + * involved on the server side. + */ + +typedef enum { + HGFS_FILE_NAME_DEFAULT_CASE, + HGFS_FILE_NAME_CASE_SENSITIVE, + HGFS_FILE_NAME_CASE_INSENSITIVE, +} HgfsCaseType; + + +/* + * HgfsFileNameV3 - new header to incorporate case-sensitivity flags along with * Hgfs file handle. - */ + */ typedef #include "vmware_pack_begin.h" struct HgfsFileNameV3 { - uint32 length; /* Does NOT include terminating NUL */ - uint32 flags; /* Flags describe below. */ + uint32 length; /* Does NOT include terminating NUL */ + uint32 flags; /* Flags described below. */ + HgfsCaseType caseType; /* Case-sensitivity type. */ HgfsHandle fid; char name[1]; } @@ -476,10 +489,7 @@ HgfsFileNameV3; * HgfsFileNameV3 flags. Case-sensitiviy flags are only used when any lookup is * involved on the server side. */ -#define HGFS_FILE_NAME_USE_FILE_DESC (1 << 0) /* Other flags ignored if set. */ -#define HGFS_FILE_NAME_CASE_SENSITIVE (1 << 1) -#define HGFS_FILE_NAME_CASE_INSENSITIVE (1 << 2) -#define HGFS_FILE_NAME_DEFAULT_CASE (1 << 3) /* Default host case. */ +#define HGFS_FILE_NAME_USE_FILE_DESC (1 << 0) /* Case type ignored if set. */ /* @@ -530,26 +540,26 @@ HgfsRequestOpen; typedef #include "vmware_pack_begin.h" -struct HgfsRequestOpenV2 { - HgfsRequest header; +struct HgfsRequestOpenV2 { + HgfsRequest header; HgfsOpenValid mask; /* Bitmask that specified which fields are valid. */ - HgfsOpenMode mode; /* Which type of access requested. See desiredAccess */ - HgfsOpenFlags flags; /* Which flags to open the file with */ - HgfsPermissions specialPerms; /* Desired 'special' permissions for file creation */ - HgfsPermissions ownerPerms; /* Desired 'owner' permissions for file creation */ - HgfsPermissions groupPerms; /* Desired 'group' permissions for file creation */ - HgfsPermissions otherPerms; /* Desired 'other' permissions for file creation */ - HgfsAttrFlags attr; /* Attributes, if any, for file creation */ - uint64 allocationSize; /* How much space to pre-allocate during creation */ - uint32 desiredAccess; /* Extended support for windows access modes */ + HgfsOpenMode mode; /* Which type of access requested. See desiredAccess */ + HgfsOpenFlags flags; /* Which flags to open the file with */ + HgfsPermissions specialPerms; /* Desired 'special' permissions for file creation */ + HgfsPermissions ownerPerms; /* Desired 'owner' permissions for file creation */ + HgfsPermissions groupPerms; /* Desired 'group' permissions for file creation */ + HgfsPermissions otherPerms; /* Desired 'other' permissions for file creation */ + HgfsAttrFlags attr; /* Attributes, if any, for file creation */ + uint64 allocationSize; /* How much space to pre-allocate during creation */ + uint32 desiredAccess; /* Extended support for windows access modes */ uint32 shareAccess; /* Windows only, share access modes */ HgfsServerLock desiredLock; /* The type of lock desired by the client */ uint64 reserved1; /* Reserved for future use */ uint64 reserved2; /* Reserved for future use */ - HgfsFileName fileName; -} -#include "vmware_pack_end.h" -HgfsRequestOpenV2; + HgfsFileName fileName; +} +#include "vmware_pack_end.h" +HgfsRequestOpenV2; /* Version 3 of HgfsRequestOpen */ @@ -860,16 +870,16 @@ typedef struct HgfsReplySearchReadV2 { HgfsReply header; HgfsAttrV2 attr; - - /* - * fileName.length = 0 means "no entry at this offset" + + /* + * fileName.length = 0 means "no entry at this offset" * If the file is a symlink (as specified in attr) * this name is the name of the symlink, not the target. - */ - HgfsFileName fileName; -} -#include "vmware_pack_end.h" -HgfsReplySearchReadV2; + */ + HgfsFileName fileName; +} +#include "vmware_pack_end.h" +HgfsReplySearchReadV2; /* Directory entry structure. */ @@ -877,13 +887,13 @@ HgfsReplySearchReadV2; typedef struct HgfsDirEntry { uint32 nextEntry; HgfsAttrV2 attr; - - /* - * fileName.length = 0 means "no entry at this offset" + + /* + * fileName.length = 0 means "no entry at this offset" * If the file is a symlink (as specified in attr) * this name is the name of the symlink, not the target. - */ - HgfsFileNameV3 fileName; + */ + HgfsFileNameV3 fileName; } HgfsDirEntry; typedef @@ -892,8 +902,8 @@ struct HgfsReplySearchReadV3 { uint64 count; /* Number of directory entries. */ uint64 reserved; /* Reserved for future use. */ char payload[1]; /* Directory entries. */ -} -#include "vmware_pack_end.h" +} +#include "vmware_pack_end.h" HgfsReplySearchReadV3; @@ -996,10 +1006,10 @@ typedef struct HgfsReplyGetattrV2 { HgfsReply header; HgfsAttrV2 attr; - + /* - * If the file is a symlink, as specified in attr.type, then this is - * the target for the symlink. If the file is not a symlink, this should + * If the file is a symlink, as specified in attr.type, then this is + * the target for the symlink. If the file is not a symlink, this should * be ignored. * * This filename is in "CPNameLite" format. See CPNameLite.c for details. @@ -1014,10 +1024,10 @@ typedef #include "vmware_pack_begin.h" struct HgfsReplyGetattrV3 { HgfsAttrV2 attr; - + /* - * If the file is a symlink, as specified in attr.type, then this is - * the target for the symlink. If the file is not a symlink, this should + * If the file is a symlink, as specified in attr.type, then this is + * the target for the symlink. If the file is not a symlink, this should * be ignored. * * This filename is in "CPNameLite" format. See CPNameLite.c for details. @@ -1192,7 +1202,7 @@ struct HgfsRequestDelete { HgfsRequestDelete; -/* Version 2 of HgfsReplyCreateDir */ +/* Version 2 of HgfsRequestDelete */ typedef #include "vmware_pack_begin.h" @@ -1206,7 +1216,7 @@ struct HgfsRequestDeleteV2 { HgfsRequestDeleteV2; -/* Version 3 of HgfsReplyCreateDir */ +/* Version 3 of HgfsRequestDelete */ typedef #include "vmware_pack_begin.h" @@ -1420,7 +1430,7 @@ struct HgfsReplySymlinkCreate { HgfsReplySymlinkCreate; -/* HgfsRequestServerLockChange and HgfsReplyServerLockChange for v3. */ +/* HgfsRequestSymlinkCreate and HgfsReplySymlinkCreate for v3. */ typedef #include "vmware_pack_begin.h" diff --git a/open-vm-tools/modules/freebsd/vmhgfs/hgfsUtil.h b/open-vm-tools/modules/freebsd/vmhgfs/hgfsUtil.h index 1b98bf761..66dc72d4c 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/hgfsUtil.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/hgfsUtil.h @@ -91,6 +91,14 @@ struct timespec { #define HGFS_NAME_BUFFER_SIZE(request) (HGFS_PACKET_MAX - (sizeof *request - 1)) #define HGFS_NAME_BUFFER_SIZET(sizet) (HGFS_PACKET_MAX - (sizet) - 1) +/* XXX: Needs change when VMCI is supported. */ +#define HGFS_REQ_PAYLOAD_SIZE_V3(hgfsReq) (sizeof *hgfsReq + sizeof(HgfsRequest)) +#define HGFS_REP_PAYLOAD_SIZE_V3(hgfsRep) (sizeof *hgfsRep + sizeof(HgfsReply)) + +/* XXX: Needs change when VMCI is supported. */ +#define HGFS_REQ_GET_PAYLOAD_V3(hgfsReq) ((char *)(hgfsReq) + sizeof(HgfsRequest)) +#define HGFS_REP_GET_PAYLOAD_V3(hgfsRep) ((char *)(hgfsRep) + sizeof(HgfsReply)) + #ifndef _WIN32 /* * Routines for converting between Win NT and unix time formats. The diff --git a/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86.h b/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86.h index ce83e3be7..4f8213b03 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86.h @@ -100,13 +100,13 @@ static INLINE void FXSAVE_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsave %0\n" : "=m" (*save)); + __asm__ __volatile__ ("fxsave %0\n" : "=m" (*save) : : "memory"); } static INLINE void FXRSTOR_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*load) : "memory"); } static INLINE void @@ -126,7 +126,7 @@ FXRSTOR_AMD_ES0(const uint8 *load) "fxrstor %1 \n" : : "m" (dummy), "m" (*load) - : "ax"); + : "ax", "memory"); } #endif /* __GNUC__ */ diff --git a/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86_64.h b/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86_64.h index 72db20a4f..9ec83eca0 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86_64.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_asm_x86_64.h @@ -84,25 +84,25 @@ uint64 __shiftright128(uint64 lowPart, uint64 highPart, uint8 shift); static INLINE void FXSAVE_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsaveq %0 \n" : "=m" (*save)); + __asm__ __volatile__ ("fxsaveq %0 \n" : "=m" (*save) : : "memory"); } static INLINE void FXSAVE_COMPAT_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsave %0 \n" : "=m" (*save)); + __asm__ __volatile__ ("fxsave %0 \n" : "=m" (*save) : : "memory"); } static INLINE void FXRSTOR_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstorq %0 \n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstorq %0 \n" : : "m" (*load) : "memory"); } static INLINE void FXRSTOR_COMPAT_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstor %0 \n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstor %0 \n" : : "m" (*load) : "memory"); } static INLINE void @@ -122,7 +122,7 @@ FXRSTOR_AMD_ES0(const uint8 *load) "fxrstorq %1 \n" : : "m" (dummy), "m" (*load) - : "ax"); + : "ax", "memory"); } #endif /* __GNUC__ */ diff --git a/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_types.h b/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_types.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/freebsd/vmmemctl/vm_basic_types.h b/open-vm-tools/modules/freebsd/vmmemctl/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/freebsd/vmmemctl/vm_basic_types.h +++ b/open-vm-tools/modules/freebsd/vmmemctl/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/freebsd/vmxnet/vm_basic_types.h b/open-vm-tools/modules/freebsd/vmxnet/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/freebsd/vmxnet/vm_basic_types.h +++ b/open-vm-tools/modules/freebsd/vmxnet/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/linux/vmblock/include/vm_basic_types.h b/open-vm-tools/modules/linux/vmblock/include/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/linux/vmblock/include/vm_basic_types.h +++ b/open-vm-tools/modules/linux/vmblock/include/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/linux/vmhgfs/backdoor_def.h b/open-vm-tools/modules/linux/vmhgfs/backdoor_def.h index da052ec2b..fd7460213 100644 --- a/open-vm-tools/modules/linux/vmhgfs/backdoor_def.h +++ b/open-vm-tools/modules/linux/vmhgfs/backdoor_def.h @@ -111,7 +111,8 @@ #define BDOOR_CMD_BIOSBBS 50 #define BDOOR_CMD_VASSERT 51 #define BDOOR_CMD_ISGOSDARWIN 52 -#define BDOOR_CMD_MAX 53 +#define BDOOR_CMD_DEBUGEVENT 53 +#define BDOOR_CMD_MAX 54 /* * IMPORTANT NOTE: When modifying the behavior of an existing backdoor command, diff --git a/open-vm-tools/modules/linux/vmhgfs/dir.c b/open-vm-tools/modules/linux/vmhgfs/dir.c index 668996140..5fdb261e4 100644 --- a/open-vm-tools/modules/linux/vmhgfs/dir.c +++ b/open-vm-tools/modules/linux/vmhgfs/dir.c @@ -117,9 +117,10 @@ HgfsUnpackSearchReadReply(HgfsReq *req, // IN: Reply packet HgfsReplySearchReadV3 *replyV3; HgfsDirEntry *dirent; + /* Currently V3 returns only 1 entry. */ replyV3 = (HgfsReplySearchReadV3 *)(HGFS_REP_PAYLOAD_V3(req)); - replySize = sizeof *replyV3 + sizeof(struct HgfsReply) - + sizeof(struct HgfsDirEntry); + replyV3->count = 1; + replySize = HGFS_REP_PAYLOAD_SIZE_V3(replyV3) + sizeof *dirent; dirent = (HgfsDirEntry *)replyV3->payload; fileName = dirent->fileName.name; fileNameLength = dirent->fileName.length; @@ -247,7 +248,7 @@ HgfsGetNextDirEntry(HgfsSuperInfo *si, // IN: Superinfo for this SB request = (HgfsRequestSearchReadV3 *)(HGFS_REQ_PAYLOAD_V3(req)); request->search = searchHandle; request->offset = offset; - req->payloadSize = sizeof *request + sizeof *header; + req->payloadSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); } else { HgfsRequestSearchRead *request; @@ -311,6 +312,7 @@ HgfsGetNextDirEntry(HgfsSuperInfo *si, // IN: Superinfo for this SB return result; } + /* *---------------------------------------------------------------------- * @@ -330,7 +332,7 @@ HgfsGetNextDirEntry(HgfsSuperInfo *si, // IN: Superinfo for this SB static int HgfsPackDirOpenRequest(struct inode *inode, // IN: Inode of the file to open struct file *file, // IN: File pointer for this open - HgfsOp opUsed, // IN: Op to be used + HgfsOp opUsed, // IN: Op to be used HgfsReq *req) // IN/OUT: Packet to write into { char *name; @@ -356,8 +358,9 @@ HgfsPackDirOpenRequest(struct inode *inode, // IN: Inode of the file to open /* We'll use these later. */ name = requestV3->dirName.name; nameLength = &requestV3->dirName.length; - requestV3->dirName.flags = HGFS_FILE_NAME_CASE_SENSITIVE; - requestSize = sizeof *requestV3 + sizeof *requestHeader; + requestV3->dirName.flags = 0; + requestV3->dirName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; + requestSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); break; } @@ -460,7 +463,7 @@ HgfsDirOpen(struct inode *inode, // IN: Inode of the dir to open replySearch = &((HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req))->search; if (atomic_read(&hgfsProtocolVersion) == HGFS_VERSION_3) { opUsed = HGFS_OP_SEARCH_OPEN_V3; - replySearch = &((HgfsReplySearchOpenV3 *)HGFS_REQ_PAYLOAD_V3(req))->search; + replySearch = &((HgfsReplySearchOpenV3 *)HGFS_REP_PAYLOAD_V3(req))->search; } result = HgfsPackDirOpenRequest(inode, file, opUsed, req); @@ -815,7 +818,7 @@ HgfsDirRelease(struct inode *inode, // IN: Inode that the file* points to request = (HgfsRequestSearchCloseV3 *)(HGFS_REQ_PAYLOAD_V3(req)); request->search = handle; - req->payloadSize = sizeof *request + sizeof *header; + req->payloadSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); } else { HgfsRequestSearchClose *request; diff --git a/open-vm-tools/modules/linux/vmhgfs/file.c b/open-vm-tools/modules/linux/vmhgfs/file.c index e43aa7506..a72908857 100644 --- a/open-vm-tools/modules/linux/vmhgfs/file.c +++ b/open-vm-tools/modules/linux/vmhgfs/file.c @@ -36,6 +36,7 @@ #include "hgfsProto.h" #include "module.h" #include "request.h" +#include "hgfsUtil.h" #include "fsutil.h" #include "vm_assert.h" #include "vm_basic_types.h" @@ -177,12 +178,12 @@ HgfsPackOpenRequest(struct inode *inode, // IN: Inode of the file to open HgfsRequest *requestHeader; HgfsRequestOpenV3 *requestV3; - requestHeader = (HgfsRequest *)(HGFS_REQ_PAYLOAD(req)); + requestHeader = (HgfsRequest *)HGFS_REQ_PAYLOAD(req); requestHeader->op = opUsed; requestHeader->id = req->id; requestV3 = (HgfsRequestOpenV3 *)HGFS_REQ_PAYLOAD_V3(req); - requestSize = sizeof *requestV3 + sizeof *requestHeader; + requestSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); /* We'll use these later. */ name = requestV3->fileName.name; @@ -191,7 +192,8 @@ HgfsPackOpenRequest(struct inode *inode, // IN: Inode of the file to open requestV3->mask = HGFS_FILE_OPEN_MASK; /* Linux clients need case-sensitive lookups. */ - requestV3->fileName.flags = HGFS_FILE_NAME_CASE_SENSITIVE; + requestV3->fileName.flags = 0; + requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; requestV3->fileName.fid = 0; /* Set mode. */ @@ -361,6 +363,7 @@ HgfsUnpackOpenReply(HgfsReq *req, // IN: Packet with reply inside HgfsHandle *file, // OUT: Handle in reply packet HgfsServerLock *lock) // OUT: The server lock we got { + HgfsReplyOpenV3 *replyV3; HgfsReplyOpenV2 *replyV2; HgfsReplyOpen *replyV1; size_t replySize; @@ -371,6 +374,11 @@ HgfsUnpackOpenReply(HgfsReq *req, // IN: Packet with reply inside switch (opUsed) { case HGFS_OP_OPEN_V3: + replyV3 = (HgfsReplyOpenV3 *)HGFS_REP_PAYLOAD_V3(req); + replySize = HGFS_REP_PAYLOAD_SIZE_V3(replyV3); + *file = replyV3->file; + *lock = replyV3->acquiredLock; + break; case HGFS_OP_OPEN_V2: replyV2 = (HgfsReplyOpenV2 *)(HGFS_REQ_PAYLOAD(req)); replySize = sizeof *replyV2; @@ -1041,7 +1049,7 @@ HgfsRelease(struct inode *inode, // IN: Inode that this file points to request = (HgfsRequestCloseV3 *)(HGFS_REQ_PAYLOAD_V3(req)); request->file = handle; - req->payloadSize = sizeof *request + sizeof *header; + req->payloadSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); } else { HgfsRequestClose *request; diff --git a/open-vm-tools/modules/linux/vmhgfs/fsutil.c b/open-vm-tools/modules/linux/vmhgfs/fsutil.c index acb72d74f..7f388fbec 100644 --- a/open-vm-tools/modules/linux/vmhgfs/fsutil.c +++ b/open-vm-tools/modules/linux/vmhgfs/fsutil.c @@ -245,8 +245,7 @@ HgfsUnpackGetattrReply(HgfsReq *req, // IN: Reply packet /* GetattrV2+ also wants a symlink target if it exists. */ if (attr->requestType == HGFS_OP_GETATTR_V3) { - HgfsReplyGetattrV3 *replyV3 = (HgfsReplyGetattrV3 *) - (HGFS_REP_PAYLOAD_V3(req)); + HgfsReplyGetattrV3 *replyV3 = (HgfsReplyGetattrV3 *)(HGFS_REP_PAYLOAD_V3(req)); name = replyV3->symlinkTarget.name; length = replyV3->symlinkTarget.length; @@ -354,9 +353,10 @@ HgfsPackGetattrRequest(HgfsReq *req, // IN/OUT: Request buffer requestV3->hints = 0; fileName = requestV3->fileName.name; fileNameLength = &requestV3->fileName.length; - requestV3->fileName.flags = HGFS_FILE_NAME_CASE_SENSITIVE; + requestV3->fileName.flags = 0; + requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; } - reqSize = sizeof *requestV3 + sizeof *requestHeader; + reqSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); reqBufferSize = HGFS_NAME_BUFFER_SIZET(reqSize); break; } @@ -474,6 +474,7 @@ int HgfsUnpackCommonAttr(HgfsReq *req, // IN: Reply packet HgfsAttrInfo *attrInfo) // OUT: Attributes { + HgfsReplyGetattrV3 *getattrReplyV3; HgfsReplyGetattrV2 *getattrReplyV2; HgfsReplyGetattr *getattrReplyV1; HgfsReplySearchReadV3 *searchReadReplyV3; @@ -488,6 +489,9 @@ HgfsUnpackCommonAttr(HgfsReq *req, // IN: Reply packet switch (attrInfo->requestType) { case HGFS_OP_GETATTR_V3: + getattrReplyV3 = (HgfsReplyGetattrV3 *)(HGFS_REP_PAYLOAD_V3(req)); + attrV2 = &getattrReplyV3->attr; + break; case HGFS_OP_GETATTR_V2: getattrReplyV2 = (HgfsReplyGetattrV2 *)(HGFS_REQ_PAYLOAD(req)); attrV2 = &getattrReplyV2->attr; diff --git a/open-vm-tools/modules/linux/vmhgfs/hgfsProto.h b/open-vm-tools/modules/linux/vmhgfs/hgfsProto.h index f27663838..244ec3115 100644 --- a/open-vm-tools/modules/linux/vmhgfs/hgfsProto.h +++ b/open-vm-tools/modules/linux/vmhgfs/hgfsProto.h @@ -66,12 +66,12 @@ typedef enum { HGFS_OP_DELETE_DIR, /* Delete a directory */ HGFS_OP_RENAME, /* Rename a file or directory */ HGFS_OP_QUERY_VOLUME_INFO, /* Query volume information */ - + /* * The following operations are only available in version 2 of the hgfs - * protocol. The corresponding version 1 opcodes above are deprecated. + * protocol. The corresponding version 1 opcodes above are deprecated. */ - + HGFS_OP_OPEN_V2, /* Open file */ HGFS_OP_GETATTR_V2, /* Get file attributes */ HGFS_OP_SETATTR_V2, /* Set file attributes */ @@ -82,9 +82,9 @@ typedef enum { HGFS_OP_DELETE_FILE_V2, /* Delete a file */ HGFS_OP_DELETE_DIR_V2, /* Delete a directory */ HGFS_OP_RENAME_V2, /* Rename a file or directory */ - + /* - * Operations for version 3. + * Operations for version 3, deprecating version 2 operations. */ HGFS_OP_OPEN_V3, /* Open file */ @@ -175,10 +175,10 @@ typedef uint8 HgfsPermissions; * * The client can ask the server to acquire opportunistic locking/leasing * from the host FS on its behalf. This is communicated as part of an open request. - * + * * HGFS_LOCK_OPPORTUNISTIC means that the client trusts the server * to decide what kind of locking to request from the host FS. - * All other values tell the server explicitly the type of lock to + * All other values tell the server explicitly the type of lock to * request. * * The server will attempt to acquire the desired lock and will notify the client @@ -214,9 +214,9 @@ typedef uint8 HgfsAttrChanges; /* - * Hints to indicate in a getattr or setattr which attributes + * Hints to indicate in a getattr or setattr which attributes * are valid for the request. - * For setattr only, attributes should be set by host even if + * For setattr only, attributes should be set by host even if * no valid values are specified by the guest. */ @@ -227,7 +227,7 @@ typedef uint64 HgfsAttrHint; #define HGFS_ATTR_HINT_USE_FILE_DESC (1 << 2) /* - * Hint to determine using a name or a handle to determine + * Hint to determine using a name or a handle to determine * what to delete. */ @@ -236,7 +236,7 @@ typedef uint64 HgfsDeleteHint; #define HGFS_DELETE_HINT_USE_FILE_DESC (1 << 0) /* - * Hint to determine using a name or a handle to determine + * Hint to determine using a name or a handle to determine * what to renames. */ @@ -254,7 +254,7 @@ typedef uint64 HgfsRenameHint; * units of 100ns since Jan 1, 1601, UTC. */ -/* +/* * Version 1 attributes. Deprecated. * Version 2 should be using HgfsAttrV2. */ @@ -277,14 +277,14 @@ HgfsAttr; /* Various flags and Windows attributes. */ -typedef uint64 HgfsAttrFlags; +typedef uint64 HgfsAttrFlags; #define HGFS_ATTR_HIDDEN (1 << 0) #define HGFS_ATTR_SYSTEM (1 << 1) #define HGFS_ATTR_ARCHIVE (1 << 2) -/* +/* * Specifies which open request fields contain * valid values. */ @@ -293,7 +293,7 @@ typedef uint64 HgfsOpenValid; #define HGFS_OPEN_VALID_NONE 0 #define HGFS_OPEN_VALID_MODE (1 << 0) -#define HGFS_OPEN_VALID_FLAGS (1 << 1) +#define HGFS_OPEN_VALID_FLAGS (1 << 1) #define HGFS_OPEN_VALID_SPECIAL_PERMS (1 << 2) #define HGFS_OPEN_VALID_OWNER_PERMS (1 << 3) #define HGFS_OPEN_VALID_GROUP_PERMS (1 << 4) @@ -306,7 +306,7 @@ typedef uint64 HgfsOpenValid; #define HGFS_OPEN_VALID_FILE_NAME (1 << 11) -/* +/* * Specifies which attribute fields contain * valid values. */ @@ -326,12 +326,12 @@ typedef uint64 HgfsAttrValid; #define HGFS_ATTR_VALID_OTHER_PERMS (1 << 9) #define HGFS_ATTR_VALID_FLAGS (1 << 10) #define HGFS_ATTR_VALID_ALLOCATION_SIZE (1 << 11) -#define HGFS_ATTR_VALID_USERID (1 << 12) +#define HGFS_ATTR_VALID_USERID (1 << 12) #define HGFS_ATTR_VALID_GROUPID (1 << 13) #define HGFS_ATTR_VALID_FILEID (1 << 14) - -/* + +/* * Specifies which create dir request fields contain * valid values. */ @@ -345,12 +345,12 @@ typedef uint64 HgfsCreateDirValid; #define HGFS_CREATE_DIR_VALID_OTHER_PERMS (1 << 3) #define HGFS_CREATE_DIR_VALID_FILE_NAME (1 << 4) -/* +/* * Version 2 of HgfsAttr */ -typedef -#include "vmware_pack_begin.h" +typedef +#include "vmware_pack_begin.h" struct HgfsAttrV2 { HgfsAttrValid mask; /* A bit mask to determine valid attribute fields */ HgfsFileType type; /* File type */ @@ -360,12 +360,12 @@ struct HgfsAttrV2 { uint64 writeTime; /* Time of last write */ uint64 attrChangeTime; /* Time file attributes were last * changed. Ignored by Windows */ - HgfsPermissions specialPerms; /* Special permissions bits (suid, etc.). + HgfsPermissions specialPerms; /* Special permissions bits (suid, etc.). * Ignored by Windows */ HgfsPermissions ownerPerms; /* Owner permissions bits */ - HgfsPermissions groupPerms; /* Group permissions bits. Ignored by + HgfsPermissions groupPerms; /* Group permissions bits. Ignored by * Windows */ - HgfsPermissions otherPerms; /* Other permissions bits. Ignored by + HgfsPermissions otherPerms; /* Other permissions bits. Ignored by * Windows */ HgfsAttrFlags flags; /* Various flags and Windows 'attributes' */ uint64 allocationSize; /* Actual size of file on disk */ @@ -374,9 +374,9 @@ struct HgfsAttrV2 { uint64 hostFileId; /* File Id of the file on host: inode_t on Linux */ uint64 reserved1; /* Reserved for future use */ uint64 reserved2; /* Reserved for future use */ -} -#include "vmware_pack_end.h" -HgfsAttrV2; +} +#include "vmware_pack_end.h" +HgfsAttrV2; /* @@ -407,16 +407,16 @@ HgfsAttrV2; * SEARCH_OPEN. * * In the current HGFS server implementation, each request has a minimum packet - * size that must be met for it to be considered valid. This minimum is simply + * size that must be met for it to be considered valid. This minimum is simply * the sizeof the particular request, which includes the solitary byte from the * HgfsFileName struct. For these particular requests, clients add an extra * byte to their payload size, without that byte being present anywhere. * * It isn't clear that this behavior is correct, but the end result is that - * neither end malfunctions, as an extra byte gets sent by the client and is + * neither end malfunctions, as an extra byte gets sent by the client and is * ignored by the server. Unfortunately, it cannot be easily fixed. The * server's minimum packet size can be changed, but the client should continue - * to send an extra byte, otherwise older servers with a slightly longer + * to send an extra byte, otherwise older servers with a slightly longer * minimum packet size may consider the new client's packets to be too short. * * UTF-8 representation @@ -435,11 +435,11 @@ HgfsAttrV2; * * Precomposed (normal form C) versus Decomposed (normal form D) * ------------------------------------------------------------- - * Certain Unicode characters can be encoded in more than one way. + * Certain Unicode characters can be encoded in more than one way. * For example, an (A acute) can be encoded either precomposed, - * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, + * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, * as U+0041 U+0301 (LATIN CAPITAL LETTER A followed by a COMBINING ACUTE ACCENT). - * Precomposed characters are more common in the Windows world, + * Precomposed characters are more common in the Windows world, * whereas decomposed characters are more common on the Mac. * * See UAX 15 (http://unicode.org/reports/tr15/) @@ -456,15 +456,28 @@ HgfsFileName; /* - * HgfsFileNameV3 - new header to incorporate case-sensitivity flags along with + * Case-sensitiviy flags are only used when any lookup is + * involved on the server side. + */ + +typedef enum { + HGFS_FILE_NAME_DEFAULT_CASE, + HGFS_FILE_NAME_CASE_SENSITIVE, + HGFS_FILE_NAME_CASE_INSENSITIVE, +} HgfsCaseType; + + +/* + * HgfsFileNameV3 - new header to incorporate case-sensitivity flags along with * Hgfs file handle. - */ + */ typedef #include "vmware_pack_begin.h" struct HgfsFileNameV3 { - uint32 length; /* Does NOT include terminating NUL */ - uint32 flags; /* Flags describe below. */ + uint32 length; /* Does NOT include terminating NUL */ + uint32 flags; /* Flags described below. */ + HgfsCaseType caseType; /* Case-sensitivity type. */ HgfsHandle fid; char name[1]; } @@ -476,10 +489,7 @@ HgfsFileNameV3; * HgfsFileNameV3 flags. Case-sensitiviy flags are only used when any lookup is * involved on the server side. */ -#define HGFS_FILE_NAME_USE_FILE_DESC (1 << 0) /* Other flags ignored if set. */ -#define HGFS_FILE_NAME_CASE_SENSITIVE (1 << 1) -#define HGFS_FILE_NAME_CASE_INSENSITIVE (1 << 2) -#define HGFS_FILE_NAME_DEFAULT_CASE (1 << 3) /* Default host case. */ +#define HGFS_FILE_NAME_USE_FILE_DESC (1 << 0) /* Case type ignored if set. */ /* @@ -530,26 +540,26 @@ HgfsRequestOpen; typedef #include "vmware_pack_begin.h" -struct HgfsRequestOpenV2 { - HgfsRequest header; +struct HgfsRequestOpenV2 { + HgfsRequest header; HgfsOpenValid mask; /* Bitmask that specified which fields are valid. */ - HgfsOpenMode mode; /* Which type of access requested. See desiredAccess */ - HgfsOpenFlags flags; /* Which flags to open the file with */ - HgfsPermissions specialPerms; /* Desired 'special' permissions for file creation */ - HgfsPermissions ownerPerms; /* Desired 'owner' permissions for file creation */ - HgfsPermissions groupPerms; /* Desired 'group' permissions for file creation */ - HgfsPermissions otherPerms; /* Desired 'other' permissions for file creation */ - HgfsAttrFlags attr; /* Attributes, if any, for file creation */ - uint64 allocationSize; /* How much space to pre-allocate during creation */ - uint32 desiredAccess; /* Extended support for windows access modes */ + HgfsOpenMode mode; /* Which type of access requested. See desiredAccess */ + HgfsOpenFlags flags; /* Which flags to open the file with */ + HgfsPermissions specialPerms; /* Desired 'special' permissions for file creation */ + HgfsPermissions ownerPerms; /* Desired 'owner' permissions for file creation */ + HgfsPermissions groupPerms; /* Desired 'group' permissions for file creation */ + HgfsPermissions otherPerms; /* Desired 'other' permissions for file creation */ + HgfsAttrFlags attr; /* Attributes, if any, for file creation */ + uint64 allocationSize; /* How much space to pre-allocate during creation */ + uint32 desiredAccess; /* Extended support for windows access modes */ uint32 shareAccess; /* Windows only, share access modes */ HgfsServerLock desiredLock; /* The type of lock desired by the client */ uint64 reserved1; /* Reserved for future use */ uint64 reserved2; /* Reserved for future use */ - HgfsFileName fileName; -} -#include "vmware_pack_end.h" -HgfsRequestOpenV2; + HgfsFileName fileName; +} +#include "vmware_pack_end.h" +HgfsRequestOpenV2; /* Version 3 of HgfsRequestOpen */ @@ -860,16 +870,16 @@ typedef struct HgfsReplySearchReadV2 { HgfsReply header; HgfsAttrV2 attr; - - /* - * fileName.length = 0 means "no entry at this offset" + + /* + * fileName.length = 0 means "no entry at this offset" * If the file is a symlink (as specified in attr) * this name is the name of the symlink, not the target. - */ - HgfsFileName fileName; -} -#include "vmware_pack_end.h" -HgfsReplySearchReadV2; + */ + HgfsFileName fileName; +} +#include "vmware_pack_end.h" +HgfsReplySearchReadV2; /* Directory entry structure. */ @@ -877,13 +887,13 @@ HgfsReplySearchReadV2; typedef struct HgfsDirEntry { uint32 nextEntry; HgfsAttrV2 attr; - - /* - * fileName.length = 0 means "no entry at this offset" + + /* + * fileName.length = 0 means "no entry at this offset" * If the file is a symlink (as specified in attr) * this name is the name of the symlink, not the target. - */ - HgfsFileNameV3 fileName; + */ + HgfsFileNameV3 fileName; } HgfsDirEntry; typedef @@ -892,8 +902,8 @@ struct HgfsReplySearchReadV3 { uint64 count; /* Number of directory entries. */ uint64 reserved; /* Reserved for future use. */ char payload[1]; /* Directory entries. */ -} -#include "vmware_pack_end.h" +} +#include "vmware_pack_end.h" HgfsReplySearchReadV3; @@ -996,10 +1006,10 @@ typedef struct HgfsReplyGetattrV2 { HgfsReply header; HgfsAttrV2 attr; - + /* - * If the file is a symlink, as specified in attr.type, then this is - * the target for the symlink. If the file is not a symlink, this should + * If the file is a symlink, as specified in attr.type, then this is + * the target for the symlink. If the file is not a symlink, this should * be ignored. * * This filename is in "CPNameLite" format. See CPNameLite.c for details. @@ -1014,10 +1024,10 @@ typedef #include "vmware_pack_begin.h" struct HgfsReplyGetattrV3 { HgfsAttrV2 attr; - + /* - * If the file is a symlink, as specified in attr.type, then this is - * the target for the symlink. If the file is not a symlink, this should + * If the file is a symlink, as specified in attr.type, then this is + * the target for the symlink. If the file is not a symlink, this should * be ignored. * * This filename is in "CPNameLite" format. See CPNameLite.c for details. @@ -1192,7 +1202,7 @@ struct HgfsRequestDelete { HgfsRequestDelete; -/* Version 2 of HgfsReplyCreateDir */ +/* Version 2 of HgfsRequestDelete */ typedef #include "vmware_pack_begin.h" @@ -1206,7 +1216,7 @@ struct HgfsRequestDeleteV2 { HgfsRequestDeleteV2; -/* Version 3 of HgfsReplyCreateDir */ +/* Version 3 of HgfsRequestDelete */ typedef #include "vmware_pack_begin.h" @@ -1420,7 +1430,7 @@ struct HgfsReplySymlinkCreate { HgfsReplySymlinkCreate; -/* HgfsRequestServerLockChange and HgfsReplyServerLockChange for v3. */ +/* HgfsRequestSymlinkCreate and HgfsReplySymlinkCreate for v3. */ typedef #include "vmware_pack_begin.h" diff --git a/open-vm-tools/modules/linux/vmhgfs/hgfsUtil.h b/open-vm-tools/modules/linux/vmhgfs/hgfsUtil.h index 1b98bf761..66dc72d4c 100644 --- a/open-vm-tools/modules/linux/vmhgfs/hgfsUtil.h +++ b/open-vm-tools/modules/linux/vmhgfs/hgfsUtil.h @@ -91,6 +91,14 @@ struct timespec { #define HGFS_NAME_BUFFER_SIZE(request) (HGFS_PACKET_MAX - (sizeof *request - 1)) #define HGFS_NAME_BUFFER_SIZET(sizet) (HGFS_PACKET_MAX - (sizet) - 1) +/* XXX: Needs change when VMCI is supported. */ +#define HGFS_REQ_PAYLOAD_SIZE_V3(hgfsReq) (sizeof *hgfsReq + sizeof(HgfsRequest)) +#define HGFS_REP_PAYLOAD_SIZE_V3(hgfsRep) (sizeof *hgfsRep + sizeof(HgfsReply)) + +/* XXX: Needs change when VMCI is supported. */ +#define HGFS_REQ_GET_PAYLOAD_V3(hgfsReq) ((char *)(hgfsReq) + sizeof(HgfsRequest)) +#define HGFS_REP_GET_PAYLOAD_V3(hgfsRep) ((char *)(hgfsRep) + sizeof(HgfsReply)) + #ifndef _WIN32 /* * Routines for converting between Win NT and unix time formats. The diff --git a/open-vm-tools/modules/linux/vmhgfs/inode.c b/open-vm-tools/modules/linux/vmhgfs/inode.c index 9c9cd3782..382c89b51 100644 --- a/open-vm-tools/modules/linux/vmhgfs/inode.c +++ b/open-vm-tools/modules/linux/vmhgfs/inode.c @@ -246,7 +246,7 @@ HgfsDelete(struct inode *dir, // IN: Parent dir of file/dir to delete request->hints = 0; fileName = request->fileName.name; fileNameLength = &request->fileName.length; - reqSize = sizeof *request + sizeof *header; + reqSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); } else { HgfsRequestDelete *request; @@ -464,9 +464,9 @@ HgfsPackSetattrRequest(struct iattr *iattr, // IN: Inode attrs to update from } else { fileName = requestV3->fileName.name; fileNameLength = &requestV3->fileName.length; - requestV3->fileName.flags = HGFS_FILE_NAME_DEFAULT_CASE; + requestV3->fileName.caseType = HGFS_FILE_NAME_DEFAULT_CASE; } - reqSize = sizeof *requestV3 + sizeof *requestHeader; + reqSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); reqBufferSize = HGFS_NAME_BUFFER_SIZET(reqSize); /* @@ -766,15 +766,15 @@ HgfsPackCreateDirRequest(struct dentry *dentry, // IN: Directory to create requestHeader->op = opUsed; requestHeader->id = req->id; - requestV3 = (HgfsRequestCreateDirV3 *)(HGFS_REQ_PAYLOAD(req) + - sizeof *requestHeader); + requestV3 = (HgfsRequestCreateDirV3 *)(HGFS_REQ_PAYLOAD_V3(req)); /* We'll use these later. */ fileName = requestV3->fileName.name; fileNameLength = &requestV3->fileName.length; - requestV3->fileName.flags = HGFS_FILE_NAME_CASE_SENSITIVE; + requestV3->fileName.flags = 0; + requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; - requestSize = sizeof *requestV3 + sizeof *requestHeader; + requestSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); requestV3->mask = HGFS_CREATE_DIR_MASK; @@ -1328,10 +1328,14 @@ HgfsRename(struct inode *oldDir, // IN: Inode of original directory struct dentry *newDentry) // IN: Dentry containing new name { HgfsReq *req = NULL; - HgfsRequestRename *request; - HgfsReplyRename *reply; - HgfsFileName *newNameP = NULL; + char *oldName; + char *newName; + uint32 *oldNameLength; + uint32 *newNameLength; int result = 0; + uint32 reqSize; + HgfsOp opUsed; + HgfsStatus replyStatus; ASSERT(oldDir); ASSERT(oldDir->i_sb); @@ -1353,25 +1357,42 @@ HgfsRename(struct inode *oldDir, // IN: Inode of original directory goto out; } - request = (HgfsRequestRename *)(HGFS_REQ_PAYLOAD(req)); +retry: + if (atomic_read(&hgfsProtocolVersion) == HGFS_VERSION_3) { + HgfsRequestRenameV3 *request = (HgfsRequestRenameV3 *)HGFS_REQ_PAYLOAD_V3(req); + HgfsRequest *header = (HgfsRequest *)HGFS_REQ_PAYLOAD(req); - request->header.id = req->id; - request->header.op = HGFS_OP_RENAME; + header->op = opUsed = HGFS_OP_RENAME_V3; + header->id = req->id; + + oldName = request->oldName.name; + oldNameLength = &request->oldName.length; + request->oldName.flags = 0; + request->oldName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; + reqSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); + } else { + HgfsRequestRename *request = (HgfsRequestRename *)HGFS_REQ_PAYLOAD(req); + + request->header.op = opUsed = HGFS_OP_RENAME; + oldName = request->oldName.name; + oldNameLength = &request->oldName.length; + reqSize = sizeof *request; + } /* Build full old name to send to server. */ - if (HgfsBuildPath(request->oldName.name, HGFS_NAME_BUFFER_SIZE(request), + if (HgfsBuildPath(oldName, HGFS_NAME_BUFFER_SIZET(reqSize), oldDentry) < 0) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: build old path failed\n")); result = -EINVAL; goto out; } LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRename: Old name: \"%s\"\n", - request->oldName.name)); + oldName)); /* Convert old name to CP format. */ - result = CPName_ConvertTo(request->oldName.name, - HGFS_NAME_BUFFER_SIZE(request), - request->oldName.name); + result = CPName_ConvertTo(oldName, + HGFS_NAME_BUFFER_SIZET(reqSize), + oldName); if (result < 0) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: oldName CP " "conversion failed\n")); @@ -1380,9 +1401,9 @@ HgfsRename(struct inode *oldDir, // IN: Inode of original directory } /* Unescape the old CP name. */ - result = HgfsUnescapeBuffer(request->oldName.name, result); - request->oldName.length = result; - req->payloadSize = sizeof *request + result; + result = HgfsUnescapeBuffer(oldName, result); + *oldNameLength = result; + reqSize += result; /* * Build full new name to send to server. @@ -1391,21 +1412,37 @@ HgfsRename(struct inode *oldDir, // IN: Inode of original directory * must account for it when determining the amount of buffer available for * the second. */ - newNameP = (HgfsFileName *)((char *)&request->oldName + - sizeof request->oldName + result); - if (HgfsBuildPath(newNameP->name, HGFS_NAME_BUFFER_SIZE(request) - result, + if (opUsed == HGFS_OP_RENAME_V3) { + HgfsRequestRenameV3 *request = (HgfsRequestRenameV3 *)HGFS_REQ_PAYLOAD_V3(req); + HgfsFileNameV3 *newNameP; + newNameP = (HgfsFileNameV3 *)((char *)&request->oldName + + sizeof request->oldName + result); + newName = newNameP->name; + newNameLength = &newNameP->length; + newNameP->flags = 0; + newNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE; + } else { + HgfsRequestRename *request = (HgfsRequestRename *)HGFS_REQ_PAYLOAD(req); + HgfsFileName *newNameP; + newNameP = (HgfsFileName *)((char *)&request->oldName + + sizeof request->oldName + result); + newName = newNameP->name; + newNameLength = &newNameP->length; + } + + if (HgfsBuildPath(newName, HGFS_NAME_BUFFER_SIZET(reqSize) - result, newDentry) < 0) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: build new path failed\n")); result = -EINVAL; goto out; } LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRename: New name: \"%s\"\n", - newNameP->name)); + newName)); /* Convert new name to CP format. */ - result = CPName_ConvertTo(newNameP->name, - HGFS_NAME_BUFFER_SIZE(request) - result, - newNameP->name); + result = CPName_ConvertTo(newName, + HGFS_NAME_BUFFER_SIZET(reqSize) - result, + newName); if (result < 0) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: newName CP " "conversion failed\n")); @@ -1414,20 +1451,26 @@ HgfsRename(struct inode *oldDir, // IN: Inode of original directory } /* Unescape the new CP name. */ - result = HgfsUnescapeBuffer(newNameP->name, result); - newNameP->length = result; - req->payloadSize += result; + result = HgfsUnescapeBuffer(newName, result); + *newNameLength = result; + reqSize += result; + req->payloadSize = reqSize; result = HgfsSendRequest(req); if (result == 0) { - if (req->payloadSize != sizeof *reply) { - /* This packet size should never vary. */ - LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: wrong packet size\n")); - result = -EPROTO; - } else { - LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRename: got reply\n")); - reply = (HgfsReplyRename *)(HGFS_REQ_PAYLOAD(req)); - result = HgfsStatusConvertToLinux(reply->header.status); + LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRename: got reply\n")); + replyStatus = HgfsReplyStatus(req); + result = HgfsStatusConvertToLinux(replyStatus); + + if (result == -EPROTO) { + if (opUsed == HGFS_OP_RENAME_V3) { + atomic_set(&hgfsProtocolVersion, HGFS_VERSION_OLD); + goto retry; + } else { + LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: server " + "returned error: %d\n", result)); + goto out; + } } } else if (result == -EIO) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRename: timed out\n")); @@ -1495,8 +1538,9 @@ HgfsPackSymlinkCreateRequest(struct dentry *dentry, // IN: File pointer for th /* We'll use these later. */ symlinkName = requestV3->symlinkName.name; symlinkNameLength = &requestV3->symlinkName.length; - requestV3->symlinkName.flags = HGFS_FILE_NAME_CASE_SENSITIVE; - requestSize = sizeof *requestV3 + sizeof *requestHeader; + requestV3->symlinkName.flags = 0; + requestV3->symlinkName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; + requestSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); break; } case HGFS_OP_CREATE_SYMLINK: { @@ -1558,7 +1602,8 @@ HgfsPackSymlinkCreateRequest(struct dentry *dentry, // IN: File pointer for th sizeof requestV3->symlinkName + result); targetName = fileNameP->name; targetNameLength = &fileNameP->length; - fileNameP->flags = HGFS_FILE_NAME_CASE_SENSITIVE; + fileNameP->flags = 0; + fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE; } else { HgfsFileName *fileNameP; fileNameP = (HgfsFileName *)((char *)&request->symlinkName + @@ -1570,12 +1615,12 @@ HgfsPackSymlinkCreateRequest(struct dentry *dentry, // IN: File pointer for th /* Copy target name into request packet. */ if (targetNameBytes > HGFS_PACKET_MAX - (requestSize - 1)) { - LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSymlink: target name is too " + LOG(4, (KERN_DEBUG "VMware hgfs: HgfsPackSymlinkCreateRequest: target name is too " "big\n")); return -EINVAL; } memcpy(targetName, symname, targetNameBytes); - LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSymlink: target name: \"%s\"\n", + LOG(6, (KERN_DEBUG "VMware hgfs: HgfsPackSymlinkCreateRequest: target name: \"%s\"\n", targetName)); /* Convert target name to CPName-lite format. */ @@ -1650,21 +1695,22 @@ HgfsSymlink(struct inode *dir, // IN: Inode of parent directory LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSymlink: symlink created " "successfully, instantiating dentry\n")); result = HgfsInstantiate(dentry, 0, NULL); - } else { - LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSymlink: symlink was not " - "created, error %d\n", result)); + } else if (result == -EPROTO) { + /* Retry with older versions of Setattr. Set globally. */ + if (opUsed == HGFS_OP_CREATE_SYMLINK_V3) { + LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSymlink: Version 3 " + "not supported. Falling back to version 2.\n")); + atomic_set(&hgfsVersionCreateSymlink, HGFS_OP_CREATE_SYMLINK); + atomic_set(&hgfsProtocolVersion, HGFS_VERSION_OLD); + goto retry; + } else { + LOG(6, (KERN_DEBUG "VMware hgfs: HgfsSymlink: symlink was not " + "created, error %d\n", result)); + } } } else if (result == -EIO) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSymlink: timed out\n")); } else if (result == -EPROTO) { - /* Retry with older versions of Setattr. Set globally. */ - if (opUsed == HGFS_OP_CREATE_SYMLINK_V3) { - LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSymlink: Version 3 " - "not supported. Falling back to version 2.\n")); - atomic_set(&hgfsVersionCreateSymlink, HGFS_OP_CREATE_SYMLINK); - atomic_set(&hgfsProtocolVersion, HGFS_VERSION_OLD); - goto retry; - } LOG(4, (KERN_DEBUG "VMware hgfs: HgfsSymlink: server " "returned error: %d\n", result)); } else { diff --git a/open-vm-tools/modules/linux/vmhgfs/page.c b/open-vm-tools/modules/linux/vmhgfs/page.c index 68c87b922..0d3f23c7f 100644 --- a/open-vm-tools/modules/linux/vmhgfs/page.c +++ b/open-vm-tools/modules/linux/vmhgfs/page.c @@ -39,6 +39,7 @@ #include "hgfsProto.h" #include "module.h" #include "request.h" +#include "hgfsUtil.h" #include "fsutil.h" #include "inode.h" #include "vm_assert.h" @@ -161,7 +162,7 @@ HgfsDoRead(HgfsHandle handle, // IN: Handle for this file request->file = handle; request->offset = offset; request->requiredSize = count; - req->payloadSize = sizeof *request + sizeof *header; + req->payloadSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); } else { HgfsRequestRead *request; @@ -307,7 +308,7 @@ HgfsDoWrite(HgfsHandle handle, // IN: Handle for this file request->requiredSize = count; payload = request->payload; requiredSize = request->requiredSize; - reqSize = sizeof *request + sizeof *header; + reqSize = HGFS_REQ_PAYLOAD_SIZE_V3(request); } else { HgfsRequestWrite *request; @@ -336,9 +337,9 @@ HgfsDoWrite(HgfsHandle handle, // IN: Handle for this file switch (result) { case 0: if (opUsed == HGFS_OP_WRITE_V3) { - actualSize = ((HgfsReplyReadV3 *)HGFS_REP_PAYLOAD_V3(req))->actualSize; + actualSize = ((HgfsReplyWriteV3 *)HGFS_REP_PAYLOAD_V3(req))->actualSize; } else { - actualSize = ((HgfsReplyRead *)HGFS_REQ_PAYLOAD(req))->actualSize; + actualSize = ((HgfsReplyWrite *)HGFS_REQ_PAYLOAD(req))->actualSize; } /* Return result. */ diff --git a/open-vm-tools/modules/linux/vmhgfs/super.c b/open-vm-tools/modules/linux/vmhgfs/super.c index f4dcd866d..c6b2b4415 100644 --- a/open-vm-tools/modules/linux/vmhgfs/super.c +++ b/open-vm-tools/modules/linux/vmhgfs/super.c @@ -277,8 +277,9 @@ HgfsPackQueryVolumeRequest(struct dentry *dentry, // IN: File pointer for this /* We'll use these later. */ name = requestV3->fileName.name; nameLength = &requestV3->fileName.length; - requestV3->fileName.flags = HGFS_FILE_NAME_CASE_SENSITIVE; - requestSize = sizeof *requestV3 + sizeof *requestHeader; + requestV3->fileName.flags = 0; + requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; + requestSize = HGFS_REQ_PAYLOAD_SIZE_V3(requestV3); break; } case HGFS_OP_QUERY_VOLUME_INFO: { diff --git a/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86.h b/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86.h index ce83e3be7..4f8213b03 100644 --- a/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86.h +++ b/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86.h @@ -100,13 +100,13 @@ static INLINE void FXSAVE_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsave %0\n" : "=m" (*save)); + __asm__ __volatile__ ("fxsave %0\n" : "=m" (*save) : : "memory"); } static INLINE void FXRSTOR_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstor %0\n" : : "m" (*load) : "memory"); } static INLINE void @@ -126,7 +126,7 @@ FXRSTOR_AMD_ES0(const uint8 *load) "fxrstor %1 \n" : : "m" (dummy), "m" (*load) - : "ax"); + : "ax", "memory"); } #endif /* __GNUC__ */ diff --git a/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86_64.h b/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86_64.h index 72db20a4f..9ec83eca0 100644 --- a/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86_64.h +++ b/open-vm-tools/modules/linux/vmhgfs/vm_basic_asm_x86_64.h @@ -84,25 +84,25 @@ uint64 __shiftright128(uint64 lowPart, uint64 highPart, uint8 shift); static INLINE void FXSAVE_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsaveq %0 \n" : "=m" (*save)); + __asm__ __volatile__ ("fxsaveq %0 \n" : "=m" (*save) : : "memory"); } static INLINE void FXSAVE_COMPAT_ES1(uint8 *save) { - __asm__ __volatile__ ("fxsave %0 \n" : "=m" (*save)); + __asm__ __volatile__ ("fxsave %0 \n" : "=m" (*save) : : "memory"); } static INLINE void FXRSTOR_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstorq %0 \n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstorq %0 \n" : : "m" (*load) : "memory"); } static INLINE void FXRSTOR_COMPAT_ES1(const uint8 *load) { - __asm__ __volatile__ ("fxrstor %0 \n" : : "m" (*load)); + __asm__ __volatile__ ("fxrstor %0 \n" : : "m" (*load) : "memory"); } static INLINE void @@ -122,7 +122,7 @@ FXRSTOR_AMD_ES0(const uint8 *load) "fxrstorq %1 \n" : : "m" (dummy), "m" (*load) - : "ax"); + : "ax", "memory"); } #endif /* __GNUC__ */ diff --git a/open-vm-tools/modules/linux/vmhgfs/vm_basic_types.h b/open-vm-tools/modules/linux/vmhgfs/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/linux/vmhgfs/vm_basic_types.h +++ b/open-vm-tools/modules/linux/vmhgfs/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/linux/vmmemctl/backdoor_def.h b/open-vm-tools/modules/linux/vmmemctl/backdoor_def.h index da052ec2b..fd7460213 100644 --- a/open-vm-tools/modules/linux/vmmemctl/backdoor_def.h +++ b/open-vm-tools/modules/linux/vmmemctl/backdoor_def.h @@ -111,7 +111,8 @@ #define BDOOR_CMD_BIOSBBS 50 #define BDOOR_CMD_VASSERT 51 #define BDOOR_CMD_ISGOSDARWIN 52 -#define BDOOR_CMD_MAX 53 +#define BDOOR_CMD_DEBUGEVENT 53 +#define BDOOR_CMD_MAX 54 /* * IMPORTANT NOTE: When modifying the behavior of an existing backdoor command, diff --git a/open-vm-tools/modules/linux/vmmemctl/compat_kthread.h b/open-vm-tools/modules/linux/vmmemctl/compat_kthread.h new file mode 100644 index 000000000..8977b89e7 --- /dev/null +++ b/open-vm-tools/modules/linux/vmmemctl/compat_kthread.h @@ -0,0 +1,223 @@ +/********************************************************* + * Copyright (C) 2008 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *********************************************************/ + +#ifndef __COMPAT_KTHREAD_H__ +# define __COMPAT_KTHREAD_H__ + +/* + * The kthread interface for managing kernel threads appeared in 2.6.4, but was + * only exported for module use in 2.6.7. + */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 7) +# include + +# define COMPAT_KTHREAD_DECLARE_STOP_INFO() +# define compat_kthread_stop(_tsk) kthread_stop(_tsk) +# define compat_kthread_should_stop() kthread_should_stop() +# define compat_kthread_run(_fn, _data, _namefmt, ...) \ + kthread_run(_fn, _data, _namefmt, ## __VA_ARGS__) +# define compat_kthread_create(_fn, _data, _namefmt, ...) \ + kthread_create(_fn, _data, _namefmt, ## __VA_ARGS__) +#else + +/* + * When the kthread interface isn't available, we do our best to emulate it, + * with a few notable exceptions: + * + * 1: We use semaphores instead of mutexes for locking, because mutexes aren't + * available in kernels where kthread isn't available. + * 2: The real kthread interface uses the kthreadd kernel_thread to broker the + * creation of new kernel threads. This makes sense because kthreadd is part + * of the kernel, but doesn't make sense at all in the context of an + * individual module. So in our emulation, thread creation occurs in the + * context of a kthread_create call. + * 3: Because kthreadd is responsible for creating kernel threads in the real + * kthread interface, there's no need to explicitly reparent any of them. We + * aren't using kthreadd, so we call daemonize to reparent, which also sets + * the name of the new kernel thread. That's why we don't set the name as + * the real kthread interface does (within kthread_create). Furthermore, to + * get the name to daemonize, we're forced to pass it through the + * kthread_start_info struct. + * 4: Since our interface isn't in the kernel proper, we can't make use of + * get_task_struct/put_task_struct so as to acquire references to kernel + * threads that we're managing. To prevent races, we use an extra completion + * when stopping kernel threads. See the comments in compat_kthread_stop for + * more details. + * + * Like the real kthread interface, ours must be globally available so that we + * can emulate functions like kthread_should_stop without using different + * signatures. + */ + +# include "compat_completion.h" +# include "compat_kernel.h" +# include "compat_sched.h" + +struct compat_kthread_start_info { + int (*fn)(void *); + void *data; + compat_completion created; + char comm[TASK_COMM_LEN]; +}; + +struct compat_kthread_stop_info { + struct semaphore lock; + struct task_struct *task; + compat_completion woken; + compat_completion stopped; + int ret; +}; + +extern struct compat_kthread_stop_info compat_kthread_stop_info; + +# define COMPAT_KTHREAD_DECLARE_STOP_INFO() \ + struct compat_kthread_stop_info compat_kthread_stop_info = { \ + .lock = __SEMAPHORE_INITIALIZER(compat_kthread_stop_info.lock, 1), \ + .task = NULL, \ + } + + +static inline int +compat_kthread_should_stop(void) +{ + return (compat_kthread_stop_info.task == current); +} + + +static inline int +compat_kthread_stop(struct task_struct *_task) +{ + int ret; + + down(&compat_kthread_stop_info.lock); + + /* + * We use a write memory barrier to ensure that all CPUs see _task after + * the completions have been initialized. + * + * There's a race between kernel threads managed by kthread and the upcoming + * call to wake_up_process. If the kernel thread wakes up after we set task + * but before the call to wake_up_process, the thread's call to + * compat_kthread_should_stop will return true and the thread will exit. At + * that point, the call to wake_up_process will be on a dead task_struct. + * + * XXX: The real kthread interface protects against this race by grabbing + * and releasing a reference to _task. We don't have that luxury, because + * there is a range of kernels where put_task_struct isn't exported to + * modules. In fact, no other modules call get_task_struct or + * put_task_struct, so to do so from this context may be unwise. Instead, + * we'll use an extra completion to ensure that the kernel thread only exits + * after wake_up_process has been called. + */ + compat_init_completion(&compat_kthread_stop_info.woken); + compat_init_completion(&compat_kthread_stop_info.stopped); + smp_wmb(); + + compat_kthread_stop_info.task = _task; + wake_up_process(_task); + compat_complete(&compat_kthread_stop_info.woken); + + compat_wait_for_completion(&compat_kthread_stop_info.stopped); + compat_kthread_stop_info.task = NULL; + ret = compat_kthread_stop_info.ret; + up(&compat_kthread_stop_info.lock); + return ret; +} + + +# define compat_kthread_run(_fn, _data, _namefmt, ...) \ +({ \ + struct task_struct *tsk; \ + tsk = compat_kthread_create(_fn, _data, _namefmt, ## __VA_ARGS__); \ + if (!IS_ERR(tsk)) { \ + wake_up_process(tsk); \ + } \ + tsk; \ +}) + + +static inline int +compat_kthread(void *_data) +{ + int ret = -EINTR; + struct compat_kthread_start_info *info; + int (*fn)(void *data); + void *data; + + info = (struct compat_kthread_start_info *)_data; + fn = info->fn; + data = info->data; + + compat_daemonize(info->comm); + __set_current_state(TASK_UNINTERRUPTIBLE); + compat_complete(&info->created); + schedule(); + + if (!compat_kthread_should_stop()) { + ret = fn(data); + } + + if (compat_kthread_should_stop()) { + compat_wait_for_completion(&compat_kthread_stop_info.woken); + compat_kthread_stop_info.ret = ret; + compat_complete_and_exit(&compat_kthread_stop_info.stopped, 0); + BUG(); + } + return 0; +} + + +static inline struct task_struct * +compat_kthread_create(int (*_fn)(void *data), + void *_data, + const char _namefmt[], + ...) +{ + pid_t pid; + struct task_struct *task = NULL; + struct compat_kthread_start_info info; + va_list args; + + info.fn = _fn; + info.data = _data; + compat_init_completion(&info.created); + va_start(args, _namefmt); + vsnprintf(info.comm, sizeof info.comm, _namefmt, args); + va_end(args); + pid = kernel_thread(compat_kthread, &info, CLONE_KERNEL); + if (pid >= 0) { + compat_wait_for_completion(&info.created); + + /* + * find_task_by_pid must be called with tasklist_lock held or under + * rcu_read_lock. As the latter doesn't exist in old kernels, we use the + * former for convenience. + */ + read_lock(&tasklist_lock); + task = find_task_by_pid(pid); + read_unlock(&tasklist_lock); + + /* XXX: Do we need to get a reference on task? */ + } + return task; +} + +#endif + +#endif /* __COMPAT_KTHREAD_H__ */ diff --git a/open-vm-tools/modules/linux/vmmemctl/os.c b/open-vm-tools/modules/linux/vmmemctl/os.c index b813cb6fb..0588d9dc6 100644 --- a/open-vm-tools/modules/linux/vmmemctl/os.c +++ b/open-vm-tools/modules/linux/vmmemctl/os.c @@ -58,6 +58,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #include +#include "compat_kthread.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 9) int errno; /* compat_exit() needs global errno variable. */ @@ -72,6 +73,7 @@ int errno; /* compat_exit() needs global errno variable. */ * Allow allocations from high memory on 2.4.x kernels. */ #define OS_KTHREAD (1) +COMPAT_KTHREAD_DECLARE_STOP_INFO(); #endif #include "os.h" @@ -148,12 +150,6 @@ int errno; /* compat_exit() needs global errno variable. */ #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41) -#define OS_USE_SCHEDULE_DELAYED_WORK -#else -#undef OS_USE_SCHEDULE_DELAYED_WORK -#endif - /* * Types */ @@ -164,23 +160,17 @@ typedef struct { void *data; int period; - /* termination flag */ - volatile int stop; - /* system structures */ #ifdef OS_KTHREAD wait_queue_head_t delay; - compat_completion notifyStart; - compat_completion notifyStop; - pid_t pid; -#else -#ifdef OS_USE_SCHEDULE_DELAYED_WORK - struct work_struct work; + struct task_struct *task; #else + /* termination flag */ + atomic_t stop; + struct timer_list timer; struct tq_struct task; #endif -#endif } os_timer; typedef struct { @@ -344,20 +334,32 @@ os_free_reserved_page(unsigned long addr) } #ifndef OS_KTHREAD -static void os_timer_add(os_timer *t); +static void os_timer_add(os_timer *t) +{ + /* schedule timer callback */ + struct timer_list *timer = &t->timer; + timer->expires = jiffies + t->period; + add_timer(timer); +} + +static void os_timer_remove(os_timer *t) +{ + /* deschedule timer callback */ + struct timer_list *timer = &t->timer; + (void) del_timer(timer); +} static void os_timer_bh(void *data) { os_timer *t = (os_timer *) data; - if (!t->stop) { + if (!atomic_read(&t->stop)) { /* execute registered handler, rearm timer */ (*(t->handler))(t->data); os_timer_add(t); } } -#ifndef OS_USE_SCHEDULE_DELAYED_WORK static void os_timer_internal(ulong data) { os_timer *t = (os_timer *) data; @@ -368,31 +370,6 @@ static void os_timer_internal(ulong data) } #endif -static void os_timer_add(os_timer *t) -{ -#ifdef OS_USE_SCHEDULE_DELAYED_WORK - schedule_delayed_work(&t->work, t->period); -#else - /* schedule timer callback */ - struct timer_list *timer = &t->timer; - timer->expires = jiffies + t->period; - add_timer(timer); -#endif -} - -static void os_timer_remove(os_timer *t) -{ -#ifdef OS_USE_SCHEDULE_DELAYED_WORK - cancel_delayed_work(&t->work); - flush_scheduled_work(); -#else - /* deschedule timer callback */ - struct timer_list *timer = &t->timer; - (void) del_timer(timer); -#endif -} -#endif - void CDECL os_timer_init(os_timer_handler handler, void *data, int period) { @@ -400,11 +377,8 @@ os_timer_init(os_timer_handler handler, void *data, int period) t->handler = handler; t->data = data; t->period = period; - t->stop = 0; #ifndef OS_KTHREAD -#ifdef OS_USE_SCHEDULE_DELAYED_WORK - INIT_WORK(&t->work, os_timer_bh, t); -#else + atomic_set(&t->stop, 0); t->task.routine = os_timer_bh; t->task.data = t; /* initialize timer state */ @@ -412,7 +386,6 @@ os_timer_init(os_timer_handler handler, void *data, int period) t->timer.function = os_timer_internal; t->timer.data = (ulong) t; #endif -#endif } #ifdef OS_KTHREAD @@ -420,21 +393,16 @@ static int os_timer_thread_loop(void *data) { os_timer *t = (os_timer *) data; - /* detach thread */ - lock_kernel(); - compat_daemonize("vmmemctl"); - unlock_kernel(); - /* we are running */ - compat_complete(&t->notifyStart); compat_set_freezable(); /* main loop */ while (1) { /* sleep for specified period */ - wait_event_interruptible_timeout(t->delay, t->stop, t->period); + wait_event_interruptible_timeout(t->delay, compat_kthread_should_stop(), + t->period); compat_try_to_freeze(); - if (t->stop) { + if (compat_kthread_should_stop()) { break; } @@ -443,7 +411,6 @@ static int os_timer_thread_loop(void *data) } /* terminate */ - compat_complete_and_exit(&t->notifyStop, 0); return(0); } @@ -452,31 +419,27 @@ static int os_timer_thread_start(os_timer *t) os_status *s = &global_state.status; /* initialize sync objects */ - compat_init_completion(&t->notifyStart); - compat_init_completion(&t->notifyStop); init_waitqueue_head(&t->delay); /* create kernel thread */ - t->pid = kernel_thread(os_timer_thread_loop, t, 0); - if (t->pid < 0) { + t->task = compat_kthread_run(os_timer_thread_loop, t, "vmmemctl"); + if (IS_ERR(t->task)) { /* fail */ - printk(KERN_WARNING "%s: unable to create kernel thread (%d)\n", s->name, t->pid); + printk(KERN_WARNING "%s: unable to create kernel thread\n", s->name); return(-1); } if (OS_DEBUG) { - printk(KERN_DEBUG "%s: started kernel thread pid=%d\n", s->name, t->pid); + printk(KERN_DEBUG "%s: started kernel thread pid=%d\n", s->name, + t->task->pid); } - /* block until started... Why?! */ - compat_wait_for_completion(&t->notifyStart); return(0); } static void os_timer_thread_stop(os_timer *t) { - wake_up_interruptible(&t->delay); - compat_wait_for_completion(&t->notifyStop); + compat_kthread_stop(t->task); } #endif @@ -485,12 +448,12 @@ os_timer_start(void) { os_timer *t = &global_state.timer; - /* clear termination flag */ - t->stop = 0; - #ifdef OS_KTHREAD os_timer_thread_start(t); #else + /* clear termination flag */ + atomic_set(&t->stop, 0); + os_timer_add(t); #endif } @@ -500,12 +463,12 @@ os_timer_stop(void) { os_timer *t = &global_state.timer; - /* set termination flag */ - t->stop = 1; - #ifdef OS_KTHREAD os_timer_thread_stop(t); #else + /* set termination flag */ + atomic_set(&t->stop, 1); + os_timer_remove(t); #endif } diff --git a/open-vm-tools/modules/linux/vmmemctl/vm_basic_types.h b/open-vm-tools/modules/linux/vmmemctl/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/linux/vmmemctl/vm_basic_types.h +++ b/open-vm-tools/modules/linux/vmmemctl/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/modules/linux/vmmemctl/vmmemctl_version.h b/open-vm-tools/modules/linux/vmmemctl/vmmemctl_version.h index 67c2a5462..5a2e154b2 100644 --- a/open-vm-tools/modules/linux/vmmemctl/vmmemctl_version.h +++ b/open-vm-tools/modules/linux/vmmemctl/vmmemctl_version.h @@ -25,8 +25,8 @@ #ifndef _VMMEMCTL_VERSION_H_ #define _VMMEMCTL_VERSION_H_ -#define VMMEMCTL_DRIVER_VERSION 1.0.1.0 -#define VMMEMCTL_DRIVER_VERSION_COMMAS 1,0,1,0 -#define VMMEMCTL_DRIVER_VERSION_STRING "1.0.1.0" +#define VMMEMCTL_DRIVER_VERSION 1.2.1.0 +#define VMMEMCTL_DRIVER_VERSION_COMMAS 1,2,1,0 +#define VMMEMCTL_DRIVER_VERSION_STRING "1.2.1.0" #endif /* _VMMEMCTL_VERSION_H_ */ diff --git a/open-vm-tools/modules/linux/vmxnet/compat_netdevice.h b/open-vm-tools/modules/linux/vmxnet/compat_netdevice.h index cfdad2b3f..6117b1aee 100644 --- a/open-vm-tools/modules/linux/vmxnet/compat_netdevice.h +++ b/open-vm-tools/modules/linux/vmxnet/compat_netdevice.h @@ -20,6 +20,8 @@ # define __COMPAT_NETDEVICE_H__ +#include +#include #include #include @@ -243,4 +245,43 @@ compat_netif_carrier_off(struct device *dev) #define compat_netif_carrier_off(dev) netif_carrier_off(dev) #endif +/* unregister_netdevice_notifier was not safe prior to 2.6.17 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17) && \ + !defined(ATOMIC_NOTIFIER_INIT) +/* pre 2.6.17 and not patched */ +static inline int compat_unregister_netdevice_notifier(struct notifier_block *nb) { + int err; + + rtnl_lock(); + err = unregister_netdevice_notifier(nb); + rtnl_unlock(); + return err; +} +#else +/* post 2.6.17 or patched */ +#define compat_unregister_netdevice_notifier(_nb) \ + unregister_netdevice_notifier(_nb); +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) +#define compat_netif_napi_add(dev, napi, poll, quota) \ + netif_napi_add(dev, napi, poll, quota) +#define compat_netif_rx_schedule(dev, napi) netif_rx_schedule(dev, napi) +#define compat_napi_enable(dev, napi) napi_enable(napi) +#define compat_napi_disable(dev, napi) napi_disable(napi) +#else +struct napi_struct { + int dummy; +}; + +#define compat_netif_napi_add(dev, napi, pollcb, quota) \ + do { \ + (dev)->poll = (pollcb); \ + (dev)->weight = (quota);\ + } while (0) +#define compat_netif_rx_schedule(dev, napi) netif_rx_schedule(dev) +#define compat_napi_enable(dev, napi) netif_poll_enable(dev) +#define compat_napi_disable(dev, napi) netif_poll_disable(dev) +#endif + #endif /* __COMPAT_NETDEVICE_H__ */ diff --git a/open-vm-tools/modules/linux/vmxnet/vm_basic_types.h b/open-vm-tools/modules/linux/vmxnet/vm_basic_types.h index 50afb4c21..f5c96f9ea 100644 --- a/open-vm-tools/modules/linux/vmxnet/vm_basic_types.h +++ b/open-vm-tools/modules/linux/vmxnet/vm_basic_types.h @@ -487,8 +487,9 @@ typedef void * UserVA; # define FMTVPN "" #endif - +#ifndef EXTERN #define EXTERN extern +#endif #define CONST const diff --git a/open-vm-tools/toolbox/Makefile.am b/open-vm-tools/toolbox/Makefile.am index 0d011f150..7d678c887 100644 --- a/open-vm-tools/toolbox/Makefile.am +++ b/open-vm-tools/toolbox/Makefile.am @@ -51,6 +51,7 @@ toolbox_LDADD += ../lib/panicDefault/libPanicDefault.a toolbox_LDADD += ../lib/panic/libPanic.a toolbox_LDADD += -lX11 toolbox_LDADD += @GTK_LIBS@ +toolbox_LDADD += @ICU_LIBS@ toolbox_SOURCES = toolbox_SOURCES += debugStdio.c diff --git a/open-vm-tools/toolbox/Makefile.in b/open-vm-tools/toolbox/Makefile.in index b5a6e172d..4a3ea679c 100644 --- a/open-vm-tools/toolbox/Makefile.in +++ b/open-vm-tools/toolbox/Makefile.in @@ -132,6 +132,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -245,7 +248,7 @@ toolbox_LDADD = ../lib/conf/libConf.a \ ../lib/dict/libDict.a ../lib/message/libMessage.a \ ../lib/unicode/libUnicode.a ../lib/sync/libSync.a \ ../lib/misc/libMisc.a ../lib/panicDefault/libPanicDefault.a \ - ../lib/panic/libPanic.a -lX11 @GTK_LIBS@ + ../lib/panic/libPanic.a -lX11 @GTK_LIBS@ @ICU_LIBS@ toolbox_SOURCES = debugStdio.c stub.c toolbox-gtk.c toolboxAbout.c \ toolboxDevices.c toolboxOptions.c toolboxScripts.c \ toolboxShrink.c diff --git a/open-vm-tools/vmware-user/Makefile.am b/open-vm-tools/vmware-user/Makefile.am index fbee75662..dd6c4a2e2 100644 --- a/open-vm-tools/vmware-user/Makefile.am +++ b/open-vm-tools/vmware-user/Makefile.am @@ -71,6 +71,7 @@ vmware_user_LDADD += -lcrypt vmware_user_LDADD += @GTK_LIBS@ vmware_user_LDADD += @VMWARE_USER_LDADD@ vmware_user_LDADD += @COMMON_XLIBS@ +vmware_user_LDADD += @ICU_LIBS@ vmware_user_SOURCES = vmware_user_SOURCES += copyPaste.c diff --git a/open-vm-tools/vmware-user/Makefile.in b/open-vm-tools/vmware-user/Makefile.in index adf7a18c2..2e5147469 100644 --- a/open-vm-tools/vmware-user/Makefile.in +++ b/open-vm-tools/vmware-user/Makefile.in @@ -144,6 +144,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -268,7 +271,8 @@ vmware_user_LDADD = ../lib/conf/libConf.a ../lib/dnd/libDnd.a \ ../lib/unicode/libUnicode.a ../lib/misc/libMisc.a \ ../lib/procMgr/libProcMgr.a ../lib/auth/libAuth.a \ ../lib/panicDefault/libPanicDefault.a ../lib/panic/libPanic.a \ - -lcrypt @GTK_LIBS@ @VMWARE_USER_LDADD@ @COMMON_XLIBS@ + -lcrypt @GTK_LIBS@ @VMWARE_USER_LDADD@ @COMMON_XLIBS@ \ + @ICU_LIBS@ $(am__empty) vmware_user_SOURCES = copyPaste.c debugStdio.c dnd.c \ foreignVMToolsDaemon.c foreignVMToolsNetworking.c \ foundryToolsDaemon.c libvmwarectrl.c pointer.c resolution.c \ diff --git a/open-vm-tools/vmware-user/copyPaste.c b/open-vm-tools/vmware-user/copyPaste.c index d90e06445..118560ca1 100644 --- a/open-vm-tools/vmware-user/copyPaste.c +++ b/open-vm-tools/vmware-user/copyPaste.c @@ -1952,3 +1952,26 @@ CopyPaste_InProgress(void) /* XXX We currently have no way to determine if a G->H FCP is ongoing. */ return gHGFCPFileTransferStatus == FCP_FILE_TRANSFERRING; } + + +/* + *---------------------------------------------------------------------------- + * + * CopyPaste_IsRpcCPSupported -- + * + * Check if RPC copy/paste is supported by vmx or not. + * + * Results: + * TRUE if RPC copy/paste is supported, FALSE otherwise. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +Bool +CopyPaste_IsRpcCPSupported(void) +{ + return gVmxCopyPasteVersion > 1; +} diff --git a/open-vm-tools/vmware-user/foreignVMToolsNetworking.c b/open-vm-tools/vmware-user/foreignVMToolsNetworking.c index e1524284c..d675a1b2f 100644 --- a/open-vm-tools/vmware-user/foreignVMToolsNetworking.c +++ b/open-vm-tools/vmware-user/foreignVMToolsNetworking.c @@ -281,7 +281,7 @@ ForeignTools_InitializeNetworking(void) } #ifdef _WIN32 - hWs2_32 = LoadLibrary("ws2_32.dll"); + hWs2_32 = LoadLibrary(_T("ws2_32.dll")); if (NULL == hWs2_32) { goto abort; } diff --git a/open-vm-tools/vmware-user/foundryToolsDaemon.c b/open-vm-tools/vmware-user/foundryToolsDaemon.c index d4d587e37..fc83697ef 100644 --- a/open-vm-tools/vmware-user/foundryToolsDaemon.c +++ b/open-vm-tools/vmware-user/foundryToolsDaemon.c @@ -39,6 +39,7 @@ # include # include # include +# include "win32u.h" #elif _WIN32 # include "win95.h" #endif @@ -838,7 +839,7 @@ ToolsDaemonTcloSetPrinter(char const **result, // OUT /* Set this printer as the default if requested. */ if (defaultInt != 0) { - if (!SetDefaultPrinter(printerName)) { + if (!Win32U_SetDefaultPrinter(printerName)) { /* * We couldn't set this printer as default. Oh well. We'll * still report success or failure based purely on whether diff --git a/open-vm-tools/vmware-user/pointer.c b/open-vm-tools/vmware-user/pointer.c index 23dd9aa88..90fe2e48f 100644 --- a/open-vm-tools/vmware-user/pointer.c +++ b/open-vm-tools/vmware-user/pointer.c @@ -163,6 +163,10 @@ PointerUngrabbed(void) * to ungrabbed, call PointerHasBeenUngrabbed, which will push our * clipboard thru the backdoor. While ungrabbed, don't do a thing. * + * This function is queued in Event Manager only when vmx doesn't support + * RPC copy/paste because newer vmx initiates copy/paste from UI through + * RPC, and doesn't need cursor grab/ungrab state to start copy/paste. + * * Results: * TRUE. * @@ -205,8 +209,10 @@ PointerUpdatePointerLoop(void* clientData) // IN: unused } - EventManager_Add(gEventQueue, POINTER_POLL_TIME, PointerUpdatePointerLoop, - clientData); + if (!CopyPaste_IsRpcCPSupported()) { + EventManager_Add(gEventQueue, POINTER_POLL_TIME, PointerUpdatePointerLoop, + clientData); + } return TRUE; } diff --git a/open-vm-tools/vmware-user/resolution.c b/open-vm-tools/vmware-user/resolution.c index 13e148c27..41c9307e2 100644 --- a/open-vm-tools/vmware-user/resolution.c +++ b/open-vm-tools/vmware-user/resolution.c @@ -429,7 +429,7 @@ Resolution_RegisterCapability(void) } #ifndef NO_MULTIMON if (gCanUseVMwareCtrlTopologySet && - !RpcOut_sendOne(NULL, NULL, "tools.capability.display_topology_set 1")) { + !RpcOut_sendOne(NULL, NULL, "tools.capability.display_topology_set 2")) { Debug("%s: Unable to register topology set capability\n", __FUNCTION__); return FALSE; diff --git a/open-vm-tools/vmware-user/vmwareuserInt.h b/open-vm-tools/vmware-user/vmwareuserInt.h index 0aefed5a7..237838aaf 100644 --- a/open-vm-tools/vmware-user/vmwareuserInt.h +++ b/open-vm-tools/vmware-user/vmwareuserInt.h @@ -73,6 +73,7 @@ Bool CopyPaste_GetBackdoorSelections(void); void CopyPaste_Unregister(GtkWidget* mainWnd); Bool CopyPaste_GHFileListGetNext(char **fileName, size_t *fileNameSize); Bool CopyPaste_InProgress(void); +Bool CopyPaste_IsRpcCPSupported(void); Bool Pointer_Register(GtkWidget* mainWnd); diff --git a/open-vm-tools/xferlogs/Makefile.am b/open-vm-tools/xferlogs/Makefile.am index 98a8942cd..652425db1 100644 --- a/open-vm-tools/xferlogs/Makefile.am +++ b/open-vm-tools/xferlogs/Makefile.am @@ -30,6 +30,7 @@ xferlogs_LDADD += ../lib/rpcOut/libRpcOut.a xferlogs_LDADD += ../lib/message/libMessage.a xferlogs_LDADD += ../lib/backdoor/libBackdoor.a xferlogs_LDADD += ../lib/misc/libMisc.a +xferlogs_LDADD += @ICU_LIBS@ xferlogs_SOURCES = xferlogs_SOURCES += xferlogs.c diff --git a/open-vm-tools/xferlogs/Makefile.in b/open-vm-tools/xferlogs/Makefile.in index 991bce371..37ffdfd64 100644 --- a/open-vm-tools/xferlogs/Makefile.in +++ b/open-vm-tools/xferlogs/Makefile.in @@ -120,6 +120,9 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GUESTD_LDADD = @GUESTD_LDADD@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ +ICU_CFLAGS = @ICU_CFLAGS@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -223,7 +226,7 @@ AM_CFLAGS = @COMMON_CFLAGS@ # order so their symbols are properly resolved. xferlogs_LDADD = ../lib/rpcVmx/libRpcVmx.a ../lib/string/libString.a \ ../lib/rpcOut/libRpcOut.a ../lib/message/libMessage.a \ - ../lib/backdoor/libBackdoor.a ../lib/misc/libMisc.a + ../lib/backdoor/libBackdoor.a ../lib/misc/libMisc.a @ICU_LIBS@ xferlogs_SOURCES = xferlogs.c all: all-am diff --git a/open-vm-tools/xferlogs/xferlogs.c b/open-vm-tools/xferlogs/xferlogs.c index 5824de166..e00c0f837 100644 --- a/open-vm-tools/xferlogs/xferlogs.c +++ b/open-vm-tools/xferlogs/xferlogs.c @@ -236,7 +236,9 @@ extractFile(char *filename) //IN: vmx log filename e.g. vmware.log ptrStr = strstr(buf, LOG_GUEST_MARK); ptrStr += sizeof LOG_GUEST_MARK - 1; if (Base64_Decode(ptrStr, base64Out, BUF_OUT_SIZE, &lenOut)) { - fwrite(base64Out, 1, lenOut, outfp); + if (fwrite(base64Out, 1, lenOut, outfp) != lenOut) { + Warning("Error writing output\n"); + } } else { Warning("Error decoding output %s\n", ptrStr); }