[Pkg-virtualbox-commits] [virtualbox] 01/03: Imported Upstream version 4.1.42-dfsg
Gianfranco Costamagna
locutusofborg-guest at moszumanska.debian.org
Mon Oct 26 11:17:54 UTC 2015
This is an automated email from the git hooks/post-receive script.
locutusofborg-guest pushed a commit to branch wheezy
in repository virtualbox.
commit 0478e1f0a04d2269106811bc52ec2dc7d8027502
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date: Mon Oct 26 12:12:52 2015 +0100
Imported Upstream version 4.1.42-dfsg
---
Config.kmk | 20 +-
configure | 43 -
configure.vbs | 67 --
doc/manual/en_US/user_GuestAdditions.xml | 6 +-
doc/manual/en_US/user_Security.xml | 13 +-
doc/manual/user_ChangeLogImpl.xml | 20 +
include/VBox/err.h | 4 +
include/iprt/asm.h | 2 +-
include/iprt/crypto/digest.h | 4 +-
src/VBox/Additions/common/crOpenGL/DD_glc.py | 0
src/VBox/Additions/common/crOpenGL/DD_glh.py | 0
src/VBox/Additions/common/crOpenGL/NULLfuncs.py | 0
src/VBox/Additions/common/crOpenGL/cr_gl.py | 0
src/VBox/Additions/common/crOpenGL/entrypoints.py | 0
.../Additions/common/crOpenGL/feedback/feedback.py | 0
.../common/crOpenGL/feedback/feedback_funcs.py | 0
.../common/crOpenGL/feedback/feedback_state.py | 0
.../common/crOpenGL/feedback/feedbackspu_proto.py | 0
.../Additions/common/crOpenGL/getprocaddress.py | 0
src/VBox/Additions/common/crOpenGL/pack/pack.py | 0
.../common/crOpenGL/pack/packspu_beginend.py | 0
.../common/crOpenGL/pack/packspu_flush.py | 0
.../common/crOpenGL/pack/packspu_proto.py | 0
.../common/crOpenGL/passthrough/passthrough.py | 0
src/VBox/Additions/common/crOpenGL/tsfuncs.py | 0
.../common/crOpenGL/windows_getprocaddress.py | 0
src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd | Bin 2031616 -> 2031616 bytes
src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd | Bin 2031616 -> 2031616 bytes
src/VBox/Devices/Storage/DevATA.cpp | 110 ++-
src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp | 271 +++---
src/VBox/Frontends/VirtualBox/src/main.cpp | 76 +-
src/VBox/GuestHost/OpenGL/error/error.py | 0
src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py | 0
src/VBox/GuestHost/OpenGL/packer/pack_header.py | 0
src/VBox/GuestHost/OpenGL/packer/packer_bbox.py | 0
src/VBox/GuestHost/OpenGL/spu_loader/dispatch.py | 0
.../GuestHost/OpenGL/spu_loader/dispatchheader.py | 0
src/VBox/GuestHost/OpenGL/spu_loader/glloader.py | 0
src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py | 0
src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py | 0
.../GuestHost/OpenGL/state_tracker/state_defs.py | 0
.../GuestHost/OpenGL/state_tracker/state_funcs.py | 0
.../GuestHost/OpenGL/state_tracker/state_get.py | 0
.../OpenGL/state_tracker/state_isenabled.py | 0
src/VBox/GuestHost/OpenGL/util/debug_opcodes.py | 0
src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp | 2 +-
src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c | 6 +-
src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp | 180 +++-
.../Support/win/SUPHardenedVerifyImage-win.cpp | 26 +-
.../Support/win/SUPR3HardenedMain-win.cpp | 26 +-
.../Support/win/SUPR3HardenedMainA-win.asm | 12 +
.../Support/win/SUPR3HardenedMainImports-win.cpp | 70 +-
src/VBox/HostServices/GuestProperties/service.cpp | 163 ++++
.../SharedOpenGL/crserverlib/server_dispatch.py | 0
.../crserverlib/server_dispatch_header.py | 0
.../SharedOpenGL/crserverlib/server_retval.py | 0
.../HostServices/SharedOpenGL/unpacker/unpack.py | 0
.../SharedOpenGL/unpacker/unpack_extend.py | 0
.../SharedOpenGL/unpacker/unpack_header.py | 0
src/VBox/Installer/linux/rpm/rules | 1 -
src/VBox/Main/Makefile.kmk | 1 -
src/VBox/Main/glue/constants-python.xsl | 0
src/VBox/Main/idl/VirtualBox.xidl | 7 +-
src/VBox/Main/include/ConsoleImpl.h | 4 +
src/VBox/Main/include/MachineImpl.h | 5 +-
src/VBox/Main/src-client/ConsoleImpl.cpp | 33 +-
src/VBox/Main/src-server/ApplianceImpl.cpp | 12 -
src/VBox/Main/src-server/ApplianceImplExport.cpp | 173 ----
src/VBox/Main/src-server/ApplianceImplImport.cpp | 321 -------
src/VBox/Main/src-server/MachineImpl.cpp | 53 +-
src/VBox/Main/src-server/VFSExplorerImpl.cpp | 140 ---
src/VBox/Runtime/Makefile.kmk | 6 -
src/VBox/Runtime/common/crypto/tsp-template.h | 6 +-
src/VBox/Runtime/common/crypto/x509-core.cpp | 3 +-
src/VBox/Runtime/common/ldr/ldrPE.cpp | 19 +-
src/VBox/Runtime/common/misc/s3.cpp | 998 ---------------------
src/VBox/Runtime/r3/xml.cpp | 18 +-
src/VBox/Runtime/testcase/Makefile.kmk | 4 -
src/VBox/Runtime/testcase/tstRTBitOperations.cpp | 13 +-
src/VBox/Runtime/testcase/tstRTS3.cpp | 236 -----
src/VBox/VMM/VMMR3/PDMDriver.cpp | 7 +-
src/libs/Makefile.kmk | 18 +-
src/libs/xpcom18a4/python/__init__.py | 0
src/libs/xpcom18a4/python/components.py | 0
src/libs/xpcom18a4/python/nsError.py | 0
src/libs/xpcom18a4/python/tools/tracer_demo.py | 0
86 files changed, 818 insertions(+), 2381 deletions(-)
diff --git a/Config.kmk b/Config.kmk
index c796a5d..d9376d6 100644
--- a/Config.kmk
+++ b/Config.kmk
@@ -194,7 +194,7 @@ VBOX_VERSION_MINOR = 1
# This is the current build number. It should be increased every time we publish a
# new build. The define is available in every source file. Only even build numbers
# will be published, odd numbers are set during development.
-VBOX_VERSION_BUILD = 40
+VBOX_VERSION_BUILD = 42
# The raw version string. This *must not* contain any other information/fields than
# major, minor and build revision (as it is now) -- also will be used for host/guest version
# comparison.
@@ -568,8 +568,6 @@ if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
endif
# Enable the VNC server in VBoxHeadless (GPL only).
#VBOX_WITH_VNC = 1
-# Enable S3 support (requires libcurl)
-VBOX_WITH_S3 = 1
## @}
@@ -2569,19 +2567,19 @@ VBOXLNX32GUEST_SUFF_LIB = .a
# SDKs for external libraries.
#
SDK_VBOX_LIBXML2 = .
-SDK_VBOX_LIBXML2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.6.31/include
+SDK_VBOX_LIBXML2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.9.2/include
SDK_VBOX_LIBXML2_DEFS ?= _REENTRANT
SDK_VBOX_LIBXML2_DEFS.win += WIN32 _WINDOWS _MBCS
# note: no linking to LIB here, we do that explicitly in src/VBox/Runtime/Makefile.kmk to link
# libxml against VBoxRT
SDK_VBOX_LIBPNG = .
-SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
+SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.53
SDK_VBOX_LIBPNG_LIBS ?= $(PATH_STAGE_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
SDK_VBOX_ZLIB = .
if1of ($(KBUILD_TARGET), os2 solaris win)
- SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.6
+ SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.8
SDK_VBOX_ZLIB_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
else
SDK_VBOX_ZLIB_INCS ?=
@@ -2614,14 +2612,6 @@ SDK_VBoxOpenSslExtPack_LIBS = \
$(PATH_STAGE_LIB)/VBoxExtPack-libssl$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VBoxExtPack-libcrypto$(VBOX_SUFF_LIB)
-ifdef VBOX_WITH_S3
-VBOX_WITH_LIBCURL = 1
-SDK_VBOX_LIBCURL = .
-SDK_VBOX_LIBCURL_INCS ?= $(PATH_ROOT)/src/libs/curl-7.19.4/include
-SDK_VBOX_LIBCURL_LIBS ?= $(PATH_STAGE_LIB)/VBox-libcurl$(VBOX_SUFF_LIB)
-SDK_VBOX_LIBCURL_DEFS ?= BUILDING_LIBCURL
-endif
-
SDK_VBOX_FFMPEG = .
if1of ($(KBUILD_TARGET), darwin linux os2 solaris win)
SDK_VBOX_FFMPEG_INCS ?= \
@@ -5194,7 +5184,7 @@ endif
SVN ?= svn$(HOSTSUFF_EXE)
VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
ifndef VBOX_SVN_REV
- VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 101594 $ )
+ VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 103435 $ )
VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
ifeq ($(which $(SVN)),)
VBOX_SVN_DEP :=
diff --git a/configure b/configure
index 9ca6906..8de5041 100755
--- a/configure
+++ b/configure
@@ -93,7 +93,6 @@ WITH_VNC=0
WITH_EXTPACK=1
WITH_DOCS=1
BUILD_LIBXML2=
-BUILD_LIBCURL=
BUILD_LIBSSL=
PASSIVE_MESA=0
CC="gcc"
@@ -129,15 +128,11 @@ INCVNCSERVER=""
LIBVNCSERVER="-lvncserver"
CXX_FLAGS=""
if [ "$OS" = "freebsd" ]; then
- INCCURL="-I/usr/local/include"
- LIBCURL="-L/usr/local/lib -lcurl"
INCPULSE="-I/usr/local/include"
LIBPULSE="-L/usr/local/lib"
INCPNG="-I/usr/local/include"
LIBPNG="-L/usr/local/lib -lpng"
else
- INCCURL=""
- LIBCURL="-lcurl"
INCPNG=""
LIBPNG="-lpng"
fi
@@ -919,38 +914,6 @@ EOF
fi
}
-#
-# Check for libcurl, needed by S3
-#
-check_curl()
-{
- if [ -z "$BUILD_LIBCURL" ]; then
- test_header libcurl
- cat > $ODIR.tmp_src.cc << EOF
-#include <cstdio>
-#include <curl/curl.h>
-extern "C" int main(void)
-{
- printf("found version %s", LIBCURL_VERSION);
-#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71601
- printf(", OK.\n");
- return 0;
-#else
- printf(", expected version 7.16.1 or higher\n");
- return 1;
-#endif
-}
-EOF
- [ -n "$INCCURL" ] && I_INCCURL=`prefix_I "$INCCURL"`
- if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl; then
- if test_execute; then
- cnf_append "SDK_VBOX_LIBCURL_LIBS" "`strip_l "$LIBCURL"`"
- cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
- fi
- fi
- fi
-}
-
#
# Check for pam, needed by VRDPAuth
@@ -2133,7 +2096,6 @@ cat << EOF
EOF
[ $OSE -eq 0 ] && cat << EOF
--build-libssl build openssl from sources
- --build-libcurl build libcurl from sources
EOF
[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
cat << EOF
@@ -2187,7 +2149,6 @@ if [ "$OS" = "darwin" ]; then
WITH_DBUS=0
WITH_KMODS=0
BUILD_LIBXML2=1
- [ $OSE -eq 1 ] || BUILD_LIBCURL=1
fi
# scan command line options
@@ -2323,9 +2284,6 @@ for option in $*; do
--build-libssl)
BUILD_LIBSSL=1
;;
- --build-libcurl)
- BUILD_LIBCURL=1
- ;;
--build-headless)
HEADLESS=1
WITH_SDL=0
@@ -2501,7 +2459,6 @@ check_gcc
check_libxml2
[ $WITH_LIBIDL -eq 1 ] && check_libidl
check_ssl
-check_curl
[ "$OS" != "darwin" ] && check_z
[ "$OS" != "darwin" ] && check_png
[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
diff --git a/configure.vbs b/configure.vbs
index 506ad42..37dd8e1 100644
--- a/configure.vbs
+++ b/configure.vbs
@@ -2072,68 +2072,6 @@ end function
''
-' Checks for libcurl
-sub CheckForCurl(strOptCurl)
- dim strPathCurl, str
- PrintHdr "libcurl"
-
- '
- ' Try find some cURL dll/lib.
- '
- strPathCurl = ""
- if (strPathCurl = "") And (strOptCurl <> "") then
- if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
- end if
-
- if strPathCurl = "" Then
- str = Which("libcurl.lib")
- if str <> "" Then
- str = PathParent(PathStripFilename(str))
- if CheckForCurlSub(str) then strPathCurl = str
- end if
- end if
-
- ' Ignore failure if we're in 'internal' mode.
- if (strPathCurl = "") and g_blnInternalMode then
- PrintResultMsg "curl", "ignored (internal mode)"
- exit sub
- end if
-
- ' Success?
- if strPathCurl = "" then
- if strOptCurl = "" then
- MsgError "Can't locate libcurl. Try specify the path with the --with-libcurl=<path> argument. " _
- & "If still no luck, consult the configure.log and the build requirements."
- else
- MsgError "Can't locate libcurl. Please consult the configure.log and the build requirements."
- end if
- exit sub
- end if
-
- strPathCurl = UnixSlashes(PathAbs(strPathCurl))
- CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
- CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
-
- PrintResult "libcurl", strPathCurl
-end sub
-
-''
-' Checks if the specified path points to an usable libcurl or not.
-function CheckForCurlSub(strPathCurl)
-
- CheckForCurlSub = False
- LogPrint "trying: strPathCurl=" & strPathCurl
- if LogFileExists(strPathCurl, "include/curl/curl.h") _
- And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
- And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
- then
- CheckForCurlSub = True
- end if
-end function
-
-
-
-''
''
' Checks for any Qt4 binaries.
sub CheckForQt4(strOptQt4)
@@ -2256,7 +2194,6 @@ sub usage
Print " --with-libxml2=PATH "
Print " --with-libxslt=PATH "
Print " --with-openssl=PATH "
- Print " --with-libcurl=PATH "
Print " --with-python=PATH "
end sub
@@ -2291,7 +2228,6 @@ Sub Main
strOptXml2 = ""
strOptXslt = ""
strOptSsl = ""
- strOptCurl = ""
strOptPython = ""
strOptMkisofs = ""
blnOptDisableCOM = False
@@ -2340,8 +2276,6 @@ Sub Main
strOptXslt = strPath
case "--with-openssl"
strOptSsl = strPath
- case "--with-libcurl"
- strOptCurl = strPath
case "--with-python"
strOptPython = strPath
case "--with-mkisofs"
@@ -2412,7 +2346,6 @@ Sub Main
CheckForXslt strOptXslt
end if
CheckForSsl strOptSsl
- CheckForCurl strOptCurl
CheckForQt4 strOptQt4
if (strOptPython <> "") then
CheckForPython strOptPython
diff --git a/doc/manual/en_US/user_GuestAdditions.xml b/doc/manual/en_US/user_GuestAdditions.xml
index 88a6703..e8d448f 100644
--- a/doc/manual/en_US/user_GuestAdditions.xml
+++ b/doc/manual/en_US/user_GuestAdditions.xml
@@ -1608,7 +1608,11 @@ Name: /VirtualBox/GuestInfo/OS/Version, value: #59-Ubuntu SMP Thu Jan 28 01:23:0
of fused pages, whereas the per-VM metric
<computeroutput>Guest/RAM/Usage/Shared</computeroutput> will return the
amount of fused memory for a given VM. Please refer to <xref
- linkend="metrics" /> for information on how to query metrics.</para>
+ linkend="metrics" /> for information on how to query metrics.</para>
+
+ <note><para>Enabling Page Fusion might indirectly increase the chances
+ for malicious guests to successfully attack other VMs running on the
+ same host, see <xref linkend="pot-insecure"/>.</para></note>
</sect2>
</sect1>
</chapter>
diff --git a/doc/manual/en_US/user_Security.xml b/doc/manual/en_US/user_Security.xml
index 08ee2be..d2a5072 100644
--- a/doc/manual/en_US/user_Security.xml
+++ b/doc/manual/en_US/user_Security.xml
@@ -319,7 +319,7 @@
</sect2>
-->
- <sect2>
+ <sect2 id="pot-insecure">
<title>Potentially insecure operations</title>
<para>The following features of VirtualBox can present security
@@ -342,6 +342,17 @@
</listitem>
<listitem>
+ <para>When Page Fusion (see <xref linkend="guestadd-pagefusion"/>)
+ is enabled, it is possible that a side-channel opens up that allows
+ a malicious guest to determin the address space layout (i.e. where
+ DLLs are typically loaded) of one other VM running on the same host.
+ This information leak in it self is harmless, however the malicious
+ guest may use it to optimize attack against that VM via unrelated
+ attack vectors. It is recommended to only enable Page Fusion if you
+ do not think this is a concern in your setup.</para>
+ </listitem>
+
+ <listitem>
<para>When using the VirtualBox web service to control a VirtualBox
host remotely, connections to the web service (through which the API
calls are transferred via SOAP XML) are not encrypted, but use plain
diff --git a/doc/manual/user_ChangeLogImpl.xml b/doc/manual/user_ChangeLogImpl.xml
index 8423dd7..14d445a 100644
--- a/doc/manual/user_ChangeLogImpl.xml
+++ b/doc/manual/user_ChangeLogImpl.xml
@@ -1,6 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<sect1>
+ <title>Version 4.1.42 (2015-10-20)</title>
+
+ <para>This is a maintenance release. The following items were fixed and/or
+ added:</para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>several fixes</para>
+ </listitem>
+
+ <listitem>
+ <para>Windows hosts: hardening fixes</para>
+ </listitem>
+
+ </itemizedlist>
+
+ </sect1>
+
+ <sect1>
<title>Version 4.1.40 (2015-07-09)</title>
<para>This is a maintenance release. The following items were fixed and/or
diff --git a/include/VBox/err.h b/include/VBox/err.h
index 9bf6a2e..b3a5f5a 100644
--- a/include/VBox/err.h
+++ b/include/VBox/err.h
@@ -1614,6 +1614,10 @@
#define VERR_SUPDRV_CSRSS_NOT_FOUND (-3741)
/** Type error opening the ApiPort LPC object. */
#define VERR_SUPDRV_APIPORT_OPEN_ERROR_TYPE (-3742)
+/** The process trying to open VBoxDrv is not a budding VM process (1). */
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_1 (-3748)
+/** The process trying to open VBoxDrv is not a budding VM process (2). */
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_2 (-3748)
/** @} */
diff --git a/include/iprt/asm.h b/include/iprt/asm.h
index 16c3c51..0b79486 100644
--- a/include/iprt/asm.h
+++ b/include/iprt/asm.h
@@ -4118,7 +4118,7 @@ DECLINLINE(void) ASMBitSetRange(volatile void *pvBitmap, int32_t iBitStart, int3
int iStart = iBitStart & ~31;
int iEnd = iBitEnd & ~31;
if (iStart == iEnd)
- *pu32 |= ((1 << (iBitEnd - iBitStart)) - 1) << iBitStart;
+ *pu32 |= ((1 << (iBitEnd - iBitStart)) - 1) << (iBitStart & 31);
else
{
/* bits in first dword. */
diff --git a/include/iprt/crypto/digest.h b/include/iprt/crypto/digest.h
index 374196b..9b70f57 100644
--- a/include/iprt/crypto/digest.h
+++ b/include/iprt/crypto/digest.h
@@ -145,7 +145,7 @@ typedef RTCRDIGESTDESC const *PCRTCRDIGESTDESC;
* RTCrDigestCreate. This is optional, fewer
* algortihms are available if not specified.
*/
-RTDECL(PCRTCRDIGESTDESC) RTCrDigestFindByObjIdString(const char *pszObjId, void *ppvOpaque);
+RTDECL(PCRTCRDIGESTDESC) RTCrDigestFindByObjIdString(const char *pszObjId, void **ppvOpaque);
/**
* Finds a cryptographic hash / message digest descriptor by object identifier
@@ -159,7 +159,7 @@ RTDECL(PCRTCRDIGESTDESC) RTCrDigestFindByObjIdString(const char *pszObjId, void
* RTCrDigestCreate. This is optional, fewer
* algortihms are available if not specified.
*/
-RTDECL(PCRTCRDIGESTDESC) RTCrDigestFindByObjId(PCRTASN1OBJID pObjId, void *ppvOpaque);
+RTDECL(PCRTCRDIGESTDESC) RTCrDigestFindByObjId(PCRTASN1OBJID pObjId, void **ppvOpaque);
RTDECL(PCRTCRDIGESTDESC) RTCrDigestFindByType(RTDIGESTTYPE enmDigestType);
RTDECL(int) RTCrDigestCreateByObjIdString(PRTCRDIGEST phDigest, const char *pszObjId);
diff --git a/src/VBox/Additions/common/crOpenGL/DD_glc.py b/src/VBox/Additions/common/crOpenGL/DD_glc.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/DD_glh.py b/src/VBox/Additions/common/crOpenGL/DD_glh.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/NULLfuncs.py b/src/VBox/Additions/common/crOpenGL/NULLfuncs.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/cr_gl.py b/src/VBox/Additions/common/crOpenGL/cr_gl.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/entrypoints.py b/src/VBox/Additions/common/crOpenGL/entrypoints.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback.py b/src/VBox/Additions/common/crOpenGL/feedback/feedback.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_funcs.py b/src/VBox/Additions/common/crOpenGL/feedback/feedback_funcs.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py b/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_proto.py b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_proto.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/getprocaddress.py b/src/VBox/Additions/common/crOpenGL/getprocaddress.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/pack/pack.py b/src/VBox/Additions/common/crOpenGL/pack/pack.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py b/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py b/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_proto.py b/src/VBox/Additions/common/crOpenGL/pack/packspu_proto.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/passthrough/passthrough.py b/src/VBox/Additions/common/crOpenGL/passthrough/passthrough.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/tsfuncs.py b/src/VBox/Additions/common/crOpenGL/tsfuncs.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py b/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd
index b90763d..85d9353 100644
Binary files a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd and b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd differ
diff --git a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd
index 561861c..b7e85a0 100644
Binary files a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd and b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd differ
diff --git a/src/VBox/Devices/Storage/DevATA.cpp b/src/VBox/Devices/Storage/DevATA.cpp
index c94b9a4..a9e9eb6 100644
--- a/src/VBox/Devices/Storage/DevATA.cpp
+++ b/src/VBox/Devices/Storage/DevATA.cpp
@@ -4533,60 +4533,128 @@ DECLINLINE(void) ataPIOTransferFinish(PATACONTROLLER pCtl, ATADevState *s)
#endif /* IN_RING3 */
-static int ataDataWrite(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, const uint8_t *pbBuf)
+/**
+ * Fallback for ataCopyPioData124 that handles unaligned and out of bounds cases.
+ *
+ * @param pIf The device interface to work with.
+ * @param pbDst The destination buffer.
+ * @param pbSrc The source buffer.
+ * @param cbCopy The number of bytes to copy, either 1, 2 or 4 bytes.
+ */
+DECL_NO_INLINE(static, void) ataCopyPioData124Slow(ATADevState *pIf, uint8_t *pbDst, const uint8_t *pbSrc, uint32_t cbCopy)
+{
+ uint32_t const offStart = pIf->iIOBufferPIODataStart;
+ uint32_t const offNext = offStart + cbCopy;
+
+ if (offStart + cbCopy > pIf->cbIOBuffer)
+ {
+ Log(("%s: cbCopy=%#x offStart=%#x cbIOBuffer=%#x offNext=%#x (iIOBufferPIODataEnd=%#x)\n",
+ __FUNCTION__, cbCopy, offStart, pIf->cbIOBuffer, offNext, pIf->iIOBufferPIODataEnd));
+ if (offStart < pIf->cbIOBuffer)
+ cbCopy = pIf->cbIOBuffer - offStart;
+ else
+ cbCopy = 0;
+ }
+
+ switch (cbCopy)
+ {
+ case 4: pbDst[3] = pbSrc[3]; /* fall thru */
+ case 3: pbDst[2] = pbSrc[2]; /* fall thru */
+ case 2: pbDst[1] = pbSrc[1]; /* fall thru */
+ case 1: pbDst[0] = pbSrc[0]; /* fall thru */
+ case 0: break;
+ default: AssertFailed(); /* impossible */
+ }
+
+ pIf->iIOBufferPIODataStart = offNext;
+
+}
+
+
+/**
+ * Work for ataDataWrite & ataDataRead that copies data without using memcpy.
+ *
+ * This also updates pIf->iIOBufferPIODataStart.
+ *
+ * The two buffers are either stack (32-bit aligned) or somewhere within
+ * pIf->pbIOBuffer.
+ *
+ * @param pIf The device interface to work with.
+ * @param pbDst The destination buffer.
+ * @param pbSrc The source buffer.
+ * @param cbCopy The number of bytes to copy, either 1, 2 or 4 bytes.
+ */
+DECLINLINE(void) ataCopyPioData124(ATADevState *pIf, uint8_t *pbDst, const uint8_t *pbSrc, uint32_t cbCopy)
+{
+ /*
+ * Quick bounds checking can be done by checking that the pbIOBuffer offset
+ * (iIOBufferPIODataStart) is aligned at the transfer size (which is ASSUMED
+ * to be 1, 2 or 4). However, since we're paranoid and don't currently
+ * trust iIOBufferPIODataEnd to be within bounds, we current check against the
+ * IO buffer size too.
+ */
+ Assert(cbCopy == 1 || cbCopy == 2 || cbCopy == 4);
+ uint32_t const offStart = pIf->iIOBufferPIODataStart;
+ if (RT_LIKELY( !(offStart & (cbCopy - 1))
+ && offStart + cbCopy <= pIf->cbIOBuffer))
+ {
+ switch (cbCopy)
+ {
+ case 4: *(uint32_t *)pbDst = *(uint32_t const *)pbSrc; break;
+ case 2: *(uint16_t *)pbDst = *(uint16_t const *)pbSrc; break;
+ case 1: *pbDst = *pbSrc; break;
+ }
+ pIf->iIOBufferPIODataStart = offStart + cbCopy;
+ }
+ else
+ ataCopyPioData124Slow(pIf, pbDst, pbSrc, cbCopy);
+}
+
+static int ataDataWrite(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, const uint8_t *pbSrc)
{
ATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf];
- uint8_t *p;
if (s->iIOBufferPIODataStart < s->iIOBufferPIODataEnd)
{
+ uint8_t *pbDst = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
+
Assert(s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE);
- p = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
#ifndef IN_RING3
/* All but the last transfer unit is simple enough for GC, but
* sending a request to the async IO thread is too complicated. */
if (s->iIOBufferPIODataStart + cbSize < s->iIOBufferPIODataEnd)
- {
- memcpy(p, pbBuf, cbSize);
- s->iIOBufferPIODataStart += cbSize;
- }
+ ataCopyPioData124(s, pbDst, pbSrc, cbSize);
else
return VINF_IOM_HC_IOPORT_WRITE;
#else /* IN_RING3 */
- memcpy(p, pbBuf, cbSize);
- s->iIOBufferPIODataStart += cbSize;
+ ataCopyPioData124(s, pbDst, pbSrc, cbSize);
if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd)
ataPIOTransferFinish(pCtl, s);
#endif /* !IN_RING3 */
}
else
Log2(("%s: DUMMY data\n", __FUNCTION__));
- Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbBuf));
+ Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbSrc));
return VINF_SUCCESS;
}
-static int ataDataRead(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, uint8_t *pbBuf)
+static int ataDataRead(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, uint8_t *pbDst)
{
ATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf];
- uint8_t *p;
if (s->iIOBufferPIODataStart < s->iIOBufferPIODataEnd)
{
Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
- p = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
+ uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
#ifndef IN_RING3
/* All but the last transfer unit is simple enough for GC, but
* sending a request to the async IO thread is too complicated. */
if (s->iIOBufferPIODataStart + cbSize < s->iIOBufferPIODataEnd)
- {
- memcpy(pbBuf, p, cbSize);
- s->iIOBufferPIODataStart += cbSize;
- }
+ ataCopyPioData124(s, pbDst, pbSrc, cbSize);
else
return VINF_IOM_HC_IOPORT_READ;
#else /* IN_RING3 */
- memcpy(pbBuf, p, cbSize);
- s->iIOBufferPIODataStart += cbSize;
+ ataCopyPioData124(s, pbDst, pbSrc, cbSize);
if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd)
ataPIOTransferFinish(pCtl, s);
#endif /* !IN_RING3 */
@@ -4594,9 +4662,9 @@ static int ataDataRead(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, uint
else
{
Log2(("%s: DUMMY data\n", __FUNCTION__));
- memset(pbBuf, '\xff', cbSize);
+ memset(pbDst, '\xff', cbSize);
}
- Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbBuf));
+ Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbDst));
return VINF_SUCCESS;
}
diff --git a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
index b3df2e8..2940429 100644
--- a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
+++ b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -142,17 +142,19 @@ private:
};
/**
- * Handler for global events.
+ * Handler for machine events.
*/
-class VirtualBoxEventListener
+class ConsoleEventListener
{
public:
- VirtualBoxEventListener()
+ ConsoleEventListener() :
+ mLastVRDEPort(-1),
+ m_fIgnorePowerOffEvents(false),
+ m_fNoLoggedInUsers(true)
{
- mfNoLoggedInUsers = true;
}
- virtual ~VirtualBoxEventListener()
+ virtual ~ConsoleEventListener()
{
}
@@ -169,6 +171,87 @@ public:
{
switch (aType)
{
+ case VBoxEventType_OnMouseCapabilityChanged:
+ {
+
+ ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
+ Assert(!mccev.isNull());
+
+ BOOL fSupportsAbsolute = false;
+ mccev->COMGETTER(SupportsAbsolute)(&fSupportsAbsolute);
+
+ /* Emit absolute mouse event to actually enable the host mouse cursor. */
+ if (fSupportsAbsolute && gConsole)
+ {
+ ComPtr<IMouse> mouse;
+ gConsole->COMGETTER(Mouse)(mouse.asOutParam());
+ if (mouse)
+ {
+ mouse->PutMouseEventAbsolute(-1, -1, 0, 0 /* Horizontal wheel */, 0);
+ }
+ }
+ break;
+ }
+ case VBoxEventType_OnStateChanged:
+ {
+ ComPtr<IStateChangedEvent> scev = aEvent;
+ Assert(scev);
+
+ MachineState_T machineState;
+ scev->COMGETTER(State)(&machineState);
+
+ /* Terminate any event wait operation if the machine has been
+ * PoweredDown/Saved/Aborted. */
+ if (machineState < MachineState_Running && !m_fIgnorePowerOffEvents)
+ {
+ g_fTerminateFE = true;
+ gEventQ->interruptEventQueueProcessing();
+ }
+
+ break;
+ }
+ case VBoxEventType_OnVRDEServerInfoChanged:
+ {
+ ComPtr<IVRDEServerInfoChangedEvent> rdicev = aEvent;
+ Assert(rdicev);
+
+ if (gConsole)
+ {
+ ComPtr<IVRDEServerInfo> info;
+ gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
+ if (info)
+ {
+ LONG port;
+ info->COMGETTER(Port)(&port);
+ if (port != mLastVRDEPort)
+ {
+ if (port == -1)
+ RTPrintf("VRDE server is inactive.\n");
+ else if (port == 0)
+ RTPrintf("VRDE server failed to start.\n");
+ else
+ RTPrintf("VRDE server is listening on port %d.\n", port);
+
+ mLastVRDEPort = port;
+ }
+ }
+ }
+ break;
+ }
+ case VBoxEventType_OnCanShowWindow:
+ {
+ ComPtr<ICanShowWindowEvent> cswev = aEvent;
+ Assert(cswev);
+ cswev->AddVeto(NULL);
+ break;
+ }
+ case VBoxEventType_OnShowWindow:
+ {
+ ComPtr<IShowWindowEvent> swev = aEvent;
+ Assert(swev);
+ swev->COMSETTER(WinId)(0);
+ break;
+ }
case VBoxEventType_OnGuestPropertyChanged:
{
ComPtr<IGuestPropertyChangedEvent> pChangedEvent = aEvent;
@@ -180,16 +263,8 @@ public:
if (gConsole)
{
hrc = gConsole->COMGETTER(Machine)(pMachine.asOutParam());
- if (SUCCEEDED(hrc) && pMachine)
- {
- Bstr gpMachineId, machineId;
- hrc = pMachine->COMGETTER(Id)(gpMachineId.asOutParam());
- AssertComRC(hrc);
- hrc = pChangedEvent->COMGETTER(MachineId)(machineId.asOutParam());
- AssertComRC(hrc);
- if (gpMachineId != machineId)
- hrc = VBOX_E_OBJECT_NOT_FOUND;
- }
+ if (FAILED(hrc) || !pMachine)
+ hrc = VBOX_E_OBJECT_NOT_FOUND;
}
else
hrc = VBOX_E_INVALID_VM_STATE;
@@ -230,32 +305,32 @@ public:
LogRelFlow(("VRDE: hrc=%Rhrc: Host %s disconnecting clients (current host state known: %s)\n",
hrc, fProcessDisconnectOnGuestLogout ? "will handle" : "does not handle",
- mfNoLoggedInUsers ? "No users logged in" : "Users logged in"));
+ m_fNoLoggedInUsers ? "No users logged in" : "Users logged in"));
if (fProcessDisconnectOnGuestLogout)
{
bool fDropConnection = false;
- if (!mfNoLoggedInUsers) /* Only if the property really changes. */
+ if (!m_fNoLoggedInUsers) /* Only if the property really changes. */
{
if ( utf8Value == "true"
/* Guest property got deleted due to reset,
* so it has no value anymore. */
|| utf8Value.isEmpty())
{
- mfNoLoggedInUsers = true;
+ m_fNoLoggedInUsers = true;
fDropConnection = true;
}
}
else if (utf8Value == "false")
- mfNoLoggedInUsers = false;
+ m_fNoLoggedInUsers = false;
/* Guest property got deleted due to reset,
- * take the shortcut without touching the mfNoLoggedInUsers
+ * take the shortcut without touching the m_fNoLoggedInUsers
* state. */
else if (utf8Value.isEmpty())
fDropConnection = true;
- LogRelFlow(("VRDE: szNoLoggedInUsers=%s, mfNoLoggedInUsers=%RTbool, fDropConnection=%RTbool\n",
- utf8Value.c_str(), mfNoLoggedInUsers, fDropConnection));
+ LogRelFlow(("VRDE: szNoLoggedInUsers=%s, m_fNoLoggedInUsers=%RTbool, fDropConnection=%RTbool\n",
+ utf8Value.c_str(), m_fNoLoggedInUsers, fDropConnection));
if (fDropConnection)
{
@@ -297,132 +372,6 @@ public:
default:
AssertFailed();
}
-
- return S_OK;
- }
-
-private:
-
- bool mfNoLoggedInUsers;
-};
-
-/**
- * Handler for machine events.
- */
-class ConsoleEventListener
-{
-public:
- ConsoleEventListener() :
- mLastVRDEPort(-1),
- m_fIgnorePowerOffEvents(false)
- {
- }
-
- virtual ~ConsoleEventListener()
- {
- }
-
- HRESULT init()
- {
- return S_OK;
- }
-
- void uninit()
- {
- }
-
- STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent)
- {
- switch (aType)
- {
- case VBoxEventType_OnMouseCapabilityChanged:
- {
-
- ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
- Assert(mccev);
-
- BOOL fSupportsAbsolute = false;
- mccev->COMGETTER(SupportsAbsolute)(&fSupportsAbsolute);
-
- /* Emit absolute mouse event to actually enable the host mouse cursor. */
- if (fSupportsAbsolute && gConsole)
- {
- ComPtr<IMouse> mouse;
- gConsole->COMGETTER(Mouse)(mouse.asOutParam());
- if (mouse)
- {
- mouse->PutMouseEventAbsolute(-1, -1, 0, 0 /* Horizontal wheel */, 0);
- }
- }
-#ifdef VBOX_WITH_VNC
- if (g_pFramebufferVNC)
- g_pFramebufferVNC->enableAbsMouse(fSupportsAbsolute);
-#endif
- break;
- }
- case VBoxEventType_OnStateChanged:
- {
- ComPtr<IStateChangedEvent> scev = aEvent;
- Assert(scev);
-
- MachineState_T machineState;
- scev->COMGETTER(State)(&machineState);
-
- /* Terminate any event wait operation if the machine has been
- * PoweredDown/Saved/Aborted. */
- if (machineState < MachineState_Running && !m_fIgnorePowerOffEvents)
- {
- g_fTerminateFE = true;
- gEventQ->interruptEventQueueProcessing();
- }
-
- break;
- }
- case VBoxEventType_OnVRDEServerInfoChanged:
- {
- ComPtr<IVRDEServerInfoChangedEvent> rdicev = aEvent;
- Assert(rdicev);
-
- if (gConsole)
- {
- ComPtr<IVRDEServerInfo> info;
- gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
- if (info)
- {
- LONG port;
- info->COMGETTER(Port)(&port);
- if (port != mLastVRDEPort)
- {
- if (port == -1)
- RTPrintf("VRDE server is inactive.\n");
- else if (port == 0)
- RTPrintf("VRDE server failed to start.\n");
- else
- RTPrintf("VRDE server is listening on port %d.\n", port);
-
- mLastVRDEPort = port;
- }
- }
- }
- break;
- }
- case VBoxEventType_OnCanShowWindow:
- {
- ComPtr<ICanShowWindowEvent> cswev = aEvent;
- Assert(cswev);
- cswev->AddVeto(NULL);
- break;
- }
- case VBoxEventType_OnShowWindow:
- {
- ComPtr<IShowWindowEvent> swev = aEvent;
- Assert(swev);
- swev->COMSETTER(WinId)(0);
- break;
- }
- default:
- AssertFailed();
- }
return S_OK;
}
@@ -435,14 +384,13 @@ private:
long mLastVRDEPort;
bool m_fIgnorePowerOffEvents;
+ bool m_fNoLoggedInUsers;
};
typedef ListenerImpl<VirtualBoxClientEventListener> VirtualBoxClientEventListenerImpl;
-typedef ListenerImpl<VirtualBoxEventListener> VirtualBoxEventListenerImpl;
typedef ListenerImpl<ConsoleEventListener> ConsoleEventListenerImpl;
VBOX_LISTENER_DECLARE(VirtualBoxClientEventListenerImpl)
-VBOX_LISTENER_DECLARE(VirtualBoxEventListenerImpl)
VBOX_LISTENER_DECLARE(ConsoleEventListenerImpl)
#ifdef VBOX_WITH_SAVESTATE_ON_SIGNAL
@@ -1107,6 +1055,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
eventTypes.push_back(VBoxEventType_OnVRDEServerInfoChanged);
eventTypes.push_back(VBoxEventType_OnCanShowWindow);
eventTypes.push_back(VBoxEventType_OnShowWindow);
+ eventTypes.push_back(VBoxEventType_OnGuestPropertyChanged);
CHECK_ERROR(es, RegisterListener(consoleListener, ComSafeArrayAsInParam(eventTypes), true));
}
@@ -1254,26 +1203,6 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
}
}
- /* VirtualBox events registration. */
- {
- ComPtr<IEventSource> es;
- CHECK_ERROR(virtualBox, COMGETTER(EventSource)(es.asOutParam()));
- ComObjPtr<VirtualBoxEventListenerImpl> listener;
- listener.createObject();
- listener->init(new VirtualBoxEventListener());
- vboxListener = listener;
- com::SafeArray<VBoxEventType_T> eventTypes;
- eventTypes.push_back(VBoxEventType_OnGuestPropertyChanged);
-
- /**
- * @todo Set the notification pattern to "/VirtualBox/GuestInfo/OS/ *Logged*"
- * to not cause too much load. The current API is broken as
- * IMachine::GuestPropertyNotificationPatterns() would change the
- * filter for _all_ clients. This is not what we want!
- */
- CHECK_ERROR(es, RegisterListener(vboxListener, ComSafeArrayAsInParam(eventTypes), true));
- }
-
#ifdef VBOX_WITH_SAVESTATE_ON_SIGNAL
signal(SIGINT, SaveState);
signal(SIGTERM, SaveState);
diff --git a/src/VBox/Frontends/VirtualBox/src/main.cpp b/src/VBox/Frontends/VirtualBox/src/main.cpp
index 8b1067b..2868c9a 100644
--- a/src/VBox/Frontends/VirtualBox/src/main.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/main.cpp
@@ -48,6 +48,7 @@
#endif
#include <iprt/buildconfig.h>
+#include <iprt/ctype.h>
#include <iprt/err.h>
#include <iprt/initterm.h>
#include <iprt/process.h>
@@ -664,35 +665,69 @@ int main (int argc, char **argv, char **envp)
#else /* VBOX_WITH_HARDENING */
/**
- * Hardened main failed, report the error without any unnecessary fuzz.
+ * Special entrypoint used by the hardening code when something goes south.
*
- * @remarks Do not call IPRT here unless really required, it might not be
- * initialized.
+ * Display an error dialog to the user.
+ *
+ * @param pszWhere Indicates where the error occured.
+ * @param enmWhat Indicates what init operation was going on at the time.
+ * @param rc The VBox status code corresponding to the error.
+ * @param pszMsgFmt The message format string.
+ * @param va Format arguments.
*/
extern "C" DECLEXPORT(void) TrustedError(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va)
{
# if defined(RT_OS_DARWIN)
ShutUpAppKit();
# endif
+ char szMsgBuf[_16K];
/*
- * Init the Qt application object. This is a bit hackish as we
- * don't have the argument vector handy.
+ * We have to create QApplication anyway just to show the only one error-message.
+ * This is a bit hackish as we don't have the argument vector handy.
*/
int argc = 0;
char *argv[2] = { NULL, NULL };
QApplication a (argc, &argv[0]);
/*
- * Compose and show the error message.
+ * The details starts off a properly formatted rc and where/what, we use
+ * the szMsgBuf for this, thus this have to come before the actual message
+ * formatting.
*/
- QString msgTitle = QApplication::tr ("VirtualBox - Error In %1").arg (pszWhere);
+ RTStrPrintf(szMsgBuf, sizeof(szMsgBuf),
+ "<!--EOM-->"
+ "where: %s\n"
+ "what: %d\n"
+ "%Rra\n",
+ pszWhere, enmWhat, rc);
+ QString strDetails = szMsgBuf;
- char szMsgBuf[1024];
+ /*
+ * Format the error message. Take whatever comes after a double new line as
+ * something better off in the details section.
+ */
RTStrPrintfV(szMsgBuf, sizeof(szMsgBuf), pszMsgFmt, va);
+
+ char *pszDetails = strstr(szMsgBuf, "\n\n");
+ if (pszDetails)
+ {
+ while (RT_C_IS_SPACE(*pszDetails))
+ *pszDetails++ = '\0';
+ if (*pszDetails)
+ {
+ strDetails += "\n";
+ strDetails += pszDetails;
+ }
+ RTStrStripR(szMsgBuf);
+ }
+
QString strText = QApplication::tr("<html><b>%1 (rc=%2)</b><br/><br/>").arg(szMsgBuf).arg(rc);
strText.replace(QString("\n"), QString("<br>"));
+ /*
+ * Append possibly helpful hints to the error message.
+ */
switch (enmWhat)
{
case kSupInitOp_Driver:
@@ -729,17 +764,28 @@ extern "C" DECLEXPORT(void) TrustedError(const char *pszWhere, SUPINITOP enmWhat
strText += "</html>";
+
# ifdef RT_OS_LINUX
+ /*
+ * We have to to make sure that we display the error-message
+ * after the parent displayed its own message.
+ */
sleep(2);
# endif
- QMessageBox::critical (
- 0, /* parent */
- msgTitle, /* title */
- strText, /* text */
- QMessageBox::Abort, /* button0 */
- 0); /* button1 */
- qFatal ("%s", strText.toAscii().constData());
+
+ /*
+ * Create the message box and show it.
+ */
+ QString strTitle = QApplication::tr("VirtualBox - Error In %1").arg(pszWhere);
+ QIMessageBox msgBox(strTitle, strText, QIMessageBox::Critical, QIMessageBox::Ok | QIMessageBox::Default);
+ if (!strDetails.isEmpty())
+ msgBox.setDetailsText(strDetails);
+
+ msgBox.exec();
+
+ qFatal("%s", strText.toAscii().constData());
}
#endif /* VBOX_WITH_HARDENING */
+
diff --git a/src/VBox/GuestHost/OpenGL/error/error.py b/src/VBox/GuestHost/OpenGL/error/error.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py b/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py
old mode 100644
new mode 100755
diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_header.py b/src/VBox/GuestHost/OpenGL/packer/pack_header.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py b/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/dispatch.py b/src/VBox/GuestHost/OpenGL/spu_loader/dispatch.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py b/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/glloader.py b/src/VBox/GuestHost/OpenGL/spu_loader/glloader.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py b/src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py b/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_defs.py b/src/VBox/GuestHost/OpenGL/state_tracker/state_defs.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py b/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py b/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py b/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py
old mode 100755
new mode 100644
diff --git a/src/VBox/GuestHost/OpenGL/util/debug_opcodes.py b/src/VBox/GuestHost/OpenGL/util/debug_opcodes.py
old mode 100755
new mode 100644
diff --git a/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp b/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
index 514e25f..4ab9280 100644
--- a/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
+++ b/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
@@ -966,7 +966,7 @@ extern "C" uint32_t g_uNtVerCombined;
DECLHIDDEN(void) supR3HardenedOpenLog(int *pcArgs, char **papszArgs)
{
- static const char s_szLogOption[] = "--sup-startup-log=";
+ static const char s_szLogOption[] = "--sup-hardening-log=";
/*
* Scan the argument vector.
diff --git a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
index fc6d3ad..66e8d97 100644
--- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -1,4 +1,4 @@
-/* $Rev: 95893 $ */
+/* $Rev: 103362 $ */
/** @file
* VBoxDrv - The VirtualBox Support Driver - Linux specifics.
*/
@@ -84,6 +84,10 @@
# error "CONFIG_X86_HIGH_ENTRY is not supported by VBoxDrv at this time."
#endif
+#ifdef CONFIG_X86_SMAP
+# error "CONFIG_X86_SMAP is only supported by 4.3 and higher. Please upgrade VirtualBox."
+#endif
+
/* to include the version number of VirtualBox into kernel backtraces */
#define VBoxDrvLinuxVersion RT_CONCAT3(RT_CONCAT(VBOX_VERSION_MAJOR, _), \
RT_CONCAT(VBOX_VERSION_MINOR, _), \
diff --git a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
index 4b6ff38..2d9b7d1 100644
--- a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
@@ -165,7 +165,7 @@ typedef struct SUPDRVNTERRORINFO
/** Number of bytes of valid info. */
uint32_t cchErrorInfo;
/** The error info. */
- char szErrorInfo[2048];
+ char szErrorInfo[16384 - sizeof(RTLISTNODE) - sizeof(HANDLE)*2 - sizeof(uint64_t) - sizeof(uint32_t) - 0x20];
} SUPDRVNTERRORINFO;
/** Pointer to error info. */
typedef SUPDRVNTERRORINFO *PSUPDRVNTERRORINFO;
@@ -216,6 +216,8 @@ typedef struct SUPDRVNTPROTECT
uint32_t volatile cRefs;
/** The kind of process we're protecting. */
SUPDRVNTPROTECTKIND volatile enmProcessKind;
+ /** Whether this structure is in the tree. */
+ bool fInTree : 1;
/** 7,: Hack to allow the supid themes service duplicate handle privileges to
* our process. */
bool fThemesFirstProcessCreateHandle : 1;
@@ -857,14 +859,14 @@ NTSTATUS _stdcall VBoxDrvNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp)
{
LogRel(("vboxdrv: %p is not a budding VM process (enmProcessKind=%d).\n",
PsGetProcessId(PsGetCurrentProcess()), pNtProtect->enmProcessKind));
- rc = VERR_ACCESS_DENIED;
+ rc = VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_2;
}
supdrvNtProtectRelease(pNtProtect);
}
else
{
LogRel(("vboxdrv: %p is not a budding VM process.\n", PsGetProcessId(PsGetCurrentProcess())));
- rc = VERR_ACCESS_DENIED;
+ rc = VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_1;
}
}
/*
@@ -1499,7 +1501,7 @@ NTSTATUS _stdcall VBoxDrvNtRead(PDEVICE_OBJECT pDevObj, PIRP pIrp)
/*
* Did we find error info and is the caller requesting data within it?
- * If so, cehck the destination buffer and copy the data into it.
+ * If so, check the destination buffer and copy the data into it.
*/
if ( pCur
&& pStack->Parameters.Read.ByteOffset.QuadPart < pCur->cchErrorInfo
@@ -1509,12 +1511,11 @@ NTSTATUS _stdcall VBoxDrvNtRead(PDEVICE_OBJECT pDevObj, PIRP pIrp)
if (pvDstBuf)
{
uint32_t offRead = (uint32_t)pStack->Parameters.Read.ByteOffset.QuadPart;
- uint32_t cbToRead = pCur->cchErrorInfo - (uint32_t)offRead;
- if (cbToRead > pStack->Parameters.Read.Length)
- {
- cbToRead = pStack->Parameters.Read.Length;
+ uint32_t cbToRead = pCur->cchErrorInfo - offRead;
+ if (cbToRead < pStack->Parameters.Read.Length)
RT_BZERO((uint8_t *)pvDstBuf + cbToRead, pStack->Parameters.Read.Length - cbToRead);
- }
+ else
+ cbToRead = pStack->Parameters.Read.Length;
memcpy(pvDstBuf, &pCur->szErrorInfo[offRead], cbToRead);
pIrp->IoStatus.Information = cbToRead;
@@ -1542,6 +1543,15 @@ NTSTATUS _stdcall VBoxDrvNtRead(PDEVICE_OBJECT pDevObj, PIRP pIrp)
}
else
rcNt = STATUS_UNSUCCESSFUL;
+
+ /* Paranoia: Clear the buffer on failure. */
+ if (!NT_SUCCESS(rcNt))
+ {
+ PVOID pvDstBuf = pIrp->AssociatedIrp.SystemBuffer;
+ if ( pvDstBuf
+ && pStack->Parameters.Read.Length)
+ RT_BZERO(pvDstBuf, pStack->Parameters.Read.Length);
+ }
}
else
rcNt = STATUS_INVALID_PARAMETER;
@@ -1867,25 +1877,44 @@ int VBOXCALL supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, c
return VINF_SUCCESS;
/*
- * However, on Windows Server 2003 (sp2 x86) both import thunk tables
- * are fixed up and we typically get a mismatch in the INIT section.
+ * On Windows 10 the ImageBase member of the optional header is sometimes
+ * updated with the actual load address and sometimes not. Try compare
+ *
+ */
+ uint32_t const offNtHdrs = *(uint16_t *)pbImageBits == IMAGE_DOS_SIGNATURE
+ ? ((IMAGE_DOS_HEADER const *)pbImageBits)->e_lfanew
+ : 0;
+ AssertLogRelReturn(offNtHdrs + sizeof(IMAGE_NT_HEADERS) < pImage->cbImageBits, VERR_INTERNAL_ERROR_5);
+ IMAGE_NT_HEADERS const *pNtHdrsIprt = (IMAGE_NT_HEADERS const *)(pbImageBits + offNtHdrs);
+ IMAGE_NT_HEADERS const *pNtHdrsNtLd = (IMAGE_NT_HEADERS const *)((uintptr_t)pImage->pvImage + offNtHdrs);
+
+ uint32_t const offImageBase = offNtHdrs + RT_OFFSETOF(IMAGE_NT_HEADERS, OptionalHeader.ImageBase);
+ uint32_t const cbImageBase = RT_SIZEOFMEMB(IMAGE_NT_HEADERS, OptionalHeader.ImageBase);
+ if ( pNtHdrsNtLd->OptionalHeader.ImageBase != pNtHdrsIprt->OptionalHeader.ImageBase
+ && ( pNtHdrsNtLd->OptionalHeader.ImageBase == (uintptr_t)pImage->pvImage
+ || pNtHdrsIprt->OptionalHeader.ImageBase == (uintptr_t)pImage->pvImage)
+ && pNtHdrsIprt->Signature == IMAGE_NT_SIGNATURE
+ && pNtHdrsIprt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR_MAGIC
+ && !memcmp(pImage->pvImage, pbImageBits, offImageBase)
+ && !memcmp((uint8_t const *)pImage->pvImage + offImageBase + cbImageBase,
+ pbImageBits + offImageBase + cbImageBase,
+ pImage->cbImageBits - offImageBase - cbImageBase))
+ return VINF_SUCCESS;
+
+ /*
+ * On Windows Server 2003 (sp2 x86) both import thunk tables are fixed
+ * up and we typically get a mismatch in the INIT section.
*
* So, lets see if everything matches when excluding the
- * OriginalFirstThunk tables. To make life simpler, set the max number
- * of imports to 16 and just record and sort the locations that needs
- * to be excluded from the comparison.
+ * OriginalFirstThunk tables and (maybe) the ImageBase member.
+ * For simplicity the max number of exclusion regions is set to 16.
*/
- IMAGE_NT_HEADERS const *pNtHdrs;
- pNtHdrs = (IMAGE_NT_HEADERS const *)(pbImageBits
- + ( *(uint16_t *)pbImageBits == IMAGE_DOS_SIGNATURE
- ? ((IMAGE_DOS_HEADER const *)pbImageBits)->e_lfanew
- : 0));
- if ( pNtHdrs->Signature == IMAGE_NT_SIGNATURE
- && pNtHdrs->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR_MAGIC
- && pNtHdrs->OptionalHeader.NumberOfRvaAndSizes > IMAGE_DIRECTORY_ENTRY_IMPORT
- && pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size >= sizeof(IMAGE_IMPORT_DESCRIPTOR)
- && pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress > sizeof(IMAGE_NT_HEADERS)
- && pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress < pImage->cbImageBits
+ if ( pNtHdrsIprt->Signature == IMAGE_NT_SIGNATURE
+ && pNtHdrsIprt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR_MAGIC
+ && pNtHdrsIprt->OptionalHeader.NumberOfRvaAndSizes > IMAGE_DIRECTORY_ENTRY_IMPORT
+ && pNtHdrsIprt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size >= sizeof(IMAGE_IMPORT_DESCRIPTOR)
+ && pNtHdrsIprt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress > sizeof(IMAGE_NT_HEADERS)
+ && pNtHdrsIprt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress < pImage->cbImageBits
)
{
struct MyRegion
@@ -1895,16 +1924,22 @@ int VBOXCALL supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, c
} aExcludeRgns[16];
unsigned cExcludeRgns = 0;
-#if 1 /* Win8.1/x86 hack: ImageBase contains weird stuff... */
- aExcludeRgns[cExcludeRgns].uRva = (uint32_t)((uint8_t *)&pNtHdrs->OptionalHeader.ImageBase - pbImageBits);
- aExcludeRgns[cExcludeRgns++].cb = sizeof(pNtHdrs->OptionalHeader.ImageBase);
-#endif
+ /* ImageBase: */
+ if ( pNtHdrsNtLd->OptionalHeader.ImageBase != pNtHdrsIprt->OptionalHeader.ImageBase
+ && ( pNtHdrsNtLd->OptionalHeader.ImageBase == (uintptr_t)pImage->pvImage
+ || pNtHdrsIprt->OptionalHeader.ImageBase == (uintptr_t)pImage->pvImage) )
+ {
+ aExcludeRgns[cExcludeRgns].uRva = offImageBase;
+ aExcludeRgns[cExcludeRgns].cb = cbImageBase;
+ cExcludeRgns++;
+ }
- uint32_t cImpsLeft = pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size
+ /* Imports: */
+ uint32_t cImpsLeft = pNtHdrsIprt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size
/ sizeof(IMAGE_IMPORT_DESCRIPTOR);
- IMAGE_IMPORT_DESCRIPTOR const *pImp;
- pImp = (IMAGE_IMPORT_DESCRIPTOR const *)(pbImageBits
- + pNtHdrs->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
+ uint32_t offImps = pNtHdrsIprt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
+ AssertLogRelReturn(offImps + cImpsLeft * sizeof(IMAGE_IMPORT_DESCRIPTOR) <= pImage->cbImageBits, VERR_INTERNAL_ERROR_3);
+ IMAGE_IMPORT_DESCRIPTOR const *pImp = (IMAGE_IMPORT_DESCRIPTOR const *)(pbImageBits + offImps);
while ( cImpsLeft-- > 0
&& cExcludeRgns < RT_ELEMENTS(aExcludeRgns))
{
@@ -2705,6 +2740,7 @@ static int supdrvNtProtectProtectNewStubChild(PSUPDRVNTPROTECT pNtParent, HANDLE
bool fSuccess = RTAvlPVInsert(&g_NtProtectTree, &pNtChild->AvlCore);
if (fSuccess)
{
+ pNtChild->fInTree = true;
pNtParent->u.pChild = pNtChild; /* Parent keeps the initial reference. */
pNtParent->enmProcessKind = kSupDrvNtProtectKind_StubParent;
pNtChild->u.pParent = pNtParent;
@@ -3036,6 +3072,8 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
#endif
else
{
+ ACCESS_MASK const fDesiredAccess = pOpInfo->Parameters->CreateHandleInformation.DesiredAccess;
+
/* Special case 1 on Vista, 7 & 8:
The CreateProcess code passes the handle over to CSRSS.EXE
and the code inBaseSrvCreateProcess will duplicate the
@@ -3052,7 +3090,7 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
&& ExGetPreviousMode() != KernelMode)
{
if ( !pOpInfo->KernelHandle
- && pOpInfo->Parameters->CreateHandleInformation.DesiredAccess == s_fCsrssStupidDesires)
+ && fDesiredAccess == s_fCsrssStupidDesires)
{
if (g_uNtVerCombined < SUP_MAKE_NT_VER_SIMPLE(6, 3))
fAllowedRights |= s_fCsrssStupidDesires;
@@ -3081,7 +3119,7 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
&& supdrvNtProtectIsAssociatedCsrss(pNtProtect, PsGetCurrentProcess()) )
{
pNtProtect->fCsrssFirstProcessCreateHandle = false;
- if (pOpInfo->Parameters->CreateHandleInformation.DesiredAccess == s_fCsrssStupidDesires)
+ if (fDesiredAccess == s_fCsrssStupidDesires)
{
/* Not needed: PROCESS_CREATE_THREAD, PROCESS_SET_SESSIONID,
PROCESS_CREATE_PROCESS */
@@ -3101,7 +3139,7 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
go into making this more secure. */
if ( g_uNtVerCombined >= SUP_MAKE_NT_VER_SIMPLE(6, 0)
&& g_uNtVerCombined < SUP_MAKE_NT_VER_SIMPLE(6, 2)
- && pOpInfo->Parameters->CreateHandleInformation.DesiredAccess == 0x1478 /* 6.1.7600.16385 (win7_rtm.090713-1255) */
+ && fDesiredAccess == 0x1478 /* 6.1.7600.16385 (win7_rtm.090713-1255) */
&& pNtProtect->fThemesFirstProcessCreateHandle
&& pOpInfo->KernelHandle == 0
&& ExGetPreviousMode() == UserMode
@@ -3112,11 +3150,29 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
pOpInfo->CallContext = NULL; /* don't assert this. */
}
+ /* Special case 6a, Windows 10+: AudioDG.exe opens the process with the
+ PROCESS_SET_LIMITED_INFORMATION right. It seems like it need it for
+ some myserious and weirdly placed cpu set management of our process.
+ I'd love to understand what that's all about...
+ Currently playing safe and only grand this right, however limited, to
+ audiodg.exe. */
+ if ( g_uNtVerCombined >= SUP_MAKE_NT_VER_SIMPLE(10, 0)
+ && ( fDesiredAccess == PROCESS_SET_LIMITED_INFORMATION
+ || fDesiredAccess == (PROCESS_SET_LIMITED_INFORMATION | PROCESS_QUERY_LIMITED_INFORMATION) /* expected fix #1 */
+ || fDesiredAccess == (PROCESS_SET_LIMITED_INFORMATION | PROCESS_QUERY_INFORMATION) /* expected fix #2 */
+ )
+ && pOpInfo->KernelHandle == 0
+ && ExGetPreviousMode() == UserMode
+ && supdrvNtProtectIsSystem32ProcessMatch(PsGetCurrentProcess(), "audiodg.exe") )
+ {
+ fAllowedRights |= PROCESS_SET_LIMITED_INFORMATION;
+ pOpInfo->CallContext = NULL; /* don't assert this. */
+ }
+
Log(("vboxdrv/ProcessHandlePre: %sctx=%04zx/%p wants %#x to %p/pid=%04zx [%d], allow %#x => %#x; %s [prev=%#x]\n",
pOpInfo->KernelHandle ? "k" : "", PsGetProcessId(PsGetCurrentProcess()), PsGetCurrentProcess(),
- pOpInfo->Parameters->CreateHandleInformation.DesiredAccess,
- pOpInfo->Object, pNtProtect->AvlCore.Key, pNtProtect->enmProcessKind, fAllowedRights,
- pOpInfo->Parameters->CreateHandleInformation.DesiredAccess & fAllowedRights,
+ fDesiredAccess, pOpInfo->Object, pNtProtect->AvlCore.Key, pNtProtect->enmProcessKind,
+ fAllowedRights, fDesiredAccess & fAllowedRights,
PsGetProcessImageFileName(PsGetCurrentProcess()), ExGetPreviousMode() ));
pOpInfo->Parameters->CreateHandleInformation.DesiredAccess &= fAllowedRights;
@@ -3141,13 +3197,15 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
}
else
{
+ ACCESS_MASK const fDesiredAccess = pOpInfo->Parameters->DuplicateHandleInformation.DesiredAccess;
+
/* Special case 5 on Vista, 7 & 8:
This is the CSRSS.EXE end of special case #1. */
if ( g_uNtVerCombined < SUP_MAKE_NT_VER_SIMPLE(6, 3)
&& pNtProtect->enmProcessKind == kSupDrvNtProtectKind_VmProcessUnconfirmed
&& pNtProtect->cCsrssFirstProcessDuplicateHandle > 0
&& pOpInfo->KernelHandle == 0
- && pOpInfo->Parameters->DuplicateHandleInformation.DesiredAccess == s_fCsrssStupidDesires
+ && fDesiredAccess == s_fCsrssStupidDesires
&& pNtProtect->hParentPid
== PsGetProcessId((PEPROCESS)pOpInfo->Parameters->DuplicateHandleInformation.SourceProcess)
&& pOpInfo->Parameters->DuplicateHandleInformation.TargetProcess == PsGetCurrentProcess()
@@ -3167,12 +3225,26 @@ supdrvNtProtectCallback_ProcessHandlePre(PVOID pvUser, POB_PRE_OPERATION_INFORMA
}
}
+ /* Special case 6b, Windows 10+: AudioDG.exe duplicates the handle it opened above. */
+ if ( g_uNtVerCombined >= SUP_MAKE_NT_VER_SIMPLE(10, 0)
+ && ( fDesiredAccess == PROCESS_SET_LIMITED_INFORMATION
+ || fDesiredAccess == (PROCESS_SET_LIMITED_INFORMATION | PROCESS_QUERY_LIMITED_INFORMATION) /* expected fix #1 */
+ || fDesiredAccess == (PROCESS_SET_LIMITED_INFORMATION | PROCESS_QUERY_INFORMATION) /* expected fix #2 */
+ )
+ && pOpInfo->KernelHandle == 0
+ && ExGetPreviousMode() == UserMode
+ && supdrvNtProtectIsSystem32ProcessMatch(PsGetCurrentProcess(), "audiodg.exe") )
+ {
+ fAllowedRights |= PROCESS_SET_LIMITED_INFORMATION;
+ pOpInfo->CallContext = NULL; /* don't assert this. */
+ }
+
Log(("vboxdrv/ProcessHandlePre: %sctx=%04zx/%p[%p] dup from %04zx/%p with %#x to %p in pid=%04zx [%d] %s\n",
pOpInfo->KernelHandle ? "k" : "", PsGetProcessId(PsGetCurrentProcess()), PsGetCurrentProcess(),
pOpInfo->Parameters->DuplicateHandleInformation.TargetProcess,
PsGetProcessId((PEPROCESS)pOpInfo->Parameters->DuplicateHandleInformation.SourceProcess),
pOpInfo->Parameters->DuplicateHandleInformation.SourceProcess,
- pOpInfo->Parameters->DuplicateHandleInformation.DesiredAccess,
+ fDesiredAccess,
pOpInfo->Object, pNtProtect->AvlCore.Key, pNtProtect->enmProcessKind,
PsGetProcessImageFileName(PsGetCurrentProcess()) ));
@@ -3454,6 +3526,7 @@ static int supdrvNtProtectCreate(PSUPDRVNTPROTECT *ppNtProtect, HANDLE hPid, SUP
RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
RTSpinlockAcquire(g_hNtProtectLock, &Tmp);
bool fSuccess = RTAvlPVInsert(&g_NtProtectTree, &pNtProtect->AvlCore);
+ pNtProtect->fInTree = fSuccess;
RTSpinlockRelease(g_hNtProtectLock, &Tmp);
if (!fSuccess)
@@ -3495,9 +3568,13 @@ static void supdrvNtProtectRelease(PSUPDRVNTPROTECT pNtProtect)
* child/parent references related to this protection structure.
*/
ASMAtomicWriteU32(&pNtProtect->u32Magic, SUPDRVNTPROTECT_MAGIC_DEAD);
- PSUPDRVNTPROTECT pRemoved = (PSUPDRVNTPROTECT)RTAvlPVRemove(&g_NtProtectTree, pNtProtect->AvlCore.Key);
+ if (pNtProtect->fInTree)
+ {
+ PSUPDRVNTPROTECT pRemoved = (PSUPDRVNTPROTECT)RTAvlPVRemove(&g_NtProtectTree, pNtProtect->AvlCore.Key);
+ Assert(pRemoved == pNtProtect);
+ pNtProtect->fInTree = false;
+ }
- PSUPDRVNTPROTECT pRemovedChild = NULL;
PSUPDRVNTPROTECT pChild = NULL;
if (pNtProtect->enmProcessKind == kSupDrvNtProtectKind_StubParent)
{
@@ -3509,7 +3586,15 @@ static void supdrvNtProtectRelease(PSUPDRVNTPROTECT pNtProtect)
pChild->enmProcessKind = kSupDrvNtProtectKind_VmProcessDead;
uint32_t cChildRefs = ASMAtomicDecU32(&pChild->cRefs);
if (!cChildRefs)
- pRemovedChild = (PSUPDRVNTPROTECT)RTAvlPVRemove(&g_NtProtectTree, pChild->AvlCore.Key);
+ {
+ Assert(pChild->fInTree);
+ if (pChild->fInTree)
+ {
+ PSUPDRVNTPROTECT pRemovedChild = (PSUPDRVNTPROTECT)RTAvlPVRemove(&g_NtProtectTree, pChild->AvlCore.Key);
+ Assert(pRemovedChild == pChild);
+ pChild->fInTree = false;
+ }
+ }
else
pChild = NULL;
}
@@ -3518,8 +3603,6 @@ static void supdrvNtProtectRelease(PSUPDRVNTPROTECT pNtProtect)
AssertRelease(pNtProtect->enmProcessKind != kSupDrvNtProtectKind_VmProcessUnconfirmed);
RTSpinlockRelease(g_hNtProtectLock, &Tmp);
- Assert(pRemoved == pNtProtect);
- Assert(pRemovedChild == pChild);
if (pNtProtect->pCsrssProcess)
{
@@ -3749,7 +3832,7 @@ static int supdrvNtProtectRestrictHandlesToProcessAndThread(PSUPDRVNTPROTECT pNt
Windows 8.1 and later, and one in earlier. This is probably a
little overly paranoid as I think we can safely trust the
system process... */
- if ( cSystemProcessHandles < (g_uNtVerCombined >= SUP_MAKE_NT_VER_SIMPLE(6, 3) ? 2U : 1U)
+ if ( cSystemProcessHandles < (g_uNtVerCombined >= SUP_MAKE_NT_VER_SIMPLE(6, 3) ? UINT32_C(2) : UINT32_C(1))
&& pHandleInfo->UniqueProcessId == PsGetProcessId(PsInitialSystemProcess))
{
cSystemProcessHandles++;
@@ -3946,8 +4029,7 @@ static int supdrvNtProtectVerifyProcess(PSUPDRVNTPROTECT pNtProtect)
if (!pErrorInfo->cchErrorInfo)
pErrorInfo->cchErrorInfo = (uint32_t)RTStrPrintf(pErrorInfo->szErrorInfo, sizeof(pErrorInfo->szErrorInfo),
"supdrvNtProtectVerifyProcess: rc=%d", rc);
- if (RT_FAILURE(rc))
- RTLogWriteDebugger(pErrorInfo->szErrorInfo, pErrorInfo->cchErrorInfo);
+ RTLogWriteDebugger(pErrorInfo->szErrorInfo, pErrorInfo->cchErrorInfo);
int rc2 = RTSemMutexRequest(g_hErrorInfoLock, RT_INDEFINITE_WAIT);
if (RT_SUCCESS(rc2))
diff --git a/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp b/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
index 995dccb..2415f2a 100644
--- a/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
@@ -785,7 +785,7 @@ static int supHardNtViCheckIfNotSignedOk(RTLDRMOD hLdrMod, PCRTUTF16 pwszName, u
if (supHardViUtf16PathIsEqual(pwsz, "apisetschema.dll"))
return IS_W70() ? VINF_LDRVI_NOT_SIGNED : rc;
if (supHardViUtf16PathIsEqual(pwsz, "apphelp.dll"))
- return uNtVer < SUP_MAKE_NT_VER_SIMPLE(6, 4) ? VINF_LDRVI_NOT_SIGNED : rc;
+ return VINF_LDRVI_NOT_SIGNED; /* So far, never signed... */
#ifdef VBOX_PERMIT_VERIFIER_DLL
if (supHardViUtf16PathIsEqual(pwsz, "verifier.dll"))
return uNtVer < SUP_NT_VER_W81 ? VINF_LDRVI_NOT_SIGNED : rc;
@@ -922,7 +922,17 @@ static int supHardNtViCheckIfNotSignedOk(RTLDRMOD hLdrMod, PCRTUTF16 pwszName, u
/**
- * @callback_method_impl{RTCRPKCS7VERIFYCERTCALLBACK,
+ * @callback_method_impl{FNRTDUMPPRINTFV, Formats into RTERRINFO. }
+ */
+static DECLCALLBACK(void) supHardNtViAsn1DumpToErrInfo(void *pvUser, const char *pszFormat, va_list va)
+{
+ PRTERRINFO pErrInfo = (PRTERRINFO)pvUser;
+ RTErrInfoAddV(pErrInfo, pErrInfo->rc, pszFormat, va);
+}
+
+
+/**
+ * @callback_method_impl{FNRTCRPKCS7VERIFYCERTCALLBACK,
* Standard code signing. Use this for Microsoft SPC.}
*/
static DECLCALLBACK(int) supHardNtViCertVerifyCallback(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
@@ -940,7 +950,15 @@ static DECLCALLBACK(int) supHardNtViCertVerifyCallback(PCRTCRX509CERTIFICATE pCe
{
if (RTCrX509Certificate_Compare(pCert, &g_BuildX509Cert) == 0) /* healthy paranoia */
return VINF_SUCCESS;
- return RTErrInfoSetF(pErrInfo, VERR_SUP_VP_NOT_BUILD_CERT_IPE, "Not valid kernel code signature.");
+ int rc = RTErrInfoSetF(pErrInfo, VERR_SUP_VP_NOT_BUILD_CERT_IPE, "Not valid kernel code signature (fFlags=%#x).", fFlags);
+ if (pErrInfo)
+ {
+ RTErrInfoAdd(pErrInfo, rc, "\n\nExe cert:\n");
+ RTAsn1Dump(&pCert->SeqCore.Asn1Core, 0 /*fFlags*/, 0 /*uLevel*/, supHardNtViAsn1DumpToErrInfo, pErrInfo);
+ RTErrInfoAdd(pErrInfo, rc, "\n\nBuild cert:\n");
+ RTAsn1Dump(&g_BuildX509Cert.SeqCore.Asn1Core, 0 /*fFlags*/, 0 /*uLevel*/, supHardNtViAsn1DumpToErrInfo, pErrInfo);
+ }
+ return rc;
}
/*
@@ -1256,7 +1274,7 @@ DECLHIDDEN(int) supHardenedWinVerifyImageByHandle(HANDLE hFile, PCRTUTF16 pwszNa
supHardNtViRdrDestroy(&pNtViRdr->Core);
}
SUP_DPRINTF(("supHardenedWinVerifyImageByHandle: -> %d (%ls)%s\n",
- rc, pwszName, pfWinVerifyTrust && *pfWinVerifyTrust ? "WinVerifyTrust" : ""));
+ rc, pwszName, pfWinVerifyTrust && *pfWinVerifyTrust ? " WinVerifyTrust" : ""));
return rc;
}
diff --git a/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp b/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
index d9f69f2..17486f0 100644
--- a/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
@@ -213,7 +213,7 @@ typedef struct SUPR3WINPROCPARAMS
/** Where if message. */
char szWhere[80];
/** Error message / path name string space. */
- char szErrorMsg[4096];
+ char szErrorMsg[16384+1024];
} SUPR3WINPROCPARAMS;
@@ -790,7 +790,9 @@ DECLHIDDEN(void) supR3HardenedWinVerifyCacheScheduleImports(RTLDRMOD hLdrMod, PC
if ( RTStrCmp(uBuf.szName, "kernel32.dll") == 0
|| RTStrCmp(uBuf.szName, "kernelbase.dll") == 0
|| RTStrCmp(uBuf.szName, "ntdll.dll") == 0
- || RTStrNCmp(uBuf.szName, RT_STR_TUPLE("api-ms-win-")) == 0 )
+ || RTStrNCmp(uBuf.szName, RT_STR_TUPLE("api-ms-win-")) == 0
+ || RTStrNCmp(uBuf.szName, RT_STR_TUPLE("ext-ms-win-")) == 0
+ )
{
continue;
}
@@ -1708,8 +1710,11 @@ supR3HardenedMonitor_LdrLoadDll(PWSTR pwszSearchPath, PULONG pfFlags, PUNICODE_S
* Not an absolute path. Check if it's one of those special API set DLLs
* or something we're known to use but should be taken from WinSxS.
*/
- else if (supHardViUtf16PathStartsWithEx(pName->Buffer, pName->Length / sizeof(WCHAR),
- L"api-ms-win-", 11, false /*fCheckSlash*/))
+ else if ( supHardViUtf16PathStartsWithEx(pName->Buffer, pName->Length / sizeof(WCHAR),
+ L"api-ms-win-", 11, false /*fCheckSlash*/)
+ || supHardViUtf16PathStartsWithEx(pName->Buffer, pName->Length / sizeof(WCHAR),
+ L"ext-ms-win-", 11, false /*fCheckSlash*/)
+ )
{
memcpy(wszPath, pName->Buffer, pName->Length);
wszPath[pName->Length / sizeof(WCHAR)] = '\0';
@@ -4172,17 +4177,18 @@ DECLHIDDEN(char *) supR3HardenedWinReadErrorInfoDevice(char *pszErrorInfo, size_
offRead.QuadPart = 0;
rcNt = NtReadFile(hFile, NULL /*hEvent*/, NULL /*ApcRoutine*/, NULL /*ApcContext*/, &Ios,
&pszErrorInfo[cchPrefix], (ULONG)(cbErrorInfo - cchPrefix - 1), &offRead, NULL);
- if (NT_SUCCESS(rcNt))
+ if (NT_SUCCESS(rcNt) && NT_SUCCESS(Ios.Status) && Ios.Information > 0)
{
memcpy(pszErrorInfo, pszPrefix, cchPrefix);
- pszErrorInfo[cbErrorInfo - 1] = '\0';
+ pszErrorInfo[RT_MIN(cbErrorInfo - 1, Ios.Information)] = '\0';
SUP_DPRINTF(("supR3HardenedWinReadErrorInfoDevice: '%s'", &pszErrorInfo[cchPrefix]));
}
else
{
*pszErrorInfo = '\0';
- if (rcNt != STATUS_END_OF_FILE)
- SUP_DPRINTF(("supR3HardenedWinReadErrorInfoDevice: NtReadFile -> %#x\n", rcNt));
+ if (rcNt != STATUS_END_OF_FILE || Ios.Status != STATUS_END_OF_FILE)
+ SUP_DPRINTF(("supR3HardenedWinReadErrorInfoDevice: NtReadFile -> %#x / %#x / %p\n",
+ rcNt, Ios.Status, Ios.Information));
}
}
else
@@ -4346,7 +4352,7 @@ static void supR3HardenedWinOpenStubDevice(void)
* extra information that goes into VBoxStartup.log so that we stand a
* better chance resolving the issue.
*/
- char szErrorInfo[_4K];
+ char szErrorInfo[16384];
int rc = VERR_OPEN_FAILED;
if (SUP_NT_STATUS_IS_VBOX(rcNt)) /* See VBoxDrvNtErr2NtStatus. */
{
@@ -4392,7 +4398,7 @@ static void supR3HardenedWinOpenStubDevice(void)
supR3HardenedFatalMsg("supR3HardenedWinReSpawn", kSupInitOp_Driver, rc,
"NtCreateFile(%ls) failed: %Rrc (rcNt=%#x)%s", s_wszName, rc, rcNt,
supR3HardenedWinReadErrorInfoDevice(szErrorInfo, sizeof(szErrorInfo),
- "\nVBoxDrvStub error: "));
+ "\nVBoxDrvStub error: "));
}
else
{
diff --git a/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm b/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm
index d6440e5..821df15 100644
--- a/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm
+++ b/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm
@@ -163,6 +163,18 @@ BEGINPROC %1 %+ _SyscallType1
syscall
ret
ENDPROC %1 %+ _SyscallType1
+BEGINPROC %1 %+ _SyscallType2 ; Introduced with build 10525
+ SEH64_END_PROLOGUE
+ mov eax, [NAME(g_uApiNo %+ %1) xWrtRIP]
+ test byte [07ffe0308h], 1 ; SharedUserData!Something
+ mov r10, rcx
+ jnz .int_alternative
+ syscall
+ ret
+.int_alternative:
+ int 2eh
+ ret
+ENDPROC %1 %+ _SyscallType2
%else
BEGINPROC %1 %+ _SyscallType1
mov edx, 07ffe0300h ; SharedUserData!SystemCallStub
diff --git a/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainImports-win.cpp b/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainImports-win.cpp
index b1ab2ea..5122a93 100644
--- a/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainImports-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainImports-win.cpp
@@ -99,9 +99,9 @@ typedef struct SUPHNTIMPSYSCALL
uint32_t *puApiNo;
/** Assembly system call routine, type 1. */
PFNRT pfnType1;
-#ifdef RT_ARCH_X86
/** Assembly system call routine, type 2. */
PFNRT pfnType2;
+#ifdef RT_ARCH_X86
/** The parameter size in bytes for a standard call. */
uint32_t cbParams;
#endif
@@ -222,7 +222,7 @@ static const SUPHNTIMPFUNC g_aSupNtImpKernel32Functions[] =
# define SUPHARNT_IMPORT_STDCALL(a_Name, a_cbParamsX86) \
{ NULL, NULL },
# define SUPHARNT_IMPORT_SYSCALL(a_Name, a_cbParamsX86) \
- { &RT_CONCAT(g_uApiNo, a_Name), &RT_CONCAT(a_Name, _SyscallType1) },
+ { &RT_CONCAT(g_uApiNo, a_Name), &RT_CONCAT(a_Name, _SyscallType1), &RT_CONCAT(a_Name, _SyscallType2) },
#elif defined(RT_ARCH_X86)
# define SUPHARNT_IMPORT_STDCALL(a_Name, a_cbParamsX86) \
{ NULL, NULL, NULL, 0 },
@@ -457,14 +457,27 @@ static void supR3HardenedDirectSyscall(PSUPHNTIMPDLL pDll, PCSUPHNTIMPFUNC pImpo
* Parse the code and extract the API call number.
*/
#ifdef RT_ARCH_AMD64
- /* Pattern #1: XP64/W2K3-64 thru Windows 8.1
- 0:000> u ntdll!NtCreateSection
- ntdll!NtCreateSection:
- 00000000`779f1750 4c8bd1 mov r10,rcx
- 00000000`779f1753 b847000000 mov eax,47h
- 00000000`779f1758 0f05 syscall
- 00000000`779f175a c3 ret
- 00000000`779f175b 0f1f440000 nop dword ptr [rax+rax] */
+ /* Pattern #1: XP64/W2K3-64 thru Windows 10 build 10240.
+ 0:000> u ntdll!NtCreateSection
+ ntdll!NtCreateSection:
+ 00000000`779f1750 4c8bd1 mov r10,rcx
+ 00000000`779f1753 b847000000 mov eax,47h
+ 00000000`779f1758 0f05 syscall
+ 00000000`779f175a c3 ret
+ 00000000`779f175b 0f1f440000 nop dword ptr [rax+rax]
+
+ Pattern #2: Windows 10 build 10525+.
+ 0:000> u ntdll_7ffc26300000!NtCreateSection
+ ntdll_7ffc26300000!ZwCreateSection:
+ 00007ffc`263943e0 4c8bd1 mov r10,rcx
+ 00007ffc`263943e3 b84a000000 mov eax,4Ah
+ 00007ffc`263943e8 f604250803fe7f01 test byte ptr [SharedUserData+0x308 (00000000`7ffe0308)],1
+ 00007ffc`263943f0 7503 jne ntdll_7ffc26300000!ZwCreateSection+0x15 (00007ffc`263943f5)
+ 00007ffc`263943f2 0f05 syscall
+ 00007ffc`263943f4 c3 ret
+ 00007ffc`263943f5 cd2e int 2Eh
+ 00007ffc`263943f7 c3 ret
+ */
if ( pbFunction[ 0] == 0x4c /* mov r10, rcx */
&& pbFunction[ 1] == 0x8b
&& pbFunction[ 2] == 0xd1
@@ -472,14 +485,37 @@ static void supR3HardenedDirectSyscall(PSUPHNTIMPDLL pDll, PCSUPHNTIMPFUNC pImpo
//&& pbFunction[ 4] == 0xZZ
//&& pbFunction[ 5] == 0xYY
&& pbFunction[ 6] == 0x00
- && pbFunction[ 7] == 0x00
- && pbFunction[ 8] == 0x0f /* syscall */
- && pbFunction[ 9] == 0x05
- && pbFunction[10] == 0xc3 /* ret */ )
+ && pbFunction[ 7] == 0x00)
{
- *pSyscall->puApiNo = RT_MAKE_U16(pbFunction[4], pbFunction[5]);
- *pImport->ppfnImport = pSyscall->pfnType1;
- return;
+ if ( pbFunction[ 8] == 0x0f /* syscall */
+ && pbFunction[ 9] == 0x05
+ && pbFunction[10] == 0xc3 /* ret */ )
+ {
+ *pSyscall->puApiNo = RT_MAKE_U16(pbFunction[4], pbFunction[5]);
+ *pImport->ppfnImport = pSyscall->pfnType1;
+ return;
+ }
+ if ( pbFunction[ 8] == 0xf6 /* test byte ptr [SharedUserData+0x308 (00000000`7ffe0308)],1 */
+ && pbFunction[ 9] == 0x04
+ && pbFunction[10] == 0x25
+ && pbFunction[11] == 0x08
+ && pbFunction[12] == 0x03
+ && pbFunction[13] == 0xfe
+ && pbFunction[14] == 0x7f
+ && pbFunction[15] == 0x01
+ && pbFunction[16] == 0x75 /* jnz +3 */
+ && pbFunction[17] == 0x03
+ && pbFunction[18] == 0x0f /* syscall*/
+ && pbFunction[19] == 0x05
+ && pbFunction[20] == 0xc3 /* ret */
+ && pbFunction[21] == 0xcd /* int 2eh */
+ && pbFunction[22] == 0x2e
+ && pbFunction[23] == 0xc3 /* ret */ )
+ {
+ *pSyscall->puApiNo = RT_MAKE_U16(pbFunction[4], pbFunction[5]);
+ *pImport->ppfnImport = pSyscall->pfnType2;
+ return;
+ }
}
#else
/* Pattern #1: XP thru Windows 7
diff --git a/src/VBox/HostServices/GuestProperties/service.cpp b/src/VBox/HostServices/GuestProperties/service.cpp
index e6b6de8..36ed074 100644
--- a/src/VBox/HostServices/GuestProperties/service.cpp
+++ b/src/VBox/HostServices/GuestProperties/service.cpp
@@ -56,6 +56,9 @@
#include <string>
#include <list>
+/** @todo Delete the old !ASYNC_HOST_NOTIFY code and remove this define. */
+#define ASYNC_HOST_NOTIFY
+
namespace guestProp {
/**
@@ -284,6 +287,10 @@ public:
, mpvHostData(NULL)
, mPrevTimestamp(0)
, mcTimestampAdjustments(0)
+#ifdef ASYNC_HOST_NOTIFY
+ , mhThreadNotifyHost(NIL_RTTHREAD)
+ , mpReqQNotifyHost(NULL)
+#endif
{ }
/**
@@ -362,6 +369,10 @@ public:
pSelf->mpvHostData = pvExtension;
return VINF_SUCCESS;
}
+#ifdef ASYNC_HOST_NOTIFY
+ int initialize();
+#endif
+
private:
static DECLCALLBACK(int) reqThreadFn(RTTHREAD ThreadSelf, void *pvUser);
uint64_t getCurrentTimestamp(void);
@@ -386,6 +397,14 @@ private:
VBOXHGCMSVCPARM paParms[]);
int hostCall(uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
int uninit();
+
+#ifdef ASYNC_HOST_NOTIFY
+ /* Thread for handling host notifications. */
+ RTTHREAD mhThreadNotifyHost;
+ /* Queue for handling requests for notifications. */
+ RTREQQUEUE *mpReqQNotifyHost;
+ static DECLCALLBACK(int) threadNotifyHost(RTTHREAD self, void *pvUser);
+#endif
};
@@ -1202,6 +1221,18 @@ int Service::doNotifications(const char *pszProperty, uint64_t u64Timestamp)
return rc;
}
+#ifdef ASYNC_HOST_NOTIFY
+static DECLCALLBACK(void) notifyHostAsyncWorker(PFNHGCMSVCEXT pfnHostCallback,
+ void *pvHostData,
+ HOSTCALLBACKDATA *pHostCallbackData)
+{
+ pfnHostCallback(pvHostData, 0 /*u32Function*/,
+ (void *)pHostCallbackData,
+ sizeof(HOSTCALLBACKDATA));
+ RTMemFree(pHostCallbackData);
+}
+#endif
+
/**
* Notify the service owner that a property has been added/deleted/changed.
* @returns IPRT status value
@@ -1215,6 +1246,52 @@ int Service::notifyHost(const char *pszName, const char *pszValue,
{
LogFlowFunc(("pszName=%s, pszValue=%s, u64Timestamp=%llu, pszFlags=%s\n",
pszName, pszValue, u64Timestamp, pszFlags));
+#ifdef ASYNC_HOST_NOTIFY
+ int rc = VINF_SUCCESS;
+
+ /* Allocate buffer for the callback data and strings. */
+ size_t cbName = pszName? strlen(pszName): 0;
+ size_t cbValue = pszValue? strlen(pszValue): 0;
+ size_t cbFlags = pszFlags? strlen(pszFlags): 0;
+ size_t cbAlloc = sizeof(HOSTCALLBACKDATA) + cbName + cbValue + cbFlags + 3;
+ HOSTCALLBACKDATA *pHostCallbackData = (HOSTCALLBACKDATA *)RTMemAlloc(cbAlloc);
+ if (pHostCallbackData)
+ {
+ uint8_t *pu8 = (uint8_t *)pHostCallbackData;
+ pu8 += sizeof(HOSTCALLBACKDATA);
+
+ pHostCallbackData->u32Magic = HOSTCALLBACKMAGIC;
+
+ pHostCallbackData->pcszName = (const char *)pu8;
+ memcpy(pu8, pszName, cbName);
+ pu8 += cbName;
+ *pu8++ = 0;
+
+ pHostCallbackData->pcszValue = (const char *)pu8;
+ memcpy(pu8, pszValue, cbValue);
+ pu8 += cbValue;
+ *pu8++ = 0;
+
+ pHostCallbackData->u64Timestamp = u64Timestamp;
+
+ pHostCallbackData->pcszFlags = (const char *)pu8;
+ memcpy(pu8, pszFlags, cbFlags);
+ pu8 += cbFlags;
+ *pu8++ = 0;
+
+ rc = RTReqCallEx(mpReqQNotifyHost, NULL, 0, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,
+ (PFNRT)notifyHostAsyncWorker, 3,
+ mpfnHostCallback, mpvHostData, pHostCallbackData);
+ if (RT_FAILURE(rc))
+ {
+ RTMemFree(pHostCallbackData);
+ }
+ }
+ else
+ {
+ rc = VERR_NO_MEMORY;
+ }
+#else
HOSTCALLBACKDATA HostCallbackData;
HostCallbackData.u32Magic = HOSTCALLBACKMAGIC;
HostCallbackData.pcszName = pszName;
@@ -1224,6 +1301,7 @@ int Service::notifyHost(const char *pszName, const char *pszValue,
int rc = mpfnHostCallback(mpvHostData, 0 /*u32Function*/,
(void *)(&HostCallbackData),
sizeof(HostCallbackData));
+#endif
LogFlowFunc(("returning rc=%Rrc\n", rc));
return rc;
}
@@ -1382,8 +1460,84 @@ int Service::hostCall (uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paPa
return rc;
}
+#ifdef ASYNC_HOST_NOTIFY
+/* static */
+DECLCALLBACK(int) Service::threadNotifyHost(RTTHREAD self, void *pvUser)
+{
+ Service *pThis = (Service *)pvUser;
+ int rc = VINF_SUCCESS;
+
+ LogFlowFunc(("ENTER: %p\n", pThis));
+
+ for (;;)
+ {
+ rc = RTReqProcess(pThis->mpReqQNotifyHost, RT_INDEFINITE_WAIT);
+
+ AssertMsg(rc == VWRN_STATE_CHANGED,
+ ("Left RTReqProcess and error code is not VWRN_STATE_CHANGED rc=%Rrc\n",
+ rc));
+ if (rc == VWRN_STATE_CHANGED)
+ {
+ break;
+ }
+ }
+
+ LogFlowFunc(("LEAVE: %Rrc\n", rc));
+ return rc;
+}
+
+static DECLCALLBACK(int) wakeupNotifyHost(void)
+{
+ /* Returning a VWRN_* will cause RTReqProcess return. */
+ return VWRN_STATE_CHANGED;
+}
+
+int Service::initialize()
+{
+ /* The host notification thread and queue. */
+ int rc = RTReqCreateQueue(&mpReqQNotifyHost);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTThreadCreate(&mhThreadNotifyHost,
+ threadNotifyHost,
+ this,
+ 0 /* default stack size */,
+ RTTHREADTYPE_DEFAULT,
+ 0, /* no flags. */
+ "GSTPROPNTFY");
+ }
+
+ if (RT_FAILURE(rc))
+ {
+ if (mpReqQNotifyHost != NULL)
+ {
+ RTReqDestroyQueue(mpReqQNotifyHost);
+ mpReqQNotifyHost = NULL;
+ }
+ }
+
+ return rc;
+}
+#endif
+
int Service::uninit()
{
+#ifdef ASYNC_HOST_NOTIFY
+ if (mpReqQNotifyHost != NULL)
+ {
+ /* Stop the thread */
+ PRTREQ pReq;
+ int rc = RTReqCall(mpReqQNotifyHost, &pReq, 10000, (PFNRT)wakeupNotifyHost, 0);
+ if (RT_SUCCESS(rc))
+ RTReqFree(pReq);
+
+ rc = RTReqDestroyQueue(mpReqQNotifyHost);
+ AssertRC(rc);
+ mpReqQNotifyHost = NULL;
+ mhThreadNotifyHost = NIL_RTTHREAD;
+ }
+#endif
+
return VINF_SUCCESS;
}
@@ -1443,6 +1597,15 @@ extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *pt
/* Service specific initialization. */
ptable->pvService = pService;
+
+#ifdef ASYNC_HOST_NOTIFY
+ rc = pService->initialize();
+ if (RT_FAILURE(rc))
+ {
+ delete pService;
+ pService = NULL;
+ }
+#endif
}
else
Assert(!pService);
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py
old mode 100755
new mode 100644
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch_header.py b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch_header.py
old mode 100755
new mode 100644
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py
old mode 100755
new mode 100644
diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
old mode 100755
new mode 100644
diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py
old mode 100755
new mode 100644
diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py
old mode 100755
new mode 100644
diff --git a/src/VBox/Installer/linux/rpm/rules b/src/VBox/Installer/linux/rpm/rules
index ec750ca..2512490 100755
--- a/src/VBox/Installer/linux/rpm/rules
+++ b/src/VBox/Installer/linux/rpm/rules
@@ -133,7 +133,6 @@ endif
cfg_flags := $(if $(NOQT),--disable-qt,) \
$(if $(filter el4 sles10.1,$(rpmrel)),--build-libxml2,) \
$(if $(filter el4,$(rpmrel)),--build-libssl,) \
- $(if $(filter el4 el5 ol4 ol5 centos4 centos5 sles10.1,$(rpmrel)),--build-libcurl,) \
$(if $(filter el5 centos5 sles10.1,$(rpmrel)),--disable-sdl-ttf,) \
$(if $(filter sles10.1 turbolinux11,$(rpmrel)),--disable-pulse,) \
$(if $(filter el4 el5 ol4 ol5 centos4 centos5,$(rpmrel)),--enable-pulse,) \
diff --git a/src/VBox/Main/Makefile.kmk b/src/VBox/Main/Makefile.kmk
index 6e582a7..27644cf 100644
--- a/src/VBox/Main/Makefile.kmk
+++ b/src/VBox/Main/Makefile.kmk
@@ -232,7 +232,6 @@ VBoxSVC_DEFS = \
$(if $(VBOX_WITH_LIVE_MIGRATION),VBOX_WITH_LIVE_MIGRATION,) \
$(if $(VBOX_WITH_EXTPACK),VBOX_WITH_EXTPACK,) \
$(if $(VBOX_WITH_VUSB),VBOX_WITH_VUSB,) \
- $(if $(VBOX_WITH_S3),VBOX_WITH_S3,) \
$(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH,)
ifdef VBOX_WITH_USB
VBoxSVC_DEFS += \
diff --git a/src/VBox/Main/glue/constants-python.xsl b/src/VBox/Main/glue/constants-python.xsl
old mode 100644
new mode 100755
diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl
index e041801..525c1dc 100644
--- a/src/VBox/Main/idl/VirtualBox.xidl
+++ b/src/VBox/Main/idl/VirtualBox.xidl
@@ -2957,7 +2957,7 @@
<interface
name="IInternalMachineControl" extends="$unknown"
- uuid="ec824977-e43f-479c-81c9-ac6cae1423a5"
+ uuid="1cfdddf7-e1c0-4df7-9573-60b6d28d6796"
internal="yes"
wsmap="suppress"
>
@@ -3375,6 +3375,11 @@
The flags of the property.
</desc>
</param>
+ <param name="notify" type="boolean" dir="return">
+ <desc>
+ Returns if a guest property change notification event should be fired.
+ </desc>
+ </param>
</method>
<method name="lockMedia">
diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h
index 0444674..2119539 100644
--- a/src/VBox/Main/include/ConsoleImpl.h
+++ b/src/VBox/Main/include/ConsoleImpl.h
@@ -178,6 +178,7 @@ public:
AudioSniffer *getAudioSniffer() const { return mAudioSniffer; }
const ComPtr<IMachine> &machine() const { return mMachine; }
+ const Bstr &getId() const { return mstrUuid; }
bool useHostClipboard() { return mfUseHostClipboard; }
@@ -821,6 +822,9 @@ private:
/** Local machine state value. */
MachineState_T mMachineState;
+ /** Machine uuid string. */
+ Bstr mstrUuid;
+
/** Pointer to the progress object of a live cancelable task.
*
* This is currently only used by Console::Teleport(), but is intended to later
diff --git a/src/VBox/Main/include/MachineImpl.h b/src/VBox/Main/include/MachineImpl.h
index 3d39999..8de87f5 100644
--- a/src/VBox/Main/include/MachineImpl.h
+++ b/src/VBox/Main/include/MachineImpl.h
@@ -676,7 +676,7 @@ public:
void getLogFolder(Utf8Str &aLogFolder);
Utf8Str queryLogFilename(ULONG idx);
- Utf8Str i_getStartupLogFilename(void);
+ Utf8Str i_getHardeningLogFilename(void);
void composeSavedStateFilename(Utf8Str &strStateFilePath);
@@ -1010,7 +1010,8 @@ public:
STDMETHOD(PullGuestProperties)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues),
ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
STDMETHOD(PushGuestProperty)(IN_BSTR aName, IN_BSTR aValue,
- LONG64 aTimestamp, IN_BSTR aFlags);
+ LONG64 aTimestamp, IN_BSTR aFlags,
+ BOOL *aNotify);
STDMETHOD(LockMedia)() { return lockMedia(); }
STDMETHOD(UnlockMedia)() { unlockMedia(); return S_OK; }
STDMETHOD(EjectMedium)(IMediumAttachment *aAttachment,
diff --git a/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/VBox/Main/src-client/ConsoleImpl.cpp
index 49cd0e5..e11d5cf 100644
--- a/src/VBox/Main/src-client/ConsoleImpl.cpp
+++ b/src/VBox/Main/src-client/ConsoleImpl.cpp
@@ -298,7 +298,7 @@ public:
{
}
- STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent * aEvent)
+ STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent)
{
switch(aType)
{
@@ -310,12 +310,9 @@ public:
HRESULT rc = E_FAIL;
Assert(pNREv);
- Bstr interestedId;
- rc = pMachine->COMGETTER(Id)(interestedId.asOutParam());
- AssertComRC(rc);
rc = pNREv->COMGETTER(MachineId)(id.asOutParam());
AssertComRC(rc);
- if (id != interestedId)
+ if (id != mConsole->getId())
break;
/* now we can operate with redirects */
NATProtocol_T proto;
@@ -347,6 +344,7 @@ public:
default:
AssertFailed();
}
+
return S_OK;
}
private:
@@ -460,6 +458,9 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl)
rc = mMachine->COMGETTER(VRDEServer)(unconst(mVRDEServer).asOutParam());
AssertComRCReturnRC(rc);
+ rc = mMachine->COMGETTER(Id)(mstrUuid.asOutParam());
+ AssertComRCReturnRC(rc);
+
/* Create associated child COM objects */
// Event source may be needed by other children
@@ -927,14 +928,10 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
return VERR_ACCESS_DENIED;
}
- Bstr id;
- HRESULT hrc = mMachine->COMGETTER(Id)(id.asOutParam());
- Guid uuid = Guid(id);
-
- AssertComRCReturn(hrc, VERR_ACCESS_DENIED);
+ Guid uuid = Guid(getId());
AuthType_T authType = AuthType_Null;
- hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
+ HRESULT hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
AssertComRCReturn(hrc, VERR_ACCESS_DENIED);
ULONG authTimeout = 0;
@@ -1260,16 +1257,12 @@ void Console::VRDPClientDisconnect(uint32_t u32ClientId,
}
}
- Bstr uuid;
- HRESULT hrc = mMachine->COMGETTER(Id)(uuid.asOutParam());
- AssertComRC(hrc);
-
AuthType_T authType = AuthType_Null;
- hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
+ HRESULT hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
AssertComRC(hrc);
if (authType == AuthType_External)
- mConsoleVRDPServer->AuthDisconnect(uuid, u32ClientId);
+ mConsoleVRDPServer->AuthDisconnect(getId(), u32ClientId);
#ifdef VBOX_WITH_GUEST_PROPS
guestPropertiesVRDPUpdateDisconnect(u32ClientId);
@@ -1604,10 +1597,12 @@ DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
Bstr value(pCBData->pcszValue);
Bstr flags(pCBData->pcszFlags);
ComObjPtr<Console> pConsole = reinterpret_cast<Console *>(pvExtension);
+ BOOL fNotify = FALSE;
HRESULT hrc = pConsole->mControl->PushGuestProperty(name.raw(),
value.raw(),
pCBData->u64Timestamp,
- flags.raw());
+ flags.raw(),
+ &fNotify);
if (SUCCEEDED(hrc))
rc = VINF_SUCCESS;
else
@@ -1616,6 +1611,8 @@ DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
hrc, pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
rc = Global::vboxStatusCodeFromCOM(hrc);
}
+ if (fNotify)
+ fireGuestPropertyChangedEvent(pConsole->mEventSource, pConsole->getId().raw(), name.raw(), value.raw(), flags.raw());
return rc;
}
diff --git a/src/VBox/Main/src-server/ApplianceImpl.cpp b/src/VBox/Main/src-server/ApplianceImpl.cpp
index 4edfff3..dde3425 100644
--- a/src/VBox/Main/src-server/ApplianceImpl.cpp
+++ b/src/VBox/Main/src-server/ApplianceImpl.cpp
@@ -931,33 +931,21 @@ DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, vo
if (task->locInfo.storageType == VFSType_File)
taskrc = pAppliance->readFS(task.get());
else if (task->locInfo.storageType == VFSType_S3)
-#ifdef VBOX_WITH_S3
- taskrc = pAppliance->readS3(task.get());
-#else
taskrc = VERR_NOT_IMPLEMENTED;
-#endif
break;
case TaskOVF::Import:
if (task->locInfo.storageType == VFSType_File)
taskrc = pAppliance->importFS(task.get());
else if (task->locInfo.storageType == VFSType_S3)
-#ifdef VBOX_WITH_S3
- taskrc = pAppliance->importS3(task.get());
-#else
taskrc = VERR_NOT_IMPLEMENTED;
-#endif
break;
case TaskOVF::Write:
if (task->locInfo.storageType == VFSType_File)
taskrc = pAppliance->writeFS(task.get());
else if (task->locInfo.storageType == VFSType_S3)
-#ifdef VBOX_WITH_S3
- taskrc = pAppliance->writeS3(task.get());
-#else
taskrc = VERR_NOT_IMPLEMENTED;
-#endif
break;
}
diff --git a/src/VBox/Main/src-server/ApplianceImplExport.cpp b/src/VBox/Main/src-server/ApplianceImplExport.cpp
index 841356c..5468faf 100644
--- a/src/VBox/Main/src-server/ApplianceImplExport.cpp
+++ b/src/VBox/Main/src-server/ApplianceImplExport.cpp
@@ -1904,176 +1904,3 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
return rc;
}
-
-#ifdef VBOX_WITH_S3
-/**
- * Worker code for writing out OVF to the cloud. This is called from Appliance::taskThreadWriteOVF()
- * in S3 mode and therefore runs on the OVF write worker thread. This then starts a second worker
- * thread to create temporary files (see Appliance::writeFS()).
- *
- * @param pTask
- * @return
- */
-HRESULT Appliance::writeS3(TaskOVF *pTask)
-{
- LogFlowFuncEnter();
- LogFlowFunc(("Appliance %p\n", this));
-
- AutoCaller autoCaller(this);
- if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
- HRESULT rc = S_OK;
-
- AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
-
- int vrc = VINF_SUCCESS;
- RTS3 hS3 = NIL_RTS3;
- char szOSTmpDir[RTPATH_MAX];
- RTPathTemp(szOSTmpDir, sizeof(szOSTmpDir));
- /* The template for the temporary directory created below */
- char *pszTmpDir = RTPathJoinA(szOSTmpDir, "vbox-ovf-XXXXXX");
- list< pair<Utf8Str, ULONG> > filesList;
-
- // todo:
- // - usable error codes
- // - seems snapshot filenames are problematic {uuid}.vdi
- try
- {
- /* Extract the bucket */
- Utf8Str tmpPath = pTask->locInfo.strPath;
- Utf8Str bucket;
- parseBucket(tmpPath, bucket);
-
- /* We need a temporary directory which we can put the OVF file & all
- * disk images in */
- vrc = RTDirCreateTemp(pszTmpDir);
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot create temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
-
- /* The temporary name of the target OVF file */
- Utf8StrFmt strTmpOvf("%s/%s", pszTmpDir, RTPathFilename(tmpPath.c_str()));
-
- /* Prepare the temporary writing of the OVF */
- ComObjPtr<Progress> progress;
- /* Create a temporary file based location info for the sub task */
- LocationInfo li;
- li.strPath = strTmpOvf;
- rc = writeImpl(pTask->enFormat, li, progress);
- if (FAILED(rc)) throw rc;
-
- /* Unlock the appliance for the writing thread */
- appLock.release();
- /* Wait until the writing is done, but report the progress back to the
- caller */
- ComPtr<IProgress> progressInt(progress);
- waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
-
- /* Again lock the appliance for the next steps */
- appLock.acquire();
-
- vrc = RTPathExists(strTmpOvf.c_str()); /* Paranoid check */
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot find source file '%s' (%Rrc)"), strTmpOvf.c_str(), vrc);
- /* Add the OVF file */
- filesList.push_back(pair<Utf8Str, ULONG>(strTmpOvf, m->ulWeightForXmlOperation)); /* Use 1% of the total for the OVF file upload */
- /* Add the manifest file */
- if (m->fManifest)
- {
- Utf8Str strMfFile = Utf8Str(strTmpOvf).stripExt().append(".mf");
- filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */
- }
-
- /* Now add every disks of every virtual system */
- list< ComObjPtr<VirtualSystemDescription> >::const_iterator it;
- for (it = m->virtualSystemDescriptions.begin();
- it != m->virtualSystemDescriptions.end();
- ++it)
- {
- ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
- std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
- std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
- for (itH = avsdeHDs.begin();
- itH != avsdeHDs.end();
- ++itH)
- {
- const Utf8Str &strTargetFileNameOnly = (*itH)->strOvf;
- /* Target path needs to be composed from where the output OVF is */
- Utf8Str strTargetFilePath(strTmpOvf);
- strTargetFilePath.stripFilename();
- strTargetFilePath.append("/");
- strTargetFilePath.append(strTargetFileNameOnly);
- vrc = RTPathExists(strTargetFilePath.c_str()); /* Paranoid check */
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot find source file '%s' (%Rrc)"), strTargetFilePath.c_str(), vrc);
- filesList.push_back(pair<Utf8Str, ULONG>(strTargetFilePath, (*itH)->ulSizeMB));
- }
- }
- /* Next we have to upload the OVF & all disk images */
- vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot create S3 service handler"));
- RTS3SetProgressCallback(hS3, pTask->updateProgress, &pTask);
-
- /* Upload all files */
- for (list< pair<Utf8Str, ULONG> >::const_iterator it1 = filesList.begin(); it1 != filesList.end(); ++it1)
- {
- const pair<Utf8Str, ULONG> &s = (*it1);
- char *pszFilename = RTPathFilename(s.first.c_str());
- /* Advance to the next operation */
- pTask->pProgress->SetNextOperation(BstrFmt(tr("Uploading file '%s'"), pszFilename).raw(), s.second);
- vrc = RTS3PutKey(hS3, bucket.c_str(), pszFilename, s.first.c_str());
- if (RT_FAILURE(vrc))
- {
- if (vrc == VERR_S3_CANCELED)
- break;
- else if (vrc == VERR_S3_ACCESS_DENIED)
- throw setError(E_ACCESSDENIED,
- tr("Cannot upload file '%s' to S3 storage server (Access denied). Make sure that your credentials are right. Also check that your host clock is properly synced"), pszFilename);
- else if (vrc == VERR_S3_NOT_FOUND)
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot upload file '%s' to S3 storage server (File not found)"), pszFilename);
- else
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot upload file '%s' to S3 storage server (%Rrc)"), pszFilename, vrc);
- }
- }
- }
- catch(HRESULT aRC)
- {
- rc = aRC;
- }
- /* Cleanup */
- RTS3Destroy(hS3);
- /* Delete all files which where temporary created */
- for (list< pair<Utf8Str, ULONG> >::const_iterator it1 = filesList.begin(); it1 != filesList.end(); ++it1)
- {
- const char *pszFilePath = (*it1).first.c_str();
- if (RTPathExists(pszFilePath))
- {
- vrc = RTFileDelete(pszFilePath);
- if (RT_FAILURE(vrc))
- rc = setError(VBOX_E_FILE_ERROR,
- tr("Cannot delete file '%s' (%Rrc)"), pszFilePath, vrc);
- }
- }
- /* Delete the temporary directory */
- if (RTPathExists(pszTmpDir))
- {
- vrc = RTDirRemove(pszTmpDir);
- if (RT_FAILURE(vrc))
- rc = setError(VBOX_E_FILE_ERROR,
- tr("Cannot delete temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
- }
- if (pszTmpDir)
- RTStrFree(pszTmpDir);
-
- LogFlowFunc(("rc=%Rhrc\n", rc));
- LogFlowFuncLeave();
-
- return rc;
-}
-#endif /* VBOX_WITH_S3 */
diff --git a/src/VBox/Main/src-server/ApplianceImplImport.cpp b/src/VBox/Main/src-server/ApplianceImplImport.cpp
index e1d3bcf..c2af311 100644
--- a/src/VBox/Main/src-server/ApplianceImplImport.cpp
+++ b/src/VBox/Main/src-server/ApplianceImplImport.cpp
@@ -966,134 +966,6 @@ HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDI
return rc;
}
-#ifdef VBOX_WITH_S3
-/**
- * Worker code for reading OVF from the cloud. This is called from Appliance::taskThreadImportOrExport()
- * in S3 mode and therefore runs on the OVF read worker thread. This then starts a second worker
- * thread to create temporary files (see Appliance::readFS()).
- *
- * @param pTask
- * @return
- */
-HRESULT Appliance::readS3(TaskOVF *pTask)
-{
- LogFlowFuncEnter();
- LogFlowFunc(("Appliance %p\n", this));
-
- AutoCaller autoCaller(this);
- if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
- AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
-
- HRESULT rc = S_OK;
- int vrc = VINF_SUCCESS;
- RTS3 hS3 = NIL_RTS3;
- char szOSTmpDir[RTPATH_MAX];
- RTPathTemp(szOSTmpDir, sizeof(szOSTmpDir));
- /* The template for the temporary directory created below */
- char *pszTmpDir = RTPathJoinA(szOSTmpDir, "vbox-ovf-XXXXXX");
- list< pair<Utf8Str, ULONG> > filesList;
- Utf8Str strTmpOvf;
-
- try
- {
- /* Extract the bucket */
- Utf8Str tmpPath = pTask->locInfo.strPath;
- Utf8Str bucket;
- parseBucket(tmpPath, bucket);
-
- /* We need a temporary directory which we can put the OVF file & all
- * disk images in */
- vrc = RTDirCreateTemp(pszTmpDir);
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot create temporary directory '%s'"), pszTmpDir);
-
- /* The temporary name of the target OVF file */
- strTmpOvf = Utf8StrFmt("%s/%s", pszTmpDir, RTPathFilename(tmpPath.c_str()));
-
- /* Next we have to download the OVF */
- vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot create S3 service handler"));
- RTS3SetProgressCallback(hS3, pTask->updateProgress, &pTask);
-
- /* Get it */
- char *pszFilename = RTPathFilename(strTmpOvf.c_str());
- vrc = RTS3GetKey(hS3, bucket.c_str(), pszFilename, strTmpOvf.c_str());
- if (RT_FAILURE(vrc))
- {
- if (vrc == VERR_S3_CANCELED)
- throw S_OK; /* todo: !!!!!!!!!!!!! */
- else if (vrc == VERR_S3_ACCESS_DENIED)
- throw setError(E_ACCESSDENIED,
- tr("Cannot download file '%s' from S3 storage server (Access denied). Make sure that your credentials are right."
- "Also check that your host clock is properly synced"),
- pszFilename);
- else if (vrc == VERR_S3_NOT_FOUND)
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot download file '%s' from S3 storage server (File not found)"), pszFilename);
- else
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot download file '%s' from S3 storage server (%Rrc)"), pszFilename, vrc);
- }
-
- /* Close the connection early */
- RTS3Destroy(hS3);
- hS3 = NIL_RTS3;
-
- pTask->pProgress->SetNextOperation(Bstr(tr("Reading")).raw(), 1);
-
- /* Prepare the temporary reading of the OVF */
- ComObjPtr<Progress> progress;
- LocationInfo li;
- li.strPath = strTmpOvf;
- /* Start the reading from the fs */
- rc = readImpl(li, progress);
- if (FAILED(rc)) throw rc;
-
- /* Unlock the appliance for the reading thread */
- appLock.release();
- /* Wait until the reading is done, but report the progress back to the
- caller */
- ComPtr<IProgress> progressInt(progress);
- waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
-
- /* Again lock the appliance for the next steps */
- appLock.acquire();
- }
- catch(HRESULT aRC)
- {
- rc = aRC;
- }
- /* Cleanup */
- RTS3Destroy(hS3);
- /* Delete all files which where temporary created */
- if (RTPathExists(strTmpOvf.c_str()))
- {
- vrc = RTFileDelete(strTmpOvf.c_str());
- if (RT_FAILURE(vrc))
- rc = setError(VBOX_E_FILE_ERROR,
- tr("Cannot delete file '%s' (%Rrc)"), strTmpOvf.c_str(), vrc);
- }
- /* Delete the temporary directory */
- if (RTPathExists(pszTmpDir))
- {
- vrc = RTDirRemove(pszTmpDir);
- if (RT_FAILURE(vrc))
- rc = setError(VBOX_E_FILE_ERROR,
- tr("Cannot delete temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
- }
- if (pszTmpDir)
- RTStrFree(pszTmpDir);
-
- LogFlowFunc(("rc=%Rhrc\n", rc));
- LogFlowFuncLeave();
-
- return rc;
-}
-#endif /* VBOX_WITH_S3 */
/*******************************************************************************
* Import stuff
@@ -1412,199 +1284,6 @@ HRESULT Appliance::importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
return rc;
}
-#ifdef VBOX_WITH_S3
-/**
- * Worker code for importing OVF from the cloud. This is called from Appliance::taskThreadImportOrExport()
- * in S3 mode and therefore runs on the OVF import worker thread. This then starts a second worker
- * thread to import from temporary files (see Appliance::importFS()).
- * @param pTask
- * @return
- */
-HRESULT Appliance::importS3(TaskOVF *pTask)
-{
- LogFlowFuncEnter();
- LogFlowFunc(("Appliance %p\n", this));
-
- AutoCaller autoCaller(this);
- if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
- AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
-
- int vrc = VINF_SUCCESS;
- RTS3 hS3 = NIL_RTS3;
- char szOSTmpDir[RTPATH_MAX];
- RTPathTemp(szOSTmpDir, sizeof(szOSTmpDir));
- /* The template for the temporary directory created below */
- char *pszTmpDir = RTPathJoinA(szOSTmpDir, "vbox-ovf-XXXXXX");
- list< pair<Utf8Str, ULONG> > filesList;
-
- HRESULT rc = S_OK;
- try
- {
- /* Extract the bucket */
- Utf8Str tmpPath = pTask->locInfo.strPath;
- Utf8Str bucket;
- parseBucket(tmpPath, bucket);
-
- /* We need a temporary directory which we can put the all disk images
- * in */
- vrc = RTDirCreateTemp(pszTmpDir);
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot create temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
-
- /* Add every disks of every virtual system to an internal list */
- list< ComObjPtr<VirtualSystemDescription> >::const_iterator it;
- for (it = m->virtualSystemDescriptions.begin();
- it != m->virtualSystemDescriptions.end();
- ++it)
- {
- ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
- std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
- std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
- for (itH = avsdeHDs.begin();
- itH != avsdeHDs.end();
- ++itH)
- {
- const Utf8Str &strTargetFile = (*itH)->strOvf;
- if (!strTargetFile.isEmpty())
- {
- /* The temporary name of the target disk file */
- Utf8StrFmt strTmpDisk("%s/%s", pszTmpDir, RTPathFilename(strTargetFile.c_str()));
- filesList.push_back(pair<Utf8Str, ULONG>(strTmpDisk, (*itH)->ulSizeMB));
- }
- }
- }
-
- /* Next we have to download the disk images */
- vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot create S3 service handler"));
- RTS3SetProgressCallback(hS3, pTask->updateProgress, &pTask);
-
- /* Download all files */
- for (list< pair<Utf8Str, ULONG> >::const_iterator it1 = filesList.begin(); it1 != filesList.end(); ++it1)
- {
- const pair<Utf8Str, ULONG> &s = (*it1);
- const Utf8Str &strSrcFile = s.first;
- /* Construct the source file name */
- char *pszFilename = RTPathFilename(strSrcFile.c_str());
- /* Advance to the next operation */
- if (!pTask->pProgress.isNull())
- pTask->pProgress->SetNextOperation(BstrFmt(tr("Downloading file '%s'"), pszFilename).raw(), s.second);
-
- vrc = RTS3GetKey(hS3, bucket.c_str(), pszFilename, strSrcFile.c_str());
- if (RT_FAILURE(vrc))
- {
- if (vrc == VERR_S3_CANCELED)
- throw S_OK; /* todo: !!!!!!!!!!!!! */
- else if (vrc == VERR_S3_ACCESS_DENIED)
- throw setError(E_ACCESSDENIED,
- tr("Cannot download file '%s' from S3 storage server (Access denied). "
- "Make sure that your credentials are right. Also check that your host clock is properly synced"),
- pszFilename);
- else if (vrc == VERR_S3_NOT_FOUND)
- throw setError(VBOX_E_FILE_ERROR,
- tr("Cannot download file '%s' from S3 storage server (File not found)"),
- pszFilename);
- else
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot download file '%s' from S3 storage server (%Rrc)"),
- pszFilename, vrc);
- }
- }
-
- /* Provide a OVF file (haven't to exist) so the import routine can
- * figure out where the disk images/manifest file are located. */
- Utf8StrFmt strTmpOvf("%s/%s", pszTmpDir, RTPathFilename(tmpPath.c_str()));
- /* Now check if there is an manifest file. This is optional. */
- Utf8Str strManifestFile; //= queryManifestFileName(strTmpOvf);
-// Utf8Str strManifestFile = queryManifestFileName(strTmpOvf);
- char *pszFilename = RTPathFilename(strManifestFile.c_str());
- if (!pTask->pProgress.isNull())
- pTask->pProgress->SetNextOperation(BstrFmt(tr("Downloading file '%s'"), pszFilename).raw(), 1);
-
- /* Try to download it. If the error is VERR_S3_NOT_FOUND, it isn't fatal. */
- vrc = RTS3GetKey(hS3, bucket.c_str(), pszFilename, strManifestFile.c_str());
- if (RT_SUCCESS(vrc))
- filesList.push_back(pair<Utf8Str, ULONG>(strManifestFile, 0));
- else if (RT_FAILURE(vrc))
- {
- if (vrc == VERR_S3_CANCELED)
- throw S_OK; /* todo: !!!!!!!!!!!!! */
- else if (vrc == VERR_S3_NOT_FOUND)
- vrc = VINF_SUCCESS; /* Not found is ok */
- else if (vrc == VERR_S3_ACCESS_DENIED)
- throw setError(E_ACCESSDENIED,
- tr("Cannot download file '%s' from S3 storage server (Access denied)."
- "Make sure that your credentials are right. Also check that your host clock is properly synced"),
- pszFilename);
- else
- throw setError(VBOX_E_IPRT_ERROR,
- tr("Cannot download file '%s' from S3 storage server (%Rrc)"),
- pszFilename, vrc);
- }
-
- /* Close the connection early */
- RTS3Destroy(hS3);
- hS3 = NIL_RTS3;
-
- pTask->pProgress->SetNextOperation(BstrFmt(tr("Importing appliance")).raw(), m->ulWeightForXmlOperation);
-
- ComObjPtr<Progress> progress;
- /* Import the whole temporary OVF & the disk images */
- LocationInfo li;
- li.strPath = strTmpOvf;
- rc = importImpl(li, progress);
- if (FAILED(rc)) throw rc;
-
- /* Unlock the appliance for the fs import thread */
- appLock.release();
- /* Wait until the import is done, but report the progress back to the
- caller */
- ComPtr<IProgress> progressInt(progress);
- waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
-
- /* Again lock the appliance for the next steps */
- appLock.acquire();
- }
- catch(HRESULT aRC)
- {
- rc = aRC;
- }
- /* Cleanup */
- RTS3Destroy(hS3);
- /* Delete all files which where temporary created */
- for (list< pair<Utf8Str, ULONG> >::const_iterator it1 = filesList.begin(); it1 != filesList.end(); ++it1)
- {
- const char *pszFilePath = (*it1).first.c_str();
- if (RTPathExists(pszFilePath))
- {
- vrc = RTFileDelete(pszFilePath);
- if (RT_FAILURE(vrc))
- rc = setError(VBOX_E_FILE_ERROR,
- tr("Cannot delete file '%s' (%Rrc)"), pszFilePath, vrc);
- }
- }
- /* Delete the temporary directory */
- if (RTPathExists(pszTmpDir))
- {
- vrc = RTDirRemove(pszTmpDir);
- if (RT_FAILURE(vrc))
- rc = setError(VBOX_E_FILE_ERROR,
- tr("Cannot delete temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
- }
- if (pszTmpDir)
- RTStrFree(pszTmpDir);
-
- LogFlowFunc(("rc=%Rhrc\n", rc));
- LogFlowFuncLeave();
-
- return rc;
-}
-#endif /* VBOX_WITH_S3 */
-
HRESULT Appliance::readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
{
HRESULT rc = S_OK;
diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp
index aed9ab5..5945c11 100644
--- a/src/VBox/Main/src-server/MachineImpl.cpp
+++ b/src/VBox/Main/src-server/MachineImpl.cpp
@@ -4933,8 +4933,9 @@ HRESULT Machine::deleteTaskWorker(DeleteTask &task)
RTFileDelete(log.c_str());
}
#if defined(RT_OS_WINDOWS)
- log = Utf8StrFmt("%s%cVBoxStartup.log",
- logFolder.c_str(), RTPATH_DELIMITER);
+ log = Utf8StrFmt("%s%cVBoxStartup.log", logFolder.c_str(), RTPATH_DELIMITER);
+ RTFileDelete(log.c_str());
+ log = Utf8StrFmt("%s%cVBoxHardening.log", logFolder.c_str(), RTPATH_DELIMITER);
RTFileDelete(log.c_str());
#endif
@@ -6520,14 +6521,14 @@ Utf8Str Machine::queryLogFilename(ULONG idx)
}
/**
- * Returns the full path to the machine's (hardened) startup log file.
+ * Returns the full path to the machine's hardened log file.
*/
-Utf8Str Machine::i_getStartupLogFilename(void)
+Utf8Str Machine::i_getHardeningLogFilename(void)
{
Utf8Str strFilename;
getLogFolder(strFilename);
Assert(strFilename.length());
- strFilename.append(RTPATH_SLASH_STR "VBoxStartup.log");
+ strFilename.append(RTPATH_SLASH_STR "VBoxHardening.log");
return strFilename;
}
@@ -6669,23 +6670,29 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
RTStrFree(newEnvStr);
}
- /* Hardened startup logging */
+ /* Hardening logging */
#if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_HARDENING)
- Utf8Str strSupStartLogArg("--sup-startup-log=");
+ Utf8Str strSupHardeningLogArg("--sup-hardening-log=");
{
- Utf8Str strStartupLogFile = i_getStartupLogFilename();
- int vrc2 = RTFileDelete(strStartupLogFile.c_str());
+ Utf8Str strHardeningLogFile = i_getHardeningLogFilename();
+ int vrc2 = RTFileDelete(strHardeningLogFile.c_str());
if (vrc2 == VERR_PATH_NOT_FOUND || vrc2 == VERR_FILE_NOT_FOUND)
{
- Utf8Str strStartupLogDir = strStartupLogFile;
+ Utf8Str strStartupLogDir = strHardeningLogFile;
strStartupLogDir.stripFilename();
RTDirCreateFullPath(strStartupLogDir.c_str(), 0755); /** @todo add a variant for creating the path to a file without stripping the file. */
}
- strSupStartLogArg.append(strStartupLogFile);
+ strSupHardeningLogArg.append(strHardeningLogFile);
+
+ /* Remove legacy log filename to avoid confusion. */
+ Utf8Str strOldStartupLogFile;
+ getLogFolder(strOldStartupLogFile);
+ strOldStartupLogFile.append(RTPATH_SLASH_STR "VBoxStartup.log");
+ RTFileDelete(strOldStartupLogFile.c_str());
}
- const char *pszSupStartupLogArg = strSupStartLogArg.c_str();
+ const char *pszSupHardeningLogArg = strSupHardeningLogArg.c_str();
#else
- const char *pszSupStartupLogArg = NULL;
+ const char *pszSupHardeningLogArg = NULL;
#endif
/* Qt is default */
@@ -6707,7 +6714,7 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
"--comment", mUserData->s.strName.c_str(),
"--startvm", idStr.c_str(),
"--no-startvm-errormsgbox",
- pszSupStartupLogArg,
+ pszSupHardeningLogArg,
NULL
};
vrc = RTProcCreate(szPath, apszArgs, env, 0, &pid);
@@ -6732,7 +6739,7 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
szPath,
"--comment", mUserData->s.strName.c_str(),
"--startvm", idStr.c_str(),
- pszSupStartupLogArg,
+ pszSupHardeningLogArg,
NULL
};
vrc = RTProcCreate(szPath, apszArgs, env, 0, &pid);
@@ -6769,13 +6776,13 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
"--startvm", idStr.c_str(),
"--vrde", "config",
0, /* For "--capture". */
- 0, /* For "--sup-startup-log". */
+ 0, /* For "--sup-hardening-log". */
0
};
unsigned iArg = 7;
if (strType == "capture")
apszArgs[iArg++] = "--capture";
- apszArgs[iArg++] = pszSupStartupLogArg;
+ apszArgs[iArg++] = pszSupHardeningLogArg;
# ifdef RT_OS_WINDOWS
vrc = RTProcCreate(szPath, apszArgs, env, RTPROC_FLAGS_NO_WINDOW, &pid);
@@ -7001,11 +7008,11 @@ bool Machine::checkForSpawnFailure()
/* If the startup logfile exists and is of non-zero length, tell the
user to look there for more details to encourage them to attach it
when reporting startup issues. */
- Utf8Str strStartupLogFile = i_getStartupLogFilename();
+ Utf8Str strHardeningLogFile = i_getHardeningLogFilename();
uint64_t cbStartupLogFile = 0;
- int vrc2 = RTFileQuerySize(strStartupLogFile.c_str(), &cbStartupLogFile);
+ int vrc2 = RTFileQuerySize(strHardeningLogFile.c_str(), &cbStartupLogFile);
if (RT_SUCCESS(vrc2) && cbStartupLogFile > 0)
- strExtraInfo.append(Utf8StrFmt(tr(". More details may be available in '%s'"), strStartupLogFile.c_str()));
+ strExtraInfo.append(Utf8StrFmt(tr(". More details may be available in '%s'"), strHardeningLogFile.c_str()));
#endif
if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_NORMAL)
@@ -11889,7 +11896,8 @@ STDMETHODIMP SessionMachine::PullGuestProperties(ComSafeArrayOut(BSTR, aNames),
STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
IN_BSTR aValue,
LONG64 aTimestamp,
- IN_BSTR aFlags)
+ IN_BSTR aFlags,
+ BOOL *aNotify)
{
LogFlow(("aName=%ls, aValue=%ls, aTimestamp=%RI64, aFlags=%ls\n",
aName, aValue, aTimestamp, aFlags));
@@ -11901,6 +11909,8 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
CheckComArgNotNull(aValue);
CheckComArgNotNull(aFlags);
+ *aNotify = FALSE;
+
try
{
/*
@@ -11995,6 +12005,7 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
aName,
aValue,
aFlags);
+ *aNotify = TRUE;
}
}
catch (...)
diff --git a/src/VBox/Main/src-server/VFSExplorerImpl.cpp b/src/VBox/Main/src-server/VFSExplorerImpl.cpp
index e94b722..3e68772 100644
--- a/src/VBox/Main/src-server/VFSExplorerImpl.cpp
+++ b/src/VBox/Main/src-server/VFSExplorerImpl.cpp
@@ -225,11 +225,7 @@ DECLCALLBACK(int) VFSExplorer::TaskVFSExplorer::taskThread(RTTHREAD /* aThread *
if (pVFSExplorer->m->storageType == VFSType_File)
rc = pVFSExplorer->updateFS(task.get());
else if (pVFSExplorer->m->storageType == VFSType_S3)
-#ifdef VBOX_WITH_S3
- rc = pVFSExplorer->updateS3(task.get());
-#else
rc = VERR_NOT_IMPLEMENTED;
-#endif
break;
}
case TaskVFSExplorer::Delete:
@@ -237,11 +233,7 @@ DECLCALLBACK(int) VFSExplorer::TaskVFSExplorer::taskThread(RTTHREAD /* aThread *
if (pVFSExplorer->m->storageType == VFSType_File)
rc = pVFSExplorer->deleteFS(task.get());
else if (pVFSExplorer->m->storageType == VFSType_S3)
-#ifdef VBOX_WITH_S3
- rc = pVFSExplorer->deleteS3(task.get());
-#else
rc = VERR_NOT_IMPLEMENTED;
-#endif
break;
}
default:
@@ -409,138 +401,6 @@ HRESULT VFSExplorer::deleteFS(TaskVFSExplorer *aTask)
return VINF_SUCCESS;
}
-#ifdef VBOX_WITH_S3
-HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
-{
- LogFlowFuncEnter();
-
- AutoCaller autoCaller(this);
- if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
- AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
-
- HRESULT rc = S_OK;
-
- RTS3 hS3 = NULL;
- std::list<VFSExplorer::Data::DirEntry> fileList;
- try
- {
- int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(), m->strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
- if (RT_FAILURE(vrc))
- throw setError(E_FAIL, tr ("Can't open S3 storage service (%Rrc)"), vrc);
-
- RTS3SetProgressCallback(hS3, VFSExplorer::TaskVFSExplorer::uploadProgress, &aTask);
- /* Do we need the list of buckets or keys? */
- if (m->strBucket.isEmpty())
- {
- PCRTS3BUCKETENTRY pBuckets = NULL;
- vrc = RTS3GetBuckets(hS3, &pBuckets);
- if (RT_FAILURE(vrc))
- throw setError(E_FAIL, tr ("Can't get buckets (%Rrc)"), vrc);
-
- PCRTS3BUCKETENTRY pTmpBuckets = pBuckets;
- while (pBuckets)
- {
- /* Set always read/write permissions of the current logged in user. */
- fileList.push_back(VFSExplorer::Data::DirEntry(pBuckets->pszName, VFSFileType_Directory, 0, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
- pBuckets = pBuckets->pNext;
- }
- RTS3BucketsDestroy(pTmpBuckets);
- }
- else
- {
- PCRTS3KEYENTRY pKeys = NULL;
- vrc = RTS3GetBucketKeys(hS3, m->strBucket.c_str(), &pKeys);
- if (RT_FAILURE(vrc))
- throw setError(E_FAIL, tr ("Can't get keys for bucket (%Rrc)"), vrc);
-
- PCRTS3KEYENTRY pTmpKeys = pKeys;
- while (pKeys)
- {
- Utf8Str name(pKeys->pszName);
- /* Set always read/write permissions of the current logged in user. */
- fileList.push_back(VFSExplorer::Data::DirEntry(pKeys->pszName, VFSFileType_File, pKeys->cbFile, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
- pKeys = pKeys->pNext;
- }
- RTS3KeysDestroy(pTmpKeys);
- }
- }
- catch(HRESULT aRC)
- {
- rc = aRC;
- }
-
- if (hS3 != NULL)
- RTS3Destroy(hS3);
-
- /* Assign the result on success (this clears the old list) */
- if (rc == S_OK)
- m->entryList.assign(fileList.begin(), fileList.end());
-
- aTask->rc = rc;
-
- if (!aTask->progress.isNull())
- aTask->progress->notifyComplete(rc);
-
- LogFlowFunc(("rc=%Rhrc\n", rc));
- LogFlowFuncLeave();
-
- return VINF_SUCCESS;
-}
-
-HRESULT VFSExplorer::deleteS3(TaskVFSExplorer *aTask)
-{
- LogFlowFuncEnter();
-
- AutoCaller autoCaller(this);
- if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
- AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
-
- HRESULT rc = S_OK;
-
- RTS3 hS3 = NULL;
- float fPercentStep = 100.0f / aTask->filenames.size();
- try
- {
- int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(), m->strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
- if (RT_FAILURE(vrc))
- throw setError(E_FAIL, tr ("Can't open S3 storage service (%Rrc)"), vrc);
-
- RTS3SetProgressCallback(hS3, VFSExplorer::TaskVFSExplorer::uploadProgress, &aTask);
-
- std::list<Utf8Str>::const_iterator it;
- size_t i = 0;
- for (it = aTask->filenames.begin();
- it != aTask->filenames.end();
- ++it, ++i)
- {
- vrc = RTS3DeleteKey(hS3, m->strBucket.c_str(), (*it).c_str());
- if (RT_FAILURE(vrc))
- throw setError(VBOX_E_FILE_ERROR, tr ("Can't delete file '%s' (%Rrc)"), (*it).c_str(), vrc);
- if (aTask->progress)
- aTask->progress->SetCurrentOperationProgress((ULONG)(fPercentStep * i));
- }
- }
- catch(HRESULT aRC)
- {
- rc = aRC;
- }
-
- aTask->rc = rc;
-
- if (hS3 != NULL)
- RTS3Destroy(hS3);
-
- if (!aTask->progress.isNull())
- aTask->progress->notifyComplete(rc);
-
- LogFlowFunc(("rc=%Rhrc\n", rc));
- LogFlowFuncLeave();
-
- return VINF_SUCCESS;
-}
-#endif /* VBOX_WITH_S3 */
STDMETHODIMP VFSExplorer::Update(IProgress **aProgress)
{
diff --git a/src/VBox/Runtime/Makefile.kmk b/src/VBox/Runtime/Makefile.kmk
index f12f4f9..f590b47 100644
--- a/src/VBox/Runtime/Makefile.kmk
+++ b/src/VBox/Runtime/Makefile.kmk
@@ -1355,9 +1355,6 @@ RuntimeLnxHostR3_INCS := \
#
VBoxRT_TEMPLATE = VBoxR3DllNoPic
VBoxRT_SDKS = VBOX_OPENSSL VBOX_LIBXML2 VBOX_BOOST
-ifdef VBOX_WITH_LIBCURL
- VBoxRT_SDKS += VBOX_LIBCURL
-endif
VBoxRT_SDKS.win = WINPSDK $(VBOX_WINDDK) VBOX_NTDLL
if1of ($(KBUILD_TARGET)$(VBOX_WITH_HARDENING), darwin win$(VBOX_WITH_HARDENING))
VBoxRT_INST = $(INST_DLL) $(INST_TESTCASE)
@@ -1376,9 +1373,6 @@ VBoxRT_SOURCES := \
$(if-expr defined(VBOX_WITH_ALT_HASH_CODE), $(RuntimeR3_SOURCES), \
$(patsubst common/checksum/alt-%,common/checksum/openssl-%,$(RuntimeR3_SOURCES)) ) ) \
common/checksum/crc32-zlib.cpp
-ifdef VBOX_WITH_LIBCURL
- VBoxRT_SOURCES += common/misc/s3.cpp
-endif
VBoxRT_SOURCES.$(KBUILD_TARGET) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET))
VBoxRT_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
VBoxRT_SOURCES.$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_TARGET_ARCH))
diff --git a/src/VBox/Runtime/common/crypto/tsp-template.h b/src/VBox/Runtime/common/crypto/tsp-template.h
index 8499f3c..6ca057a 100644
--- a/src/VBox/Runtime/common/crypto/tsp-template.h
+++ b/src/VBox/Runtime/common/crypto/tsp-template.h
@@ -59,15 +59,15 @@ RTASN1TMPL_END_SEQCORE();
#define RTASN1TMPL_EXT_NAME RTCrTspAccuracy
#define RTASN1TMPL_INT_NAME rtCrTspAccuracy
RTASN1TMPL_BEGIN_SEQCORE();
-RTASN1TMPL_MEMBER_EX( Seconds, RTASN1INTEGER, RTAsn1Integer,
- RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Millis, 1, UINT64_MAX, RT_NOTHING));
+RTASN1TMPL_MEMBER_OPT_ITAG_EX( Seconds, RTASN1INTEGER, RTAsn1Integer, ASN1_TAG_INTEGER, RTASN1TMPL_ITAG_F_UP,
+ RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Seconds, 0, UINT64_MAX, RT_NOTHING));
/** @todo The Millis and Micros fields makes no sense if Seconds > 1, while the
* Micros field makes no sense with Millis > 1. Add constraints
* expressing this dependency. */
RTASN1TMPL_MEMBER_OPT_ITAG_EX( Millis, RTASN1INTEGER, RTAsn1Integer, 0, RTASN1TMPL_ITAG_F_CP,
RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Millis, 1, 999, RT_NOTHING));
RTASN1TMPL_MEMBER_OPT_ITAG_EX( Micros, RTASN1INTEGER, RTAsn1Integer, 1, RTASN1TMPL_ITAG_F_CP,
- RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Millis, 1, 999, RT_NOTHING));
+ RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Micros, 1, 999, RT_NOTHING));
RTASN1TMPL_END_SEQCORE();
#undef RTASN1TMPL_TYPE
#undef RTASN1TMPL_EXT_NAME
diff --git a/src/VBox/Runtime/common/crypto/x509-core.cpp b/src/VBox/Runtime/common/crypto/x509-core.cpp
index 3b5c511..86b8212 100644
--- a/src/VBox/Runtime/common/crypto/x509-core.cpp
+++ b/src/VBox/Runtime/common/crypto/x509-core.cpp
@@ -1250,7 +1250,8 @@ RTDECL(bool) RTCrX509GeneralSubtree_ConstraintMatch(PCRTCRX509GENERALSUBTREE pCo
static void rtCrx509TbsCertificate_AddKeyUsageFlags(PRTCRX509TBSCERTIFICATE pThis, PCRTCRX509EXTENSION pExtension)
{
AssertReturnVoid(pExtension->enmValue == RTCRX509EXTENSIONVALUE_BIT_STRING);
- AssertReturnVoid(pExtension->ExtnValue.pEncapsulated->cb <= 2);
+ /* 3 = 1 byte for unused bit count, followed by one or two bytes containing actual bits. RFC-5280 defines bits 0 thru 8. */
+ AssertReturnVoid(pExtension->ExtnValue.pEncapsulated->cb <= 3);
pThis->T3.fKeyUsage |= (uint32_t)RTAsn1BitString_GetAsUInt64((PCRTASN1BITSTRING)pExtension->ExtnValue.pEncapsulated);
}
diff --git a/src/VBox/Runtime/common/ldr/ldrPE.cpp b/src/VBox/Runtime/common/ldr/ldrPE.cpp
index f55ede4..ac9abee 100644
--- a/src/VBox/Runtime/common/ldr/ldrPE.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrPE.cpp
@@ -3477,7 +3477,7 @@ static int rtldrPEValidateDirectoriesAndRememberStuff(PRTLDRMODPE pModPe, const
Log(("rtldrPEOpen: %s: load cfg dir: Header (%d) and directory (%d) size mismatch, applying the ATI kludge\n",
pszLogName, u.Cfg64.Size, Dir.Size));
Dir.Size = u.Cfg64.Size;
- memset(&u.Cfg64, 0, sizeof(u.Cfg64));
+ RT_ZERO(u.Cfg64);
rc = rtldrPEReadRVA(pModPe, &u.Cfg64, Dir.Size, Dir.VirtualAddress);
if (RT_FAILURE(rc))
return rc;
@@ -3487,7 +3487,21 @@ static int rtldrPEValidateDirectoriesAndRememberStuff(PRTLDRMODPE pModPe, const
/* Kludge #2, ntdll.dll from XP seen with Dir.Size=0x40 and Cfg64.Size=0x00. */
if (Dir.Size == 0x40 && u.Cfg64.Size == 0x00 && !pModPe->f64Bit)
{
+ Log(("rtldrPEOpen: %s: load cfg dir: Header (%d) and directory (%d) size mismatch, applying the XP kludge\n",
+ pszLogName, u.Cfg64.Size, Dir.Size));
u.Cfg64.Size = 0x40;
+ }
+
+ /* Kludge #3, imagehlp.dll from W10/32 seen with Dir.Size=0x40 (V1) and Cfg64.Size=0x68 (V3). */
+ if (Dir.Size == 0x40 && u.Cfg64.Size == 0x68 && !pModPe->f64Bit)
+ {
+ Log(("rtldrPEOpen: %s: load cfg dir: Header (%d) and directory (%d) size mismatch, applying the W10/32 kludge\n",
+ pszLogName, u.Cfg64.Size, Dir.Size));
+ Dir.Size = u.Cfg64.Size;
+ RT_ZERO(u.Cfg64);
+ rc = rtldrPEReadRVA(pModPe, &u.Cfg64, Dir.Size, Dir.VirtualAddress);
+ if (RT_FAILURE(rc))
+ return rc;
rtldrPEConvert32BitLoadConfigTo64Bit(&u.Cfg64);
}
@@ -3597,11 +3611,10 @@ static int rtldrPEValidateDirectoriesAndRememberStuff(PRTLDRMODPE pModPe, const
} while (off < Dir.Size);
}
RTMemTmpFree(pFirst);
- if (RT_FAILURE(rc))
+ if (RT_FAILURE(rc) && !(fFlags & RTLDR_O_FOR_DEBUG))
return rc;
}
-
return VINF_SUCCESS;
}
diff --git a/src/VBox/Runtime/common/misc/s3.cpp b/src/VBox/Runtime/common/misc/s3.cpp
deleted file mode 100644
index 0f5de22..0000000
--- a/src/VBox/Runtime/common/misc/s3.cpp
+++ /dev/null
@@ -1,998 +0,0 @@
-/* $Id: s3.cpp $ */
-/** @file
- * IPRT - S3 communication API.
- */
-
-/*
- * Copyright (C) 2009 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-
-/*******************************************************************************
-* Header Files *
-*******************************************************************************/
-#include <iprt/s3.h>
-#include "internal/iprt.h"
-
-#include <iprt/err.h>
-#include <iprt/mem.h>
-#include <iprt/string.h>
-#include <iprt/base64.h>
-#include <iprt/file.h>
-#include <iprt/stream.h>
-
-#include <curl/curl.h>
-#include <openssl/hmac.h>
-#include <libxml/parser.h>
-
-#include "internal/magics.h"
-
-
-/*******************************************************************************
-* Structures and Typedefs *
-*******************************************************************************/
-typedef struct RTS3INTERNAL
-{
- uint32_t u32Magic;
- CURL *pCurl;
- char *pszAccessKey;
- char *pszSecretKey;
- char *pszBaseUrl;
- char *pszUserAgent;
-
- PFNRTS3PROGRESS pfnProgressCallback;
- void *pvUser;
-
- long lLastResp;
-} RTS3INTERNAL;
-typedef RTS3INTERNAL* PRTS3INTERNAL;
-
-typedef struct RTS3TMPMEMCHUNK
-{
- char *pszMem;
- size_t cSize;
-} RTS3TMPMEMCHUNK;
-typedef RTS3TMPMEMCHUNK *PRTS3TMPMEMCHUNK;
-
-
-/*******************************************************************************
-* Defined Constants And Macros *
-*******************************************************************************/
-
-/** Validates a handle and returns VERR_INVALID_HANDLE if not valid. */
-#define RTS3_VALID_RETURN_RC(hS3, rc) \
- do { \
- AssertPtrReturn((hS3), (rc)); \
- AssertReturn((hS3)->u32Magic == RTS3_MAGIC, (rc)); \
- } while (0)
-
-/** Validates a handle and returns VERR_INVALID_HANDLE if not valid. */
-#define RTS3_VALID_RETURN(hS3) RTS3_VALID_RETURN_RC((hS3), VERR_INVALID_HANDLE)
-
-/** Validates a handle and returns (void) if not valid. */
-#define RTS3_VALID_RETURN_VOID(hS3) \
- do { \
- AssertPtrReturnVoid(hS3); \
- AssertReturnVoid((hS3)->u32Magic == RTS3_MAGIC); \
- } while (0)
-
-
-/*******************************************************************************
-* Private RTS3 helper *
-*******************************************************************************/
-
-static char* rtS3Host(const char* pszBucket, const char* pszKey, const char* pszBaseUrl)
-{
- char* pszUrl;
- /* Host header entry */
- if (pszBucket[0] == 0)
- RTStrAPrintf(&pszUrl, "%s", pszBaseUrl);
- else if (pszKey[0] == 0)
- RTStrAPrintf(&pszUrl, "%s.%s", pszBucket, pszBaseUrl);
- else
- RTStrAPrintf(&pszUrl, "%s.%s/%s", pszBucket, pszBaseUrl, pszKey);
- return pszUrl;
-}
-
-static char* rtS3HostHeader(const char* pszBucket, const char* pszBaseUrl)
-{
- char* pszUrl;
- /* Host header entry */
- if (pszBucket[0] != 0)
- RTStrAPrintf(&pszUrl, "Host: %s.%s", pszBucket, pszBaseUrl);
- else
- RTStrAPrintf(&pszUrl, "Host: %s", pszBaseUrl);
- return pszUrl;
-}
-
-static char* rtS3DateHeader()
-{
- /* Date header entry */
- time_t tt = time(NULL);
- char* pszDate = (char*)RTMemAlloc(128);
- strftime(pszDate, 128, "Date: %a, %d %b %Y %H:%M:%S UTC", gmtime(&tt));
-
- return pszDate;
-}
-
-static char* rtS3ParseHeaders(char** ppHeaders, size_t cHeadEnts)
-{
- char pszEmpty[] = "";
- char *pszRes = NULL;
- char *pszDate = pszEmpty;
- char *pszType = pszEmpty;
- for(size_t i=0; i < cHeadEnts; ++i)
- {
- if(ppHeaders[i] != NULL)
- {
- if (RTStrStr(ppHeaders[i], "Date: ") == ppHeaders[i])
- {
- pszDate = &(ppHeaders[i][6]);
- }
- else if(RTStrStr(ppHeaders[i], "Content-Type: ") == ppHeaders[i])
- {
- pszType = &(ppHeaders[i][14]);
-// char *pszTmp = RTStrDup (&(ppHeaders[i][14]));
-// if (pszRes)
-// {
-// char *pszTmp1 = pszRes;
-// RTStrAPrintf(&pszRes, "%s\n%s", pszRes, pszTmp);
-// RTStrFree(pszTmp);
-// RTStrFree(pszTmp1);
-// }
-// else
-// pszRes = pszTmp;
- }
- }
- }
- RTStrAPrintf(&pszRes, "\n%s\n%s", pszType, pszDate);
- return pszRes;
-}
-
-static char* rtS3Canonicalize(const char* pszAction, const char* pszBucket, const char* pszKey, char** papszHeadEnts, size_t cHeadEnts)
-{
- char* pszRes;
- /* Grep the necessary info out of the headers & put them in a string */
- char* pszHead = rtS3ParseHeaders(papszHeadEnts, cHeadEnts);
- /* Create the string which will be used as signature */
- RTStrAPrintf(&pszRes, "%s\n%s\n/",
- pszAction,
- pszHead);
- RTStrFree(pszHead);
- /* Add the bucket if the bucket isn't empty */
- if (pszBucket[0] != 0)
- {
- char* pszTmp = pszRes;
- RTStrAPrintf(&pszRes, "%s%s/", pszRes, pszBucket);
- RTStrFree(pszTmp);
- }
- /* Add the key if the key isn't empty. */
- if (pszKey[0] != 0)
- {
- char* pszTmp = pszRes;
- RTStrAPrintf(&pszRes, "%s%s", pszRes, pszKey);
- RTStrFree(pszTmp);
- }
-
- return pszRes;
-}
-
-static char* rtS3CreateSignature(PRTS3INTERNAL pS3Int, const char* pszAction, const char* pszBucket, const char* pszKey,
- char** papszHeadEnts, size_t cHeadEnts)
-{
- /* Create a string we can sign */
- char* pszSig = rtS3Canonicalize(pszAction, pszBucket, pszKey, papszHeadEnts, cHeadEnts);
-// printf ("Sig %s\n", pszSig);
- /* Sign the string by creating a SHA1 finger print */
- char pszSigEnc[1024];
- unsigned int cSigEnc = sizeof(pszSigEnc);
- HMAC(EVP_sha1(), pS3Int->pszSecretKey, (int)strlen(pS3Int->pszSecretKey),
- (const unsigned char*)pszSig, strlen(pszSig),
- (unsigned char*)pszSigEnc, &cSigEnc);
- RTStrFree(pszSig);
- /* Convert the signature to Base64 */
- size_t cSigBase64Enc = RTBase64EncodedLength(cSigEnc) + 1; /* +1 for the 0 */
- char *pszSigBase64Enc = (char*)RTMemAlloc(cSigBase64Enc);
- size_t cRes;
- RTBase64Encode(pszSigEnc, cSigEnc, pszSigBase64Enc, cSigBase64Enc, &cRes);
-
- return pszSigBase64Enc;
-}
-
-static char* rtS3CreateAuthHeader(PRTS3INTERNAL pS3Int, const char* pszAction, const char* pszBucket, const char* pszKey,
- char** papszHeadEnts, size_t cHeadEnts)
-{
- char *pszAuth;
- /* Create a signature out of the header & the bucket/key info */
- char *pszSigBase64Enc = rtS3CreateSignature(pS3Int, pszAction, pszBucket, pszKey, papszHeadEnts, cHeadEnts);
- /* Create the authorization header entry */
- RTStrAPrintf(&pszAuth, "Authorization: AWS %s:%s",
- pS3Int->pszAccessKey,
- pszSigBase64Enc);
- RTStrFree(pszSigBase64Enc);
- return pszAuth;
-}
-
-static int rtS3Perform(PRTS3INTERNAL pS3Int)
-{
- int rc = VERR_INTERNAL_ERROR;
- CURLcode code = curl_easy_perform(pS3Int->pCurl);
- if (code == CURLE_OK)
- {
- curl_easy_getinfo(pS3Int->pCurl, CURLINFO_RESPONSE_CODE, &pS3Int->lLastResp);
- switch (pS3Int->lLastResp)
- {
- case 200:
- case 204: rc = VINF_SUCCESS; break; /* No content */
- case 403: rc = VERR_S3_ACCESS_DENIED; break; /* Access denied */
- case 404: rc = VERR_S3_NOT_FOUND; break; /* Site not found */
- }
- }else
- {
- switch(code)
- {
- case CURLE_URL_MALFORMAT:
- case CURLE_COULDNT_RESOLVE_HOST:
-#if defined(CURLE_REMOTE_FILE_NOT_FOUND)
- case CURLE_REMOTE_FILE_NOT_FOUND: rc = VERR_S3_NOT_FOUND; break;
-#elif defined(CURLE_FILE_COULDNT_READ_FILE)
- case CURLE_FILE_COULDNT_READ_FILE: rc = VERR_S3_NOT_FOUND; break;
-#endif
-#if defined(CURLE_REMOTE_ACCESS_DENIED)
- case CURLE_REMOTE_ACCESS_DENIED: rc = VERR_S3_ACCESS_DENIED; break;
-#elif defined(CURLE_FTP_ACCESS_DENIED)
- case CURLE_FTP_ACCESS_DENIED: rc = VERR_S3_ACCESS_DENIED; break;
-#endif
- case CURLE_ABORTED_BY_CALLBACK: rc = VERR_S3_CANCELED; break;
- default: break;
- }
- }
- return rc;
-}
-
-static size_t rtS3WriteNothingCallback(void *pvBuf, size_t cSize, size_t cBSize, void *pvUser)
-{
- return cSize*cBSize;
-}
-
-static size_t rtS3WriteMemoryCallback(void *pvBuf, size_t cSize, size_t cBSize, void *pvUser)
-{
- PRTS3TMPMEMCHUNK pTmpMem = (PRTS3TMPMEMCHUNK)pvUser;
- size_t cRSize = cSize * cBSize;
-
- pTmpMem->pszMem = (char*)RTMemRealloc(pTmpMem->pszMem, pTmpMem->cSize + cRSize + 1);
- if (pTmpMem->pszMem)
- {
- memcpy(&(pTmpMem->pszMem[pTmpMem->cSize]), pvBuf, cRSize);
- pTmpMem->cSize += cRSize;
- pTmpMem->pszMem[pTmpMem->cSize] = 0;
- }
- return cRSize;
-}
-
-static size_t rtS3WriteFileCallback(void *pvBuf, size_t cSize, size_t cBSize, void *pvUser)
-{
- size_t cWritten;
- RTFileWrite(*(RTFILE*)pvUser, pvBuf, cSize * cBSize, &cWritten);
- return cWritten;
-}
-
-static size_t rtS3ReadFileCallback(void *pvBuf, size_t cSize, size_t cBSize, void *pvUser)
-{
- size_t cRead;
- RTFileRead(*(RTFILE*)pvUser, pvBuf, cSize * cBSize, &cRead);
-
- return cRead;
-}
-
-static int rtS3ProgressCallback(void *pvUser, double dDlTotal, double dDlNow, double dUlTotal, double dUlNow)
-{
- if (pvUser)
- {
- PRTS3INTERNAL pS3Int = (PRTS3INTERNAL)pvUser;
- if (pS3Int->pfnProgressCallback)
- {
- int rc = VINF_SUCCESS;
- if (dDlTotal > 0)
- rc = pS3Int->pfnProgressCallback((unsigned)(100.0/dDlTotal*dDlNow), pS3Int->pvUser);
- else if (dUlTotal > 0)
- rc = pS3Int->pfnProgressCallback((unsigned)(100.0/dUlTotal*dUlNow), pS3Int->pvUser);
- if (rc != VINF_SUCCESS)
- return -1;
- }
- }
- return CURLE_OK;
-}
-
-static void rtS3ReinitCurl(PRTS3INTERNAL pS3Int)
-{
- if (pS3Int &&
- pS3Int->pCurl)
- {
- /* Reset the CURL object to an defined state */
- curl_easy_reset(pS3Int->pCurl);
- /* Make sure HTTP 1.1 is used */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
- /* We are cool we are a user agent now */
- if (pS3Int->pszUserAgent)
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_USERAGENT, pS3Int->pszUserAgent);
- /* Check if the user has a progress callback requested */
- if (pS3Int->pfnProgressCallback)
- {
- /* Yes, we are willing to receive progress info */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_NOPROGRESS, 0);
- /* Callback for the progress info */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_PROGRESSFUNCTION, rtS3ProgressCallback);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_PROGRESSDATA, pS3Int);
- }
- /* Disable the internal cURL write function by providing one which does
- * nothing */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEFUNCTION, rtS3WriteNothingCallback);
- /* Set this do get some verbose info what CURL is doing */
-// curl_easy_setopt(pS3Int->pCurl, CURLOPT_VERBOSE, 1);
- }
-}
-
-/*******************************************************************************
-* Private XML helper *
-*******************************************************************************/
-
-static xmlNodePtr rtS3FindNode(xmlNodePtr pNode, const char *pszName)
-{
- pNode = pNode->xmlChildrenNode;
- while (pNode != NULL)
- {
- /* Check this level. */
- if (!xmlStrcmp(pNode->name, (const xmlChar *)pszName))
- return pNode;
-
- /* Recursively check the children of this node. */
- xmlNodePtr pChildNode = rtS3FindNode(pNode, pszName);
- if (pChildNode != NULL)
- return pChildNode;
-
- /* Next node. */
- pNode = pNode->next;
- }
- return pNode;
-}
-
-static int rtS3ReadXmlFromMemory(PRTS3TMPMEMCHUNK pChunk, const char* pszRootElement, xmlDocPtr *ppDoc, xmlNodePtr *ppCur)
-{
- *ppDoc = xmlReadMemory(pChunk->pszMem, (int)pChunk->cSize, "", "ISO-8859-1", XML_PARSE_NOBLANKS | XML_PARSE_NONET);
- if (*ppDoc == NULL)
- return VERR_PARSE_ERROR;
-
- *ppCur = xmlDocGetRootElement(*ppDoc);
- if (*ppCur == NULL)
- {
- xmlFreeDoc(*ppDoc);
- return VERR_PARSE_ERROR;
- }
- if (xmlStrcmp((*ppCur)->name, (const xmlChar *) pszRootElement))
- {
- xmlFreeDoc(*ppDoc);
- return VERR_PARSE_ERROR;
- }
- return VINF_SUCCESS;
-}
-
-static void rtS3ExtractAllBuckets(xmlDocPtr pDoc, xmlNodePtr pNode, PCRTS3BUCKETENTRY *ppBuckets)
-{
- pNode = rtS3FindNode(pNode, "Buckets");
- if (pNode != NULL)
- {
- PRTS3BUCKETENTRY pPrevBucket = NULL;
- xmlNodePtr pCurBucket = pNode->xmlChildrenNode;
- while (pCurBucket != NULL)
- {
- if ((!xmlStrcmp(pCurBucket->name, (const xmlChar *)"Bucket")))
- {
- PRTS3BUCKETENTRY pBucket = (PRTS3BUCKETENTRY)RTMemAllocZ(sizeof(RTS3BUCKETENTRY));
- pBucket->pPrev = pPrevBucket;
- if (pPrevBucket)
- pPrevBucket->pNext = pBucket;
- else
- (*ppBuckets) = pBucket;
- pPrevBucket = pBucket;
- xmlNodePtr pCurCont = pCurBucket->xmlChildrenNode;
- while (pCurCont != NULL)
- {
- if ((!xmlStrcmp(pCurCont->name, (const xmlChar *)"Name")))
- {
- xmlChar *pszKey = xmlNodeListGetString(pDoc, pCurCont->xmlChildrenNode, 1);
- pBucket->pszName = RTStrDup((const char*)pszKey);
- xmlFree(pszKey);
- }
- if ((!xmlStrcmp(pCurCont->name, (const xmlChar*)"CreationDate")))
- {
- xmlChar *pszKey = xmlNodeListGetString(pDoc, pCurCont->xmlChildrenNode, 1);
- pBucket->pszCreationDate = RTStrDup((const char*)pszKey);
- xmlFree(pszKey);
- }
- pCurCont = pCurCont->next;
- }
- }
- pCurBucket = pCurBucket->next;
- }
- }
-}
-
-static void rtS3ExtractAllKeys(xmlDocPtr pDoc, xmlNodePtr pNode, PCRTS3KEYENTRY *ppKeys)
-{
- if (pNode != NULL)
- {
- PRTS3KEYENTRY pPrevKey = NULL;
- xmlNodePtr pCurKey = pNode->xmlChildrenNode;
- while (pCurKey != NULL)
- {
- if ((!xmlStrcmp(pCurKey->name, (const xmlChar *)"Contents")))
- {
- PRTS3KEYENTRY pKey = (PRTS3KEYENTRY)RTMemAllocZ(sizeof(RTS3KEYENTRY));
- pKey->pPrev = pPrevKey;
- if (pPrevKey)
- pPrevKey->pNext = pKey;
- else
- (*ppKeys) = pKey;
- pPrevKey = pKey;
- xmlNodePtr pCurCont = pCurKey->xmlChildrenNode;
- while (pCurCont != NULL)
- {
- if ((!xmlStrcmp(pCurCont->name, (const xmlChar *)"Key")))
- {
- xmlChar *pszKey = xmlNodeListGetString(pDoc, pCurCont->xmlChildrenNode, 1);
- pKey->pszName = RTStrDup((const char*)pszKey);
- xmlFree(pszKey);
- }
- if ((!xmlStrcmp(pCurCont->name, (const xmlChar*)"LastModified")))
- {
- xmlChar *pszKey = xmlNodeListGetString(pDoc, pCurCont->xmlChildrenNode, 1);
- pKey->pszLastModified = RTStrDup((const char*)pszKey);
- xmlFree(pszKey);
- }
- if ((!xmlStrcmp(pCurCont->name, (const xmlChar*)"Size")))
- {
- xmlChar *pszKey = xmlNodeListGetString(pDoc, pCurCont->xmlChildrenNode, 1);
- pKey->cbFile = RTStrToUInt64((const char*)pszKey);
- xmlFree(pszKey);
- }
- pCurCont = pCurCont->next;
- }
- }
- pCurKey = pCurKey->next;
- }
- }
-}
-
-/*******************************************************************************
-* Public RTS3 interface *
-*******************************************************************************/
-
-RTR3DECL(int) RTS3Create(PRTS3 ppS3, const char* pszAccessKey, const char* pszSecretKey, const char* pszBaseUrl, const char* pszUserAgent /* = NULL */)
-{
- AssertPtrReturn(ppS3, VERR_INVALID_POINTER);
-
- /* We need at least an URL to connect with */
- if (pszBaseUrl == NULL ||
- pszBaseUrl[0] == 0)
- return VERR_INVALID_PARAMETER;
-
- /* In windows, this will init the winsock stuff */
- if (curl_global_init(CURL_GLOBAL_ALL) != 0)
- return VERR_INTERNAL_ERROR;
-
- CURL* pCurl = curl_easy_init();
- if (!pCurl)
- return VERR_INTERNAL_ERROR;
-
- PRTS3INTERNAL pS3Int = (PRTS3INTERNAL)RTMemAllocZ(sizeof(RTS3INTERNAL));
- if (pS3Int == NULL)
- return VERR_NO_MEMORY;
-
- pS3Int->u32Magic = RTS3_MAGIC;
- pS3Int->pCurl = pCurl;
- pS3Int->pszAccessKey = RTStrDup(pszAccessKey);
- pS3Int->pszSecretKey = RTStrDup(pszSecretKey);
- pS3Int->pszBaseUrl = RTStrDup(pszBaseUrl);
- if (pszUserAgent)
- pS3Int->pszUserAgent = RTStrDup(pszUserAgent);
-
- *ppS3 = (RTS3)pS3Int;
-
- return VINF_SUCCESS;
-}
-
-RTR3DECL(void) RTS3Destroy(RTS3 hS3)
-{
- if (hS3 == NIL_RTS3)
- return;
-
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN_VOID(pS3Int);
-
- curl_easy_cleanup(pS3Int->pCurl);
-
- pS3Int->u32Magic = RTS3_MAGIC_DEAD;
-
- if (pS3Int->pszUserAgent)
- RTStrFree(pS3Int->pszUserAgent);
- RTStrFree(pS3Int->pszBaseUrl);
- RTStrFree(pS3Int->pszSecretKey);
- RTStrFree(pS3Int->pszAccessKey);
-
- RTMemFree(pS3Int);
-
- curl_global_cleanup();
-}
-
-RTR3DECL(void) RTS3SetProgressCallback(RTS3 hS3, PFNRTS3PROGRESS pfnProgressCallback, void *pvUser /* = NULL */)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN_VOID(pS3Int);
-
- pS3Int->pfnProgressCallback = pfnProgressCallback;
- pS3Int->pvUser = pvUser;
-}
-
-RTR3DECL(int) RTS3GetBuckets(RTS3 hS3, PCRTS3BUCKETENTRY *ppBuckets)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- /* Properly initialize this */
- *ppBuckets = NULL;
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
- /* Create the CURL object to operate on */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pS3Int->pszBaseUrl);
-
- /* Create the three basic header entries */
- char *apszHead[3] =
- {
- rtS3HostHeader("", pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "GET", "", "", apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- RTS3TMPMEMCHUNK chunk = { NULL, 0 };
- /* Set the callback which receive the content */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEFUNCTION, rtS3WriteMemoryCallback);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEDATA, (void *)&chunk);
- /* Start the request */
- int rc = rtS3Perform(pS3Int);
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- /* On success parse the result */
- if (RT_SUCCESS(rc))
- {
- xmlDocPtr pDoc;
- xmlNodePtr pCur;
- /* Parse the xml memory for "ListAllMyBucketsResult" */
- rc = rtS3ReadXmlFromMemory(&chunk, "ListAllMyBucketsResult", &pDoc, &pCur);
- if (RT_SUCCESS(rc))
- {
- /* Now extract all buckets */
- rtS3ExtractAllBuckets(pDoc, pCur, ppBuckets);
- /* Free the xml stuff */
- xmlFreeDoc(pDoc);
- }
- }
- /* Free the temporary memory */
- RTMemFree(chunk.pszMem);
-
- return rc;
-}
-
-RTR3DECL(int) RTS3BucketsDestroy(PCRTS3BUCKETENTRY pBuckets)
-{
- if (!pBuckets)
- return VINF_SUCCESS;
-
- while (pBuckets)
- {
- PCRTS3BUCKETENTRY pTemp = pBuckets;
- RTStrFree((char*)pBuckets->pszName);
- RTStrFree((char*)pBuckets->pszCreationDate);
- pBuckets = pBuckets->pNext;
- RTMemFree((PRTS3BUCKETENTRY )pTemp);
- }
- return VINF_SUCCESS;
-}
-
-RTR3DECL(int) RTS3CreateBucket(RTS3 hS3, const char* pszBucketName)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
-
- char* pszUrl = rtS3Host(pszBucketName, "", pS3Int->pszBaseUrl);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pszUrl);
- RTStrFree(pszUrl);
-
- /* Create the basic header entries */
- char *apszHead[4] =
- {
- RTStrDup("Content-Length: 0"), /* Content length entry */
- rtS3HostHeader(pszBucketName, pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "PUT", pszBucketName, "", apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- /* Set CURL in upload mode */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_PUT, 1);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_UPLOAD, 1);
-
- /* Set the size of the file we like to transfer */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_INFILESIZE_LARGE, 0);
-
- /* Start the request */
- int rc = rtS3Perform(pS3Int);
- if (RT_FAILURE(rc))
- {
- /* Handle special failures */
- if (pS3Int->lLastResp == 409)
- rc = VERR_S3_BUCKET_ALREADY_EXISTS;
- }
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- return rc;
-}
-
-RTR3DECL(int) RTS3DeleteBucket(RTS3 hS3, const char* pszBucketName)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
-
- char* pszUrl = rtS3Host(pszBucketName, "", pS3Int->pszBaseUrl);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pszUrl);
- RTStrFree(pszUrl);
-
- /* Create the three basic header entries */
- char *apszHead[3] =
- {
- rtS3HostHeader(pszBucketName, pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "DELETE", pszBucketName, "", apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- /* Set CURL in delete mode */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_CUSTOMREQUEST, "DELETE");
-
- /* Start the request */
- int rc = rtS3Perform(pS3Int);
- if (RT_FAILURE(rc))
- {
- /* Handle special failures */
- if (pS3Int->lLastResp == 409)
- rc = VERR_S3_BUCKET_NOT_EMPTY;
- }
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- return rc;
-}
-
-RTR3DECL(int) RTS3GetBucketKeys(RTS3 hS3, const char* pszBucketName, PCRTS3KEYENTRY *ppKeys)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- *ppKeys = NULL;
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
-
- char* pszUrl = rtS3Host(pszBucketName, "", pS3Int->pszBaseUrl);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pszUrl);
- RTStrFree(pszUrl);
-
- /* Create the three basic header entries */
- char *apszHead[3] =
- {
- rtS3HostHeader(pszBucketName, pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "GET", pszBucketName, "", apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- RTS3TMPMEMCHUNK chunk = { NULL, 0 };
- /* Set the callback which receive the content */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEFUNCTION, rtS3WriteMemoryCallback);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEDATA, (void *)&chunk);
-
- /* Start the request */
- int rc = rtS3Perform(pS3Int);
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- /* On success parse the result */
- if (RT_SUCCESS(rc))
- {
- xmlDocPtr pDoc;
- xmlNodePtr pCur;
- /* Parse the xml memory for "ListBucketResult" */
- rc = rtS3ReadXmlFromMemory(&chunk, "ListBucketResult", &pDoc, &pCur);
- if (RT_SUCCESS(rc))
- {
- /* Now extract all buckets */
- rtS3ExtractAllKeys(pDoc, pCur, ppKeys);
- /* Free the xml stuff */
- xmlFreeDoc(pDoc);
- }
- }
- /* Free the temporary memory */
- RTMemFree(chunk.pszMem);
-
- return rc;
-}
-
-RTR3DECL(int) RTS3KeysDestroy(PCRTS3KEYENTRY pKeys)
-{
- if (!pKeys)
- return VINF_SUCCESS;
-
- while (pKeys)
- {
- PCRTS3KEYENTRY pTemp = pKeys;
- RTStrFree((char*)pKeys->pszName);
- RTStrFree((char*)pKeys->pszLastModified);
- pKeys = pKeys->pNext;
- RTMemFree((PRTS3KEYENTRY)pTemp);
- }
- return VINF_SUCCESS;
-}
-
-RTR3DECL(int) RTS3DeleteKey(RTS3 hS3, const char* pszBucketName, const char* pszKeyName)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
-
- char* pszUrl = rtS3Host(pszBucketName, pszKeyName, pS3Int->pszBaseUrl);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pszUrl);
- RTStrFree(pszUrl);
-
- /* Create the three basic header entries */
- char *apszHead[3] =
- {
- rtS3HostHeader(pszBucketName, pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "DELETE", pszBucketName, pszKeyName, apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- /* Set CURL in delete mode */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_CUSTOMREQUEST, "DELETE");
-
- /* Start the request */
- int rc = rtS3Perform(pS3Int);
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- return rc;
-}
-
-RTR3DECL(int) RTS3GetKey(RTS3 hS3, const char *pszBucketName, const char *pszKeyName, const char *pszFilename)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
-
- /* Open the file */
- RTFILE hFile;
- int rc = RTFileOpen(&hFile, pszFilename, RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
- if (RT_FAILURE(rc))
- return rc;
-
- char* pszUrl = rtS3Host(pszBucketName, pszKeyName, pS3Int->pszBaseUrl);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pszUrl);
- RTStrFree(pszUrl);
-
- /* Create the three basic header entries */
- char *apszHead[3] =
- {
- rtS3HostHeader(pszBucketName, pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "GET", pszBucketName, pszKeyName, apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- /* Set the callback which receive the content */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEFUNCTION, rtS3WriteFileCallback);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_WRITEDATA, &hFile);
-
- /* Start the request */
- rc = rtS3Perform(pS3Int);
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- /* Close the open file */
- RTFileClose(hFile);
-
- /* If there was an error delete the newly created file */
- if (RT_FAILURE(rc))
- RTFileDelete(pszFilename);
-
- return rc;
-}
-
-RTR3DECL(int) RTS3PutKey(RTS3 hS3, const char *pszBucketName, const char *pszKeyName, const char *pszFilename)
-{
- PRTS3INTERNAL pS3Int = hS3;
- RTS3_VALID_RETURN(pS3Int);
-
- /* Reset the CURL object to an defined state */
- rtS3ReinitCurl(pS3Int);
-
- /* Open the file */
- RTFILE hFile;
- int rc = RTFileOpen(&hFile, pszFilename, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
- if (RT_FAILURE(rc))
- return rc;
-
- uint64_t cbFileSize;
- rc = RTFileGetSize(hFile, &cbFileSize);
- if (RT_FAILURE(rc))
- {
- RTFileClose(hFile);
- return rc;
- }
-
- char* pszUrl = rtS3Host(pszBucketName, pszKeyName, pS3Int->pszBaseUrl);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_URL, pszUrl);
- RTStrFree(pszUrl);
-
- char* pszContentLength;
- RTStrAPrintf(&pszContentLength, "Content-Length: %lu", cbFileSize);
- /* Create the three basic header entries */
- char *apszHead[5] =
- {
- /* todo: For now we use octet-stream for all types. Later we should try
- * to set the right one (libmagic from the file packet could be a
- * candidate for finding the right type). */
- RTStrDup("Content-Type: octet-stream"), /* Content type entry */
- pszContentLength, /* Content length entry */
- rtS3HostHeader(pszBucketName, pS3Int->pszBaseUrl), /* Host entry */
- rtS3DateHeader(), /* Date entry */
- NULL /* Authorization entry */
- };
- /* Create the authorization header entry */
- apszHead[RT_ELEMENTS(apszHead)-1] = rtS3CreateAuthHeader(pS3Int, "PUT", pszBucketName, pszKeyName, apszHead, RT_ELEMENTS(apszHead));
-
- /* Add all headers to curl */
- struct curl_slist* pHeaders = NULL; /* Init to NULL is important */
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- pHeaders = curl_slist_append(pHeaders, apszHead[i]);
-
- /* Pass our list of custom made headers */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_HTTPHEADER, pHeaders);
-
- /* Set CURL in upload mode */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_PUT, 1);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_UPLOAD, 1);
-
- /* Set the size of the file we like to transfer */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_INFILESIZE_LARGE, cbFileSize);
-
- /* Set the callback which send the content */
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_READFUNCTION, rtS3ReadFileCallback);
- curl_easy_setopt(pS3Int->pCurl, CURLOPT_READDATA, &hFile);
-
- /* Start the request */
- rc = rtS3Perform(pS3Int);
-
- /* Regardless of the result, free all used resources first*/
- curl_slist_free_all(pHeaders);
- for(size_t i=0; i < RT_ELEMENTS(apszHead); ++i)
- RTStrFree(apszHead[i]);
-
- /* Close the open file */
- RTFileClose(hFile);
-
- return rc;
-}
-
diff --git a/src/VBox/Runtime/r3/xml.cpp b/src/VBox/Runtime/r3/xml.cpp
index 7ce3b56..630764e 100644
--- a/src/VBox/Runtime/r3/xml.cpp
+++ b/src/VBox/Runtime/r3/xml.cpp
@@ -1505,12 +1505,19 @@ void XmlMemParser::read(const void* pvBuf, size_t cbSize,
const char *pcszFilename = strFilename.c_str();
doc.m->reset();
+ const int options = XML_PARSE_NOBLANKS /* remove blank nodes */
+ | XML_PARSE_NONET /* forbit any network access */
+#if LIBXML_VERSION >= 20700
+ | XML_PARSE_HUGE /* don't restrict the node depth
+ to 256 (bad for snapshots!) */
+#endif
+ ;
if (!(doc.m->plibDocument = xmlCtxtReadMemory(m_ctxt,
(const char*)pvBuf,
(int)cbSize,
pcszFilename,
NULL, // encoding = auto
- XML_PARSE_NOBLANKS | XML_PARSE_NONET)))
+ options)))
throw XmlError(xmlCtxtGetLastError(m_ctxt));
doc.refreshInternals();
@@ -1634,13 +1641,20 @@ void XmlFileParser::read(const RTCString &strFilename,
ReadContext context(pcszFilename);
doc.m->reset();
+ const int options = XML_PARSE_NOBLANKS /* remove blank nodes */
+ | XML_PARSE_NONET /* forbit any network access */
+#if LIBXML_VERSION >= 20700
+ | XML_PARSE_HUGE /* don't restrict the node depth
+ to 256 (bad for snapshots!) */
+#endif
+ ;
if (!(doc.m->plibDocument = xmlCtxtReadIO(m_ctxt,
ReadCallback,
CloseCallback,
&context,
pcszFilename,
NULL, // encoding = auto
- XML_PARSE_NOBLANKS | XML_PARSE_NONET)))
+ options)))
throw XmlError(xmlCtxtGetLastError(m_ctxt));
doc.refreshInternals();
diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk
index 4796ba2..7c56cd1 100644
--- a/src/VBox/Runtime/testcase/Makefile.kmk
+++ b/src/VBox/Runtime/testcase/Makefile.kmk
@@ -147,10 +147,6 @@ PROGRAMS.l4 += \
PROGRAMS.darwin += \
tstDarwinSched \
tstRTDarwinMachKernel
-ifdef VBOX_WITH_LIBCURL
- PROGRAMS += \
- tstRTS3
-endif
if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
PROGRAMS += \
tstLdr-2 \
diff --git a/src/VBox/Runtime/testcase/tstRTBitOperations.cpp b/src/VBox/Runtime/testcase/tstRTBitOperations.cpp
index f7a0c5a..42de69f 100644
--- a/src/VBox/Runtime/testcase/tstRTBitOperations.cpp
+++ b/src/VBox/Runtime/testcase/tstRTBitOperations.cpp
@@ -163,7 +163,7 @@ int main()
MAP_CLEAR(p);
CHECK_GUARD(p);
- /* set */
+ /* bit set */
MAP_CLEAR(p);
ASMBitSet(&p->au32[0], 0);
ASMBitSet(&p->au32[0], 31);
@@ -186,7 +186,7 @@ int main()
CHECK(ASMAtomicBitTestAndSet(&p->au32[0], 16) && p->au32[0] == 0x40010001U);
CHECK(!ASMAtomicBitTestAndSet(&p->au32[0], 80) && p->au32[2] == 0x00010001U);
- /* clear */
+ /* bit clear */
MAP_SET(p);
ASMBitClear(&p->au32[0], 0);
ASMBitClear(&p->au32[0], 31);
@@ -209,6 +209,15 @@ int main()
CHECK(!ASMAtomicBitTestAndClear(&p->au32[0], 16) && p->au32[0] == ~0x40010001U);
CHECK(ASMAtomicBitTestAndClear(&p->au32[0], 80) && p->au32[2] == ~0x00010001U);
+ /* range set */
+ MAP_CLEAR(p);
+ ASMBitSetRange(&p->au32[0], 0, 5);
+ ASMBitSetRange(&p->au32[0], 6, 44);
+ ASMBitSetRange(&p->au32[0], 64, 65);
+ CHECK(p->au32[0] == 0xFFFFFFDFU);
+ CHECK(p->au32[1] == 0x00000FFFU);
+ CHECK(p->au32[2] == 0x00000001U);
+
/* toggle */
MAP_SET(p);
ASMBitToggle(&p->au32[0], 0);
diff --git a/src/VBox/Runtime/testcase/tstRTS3.cpp b/src/VBox/Runtime/testcase/tstRTS3.cpp
deleted file mode 100644
index 6dda005..0000000
--- a/src/VBox/Runtime/testcase/tstRTS3.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/* $Id: tstRTS3.cpp $ */
-/** @file
- * IPRT Testcase - Simple Storage Service (S3) Communication API
- */
-
-/*
- * Copyright (C) 2009 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-
-/*******************************************************************************
-* Header Files *
-*******************************************************************************/
-#include <iprt/s3.h>
-#include <iprt/stream.h>
-#include <iprt/initterm.h>
-#include <iprt/err.h>
-#include <iprt/test.h>
-
-
-/*******************************************************************************
-* Defined Constants And Macros *
-*******************************************************************************/
-/* Manual configuration of this testcase */
-#define TSTS3_CREATEBUCKET
-#define TSTS3_PUTGETKEY
-//#define TSTS3_SHOWPROGRESS
-
-#ifdef TSTS3_CREATEBUCKET
-//# define TSTS3_CREATEBUCKET_BUCKETNAME "tstS3CreateBucket"
-# define TSTS3_CREATEBUCKET_BUCKETNAME "tt9"
-#endif /* TSTS3_CREATEBUCKET */
-
-#ifdef TSTS3_PUTGETKEY
-# define TSTS3_PUTGETKEY_BUCKETNAME "tstS3PutGetBucket"
-# define TSTS3_PUTGETKEY_KEYNAME "tstS3PutGetKey"
-# define TSTS3_PUTGETKEY_PUTFILE "tstS3"
-# define TSTS3_PUTGETKEY_GETFILE "tstS3_fetched"
-#endif /* TSTS3_PUTGETKEY */
-
-static int progress(unsigned uPercent, void *pvUser)
-{
-#ifdef TSTS3_SHOWPROGRESS
- RTTestIPrintf(RTTESTLVL_ALWAYS, " Progress for %s - %d%% done.\n", (char*)pvUser, (int)uPercent);
-#endif /* TSTS3_SHOWPROGRESS */
- return VINF_SUCCESS;
-}
-
-void fetchAllBuckets(RTS3 hS3)
-{
- /* Fetch all available buckets */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " List all buckets...\n");
- char pszTitle[] = "RTS3GetBuckets";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- PCRTS3BUCKETENTRY pBuckets = NULL;
- int rc = RTS3GetBuckets(hS3, &pBuckets);
- if (RT_SUCCESS(rc))
- {
- if (pBuckets)
- {
- PCRTS3BUCKETENTRY pTmpBuckets = pBuckets;
- while (pBuckets)
- {
- RTTestIPrintf(RTTESTLVL_ALWAYS, " > %s, %s\n", pBuckets->pszName, pBuckets->pszCreationDate);
- pBuckets = pBuckets->pNext;
- }
- RTS3BucketsDestroy(pTmpBuckets);
- }
- else
- RTTestIPrintf(RTTESTLVL_ALWAYS, " > empty\n");
- }
- else
- RTTestIFailed("RTS3GetBuckets -> %Rrc", rc);
-}
-
-void createBucket(RTS3 hS3, const char *pszBucketName)
-{
- /* Create the bucket */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " Create bucket '%s'...\n", pszBucketName);
- char pszTitle[] = "RTS3CreateBucket";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- int rc = RTS3CreateBucket(hS3, pszBucketName);
- if (RT_FAILURE(rc))
- RTTestIFailed("RTS3CreateBucket -> %Rrc", rc);
-}
-
-void deleteBucket(RTS3 hS3, const char *pszBucketName)
-{
- /* Delete the bucket */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " Delete bucket '%s'...\n", pszBucketName);
- char pszTitle[] = "RTS3DeleteBucket";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- int rc = RTS3DeleteBucket(hS3, pszBucketName);
- if (RT_FAILURE(rc))
- RTTestIFailed("RTS3DeleteBucket -> %Rrc", rc);
-}
-
-void fetchAllKeys(RTS3 hS3, const char *pszBucketName)
-{
- /* Fetch all available keys of a specific bucket */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " List all keys of bucket '%s'...\n", pszBucketName);
- PCRTS3KEYENTRY pKeys = NULL;
- char pszTitle[] = "RTS3GetBucketKeys";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- int rc = RTS3GetBucketKeys(hS3, pszBucketName, &pKeys);
- if (RT_SUCCESS(rc))
- {
- if (pKeys)
- {
- PCRTS3KEYENTRY pTmpKeys = pKeys;
- while (pKeys)
- {
- RTTestIPrintf(RTTESTLVL_ALWAYS, " > %s, %s, %lu\n", pKeys->pszName, pKeys->pszLastModified, pKeys->cbFile);
- pKeys = pKeys->pNext;
- }
- RTS3KeysDestroy(pTmpKeys);
- }
- else
- RTTestIPrintf(RTTESTLVL_ALWAYS, " > empty\n");
- }
- else
- RTTestIFailed("RTS3GetBucketKeys -> %Rrc", rc);
-}
-
-void deleteKey(RTS3 hS3, const char *pszBucketName, const char *pszKeyName)
-{
- /* Delete the key */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " Delete key '%s' in bucket '%s'...\n", pszKeyName, pszBucketName);
- char pszTitle[] = "RTS3DeleteKey";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- int rc = RTS3DeleteKey(hS3, pszBucketName, pszKeyName);
- if (RT_FAILURE(rc))
- RTTestIFailed("RTS3DeleteKey -> %Rrc", rc);
-}
-
-void getKey(RTS3 hS3, const char *pszBucketName, const char *pszKeyName, const char *pszFilename)
-{
- /* Fetch the content of a key */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " Get key '%s' from bucket '%s' into '%s' ...\n", pszKeyName, pszBucketName, pszFilename);
- char pszTitle[] = "RTS3GetKey";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- int rc = RTS3GetKey(hS3, pszBucketName, pszKeyName, pszFilename);
- if (RT_FAILURE(rc))
- RTTestIFailed("RTS3GetKey -> %Rrc", rc);
-}
-
-void putKey(RTS3 hS3, const char *pszBucketName, const char *pszKeyName, const char *pszFilename)
-{
- /* Fetch the content of a key */
- RTTestIPrintf(RTTESTLVL_ALWAYS, " Put '%s' into key '%s' in bucket '%s' ...\n", pszFilename, pszKeyName, pszBucketName);
- char pszTitle[] = "RTS3PutKey";
- RTS3SetProgressCallback(hS3, progress, pszTitle);
- int rc = RTS3PutKey(hS3, pszBucketName, pszKeyName, pszFilename);
- if (RT_FAILURE(rc))
- RTTestIFailed("RTS3PutKey -> %Rrc", rc);
-}
-
-int main(int argc, char **argv)
-{
- /*
- * Initialize IPRT and create the test.
- */
- RTTEST hTest;
- int rc = RTTestInitAndCreate("tstRTS3", &hTest);
- if (rc)
- return rc;
- RTTestBanner(hTest);
-
- /*
- * If no args, display usage.
- */
- if (argc <= 2)
- {
- RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Syntax: %s [Access Key] [Secret Key]\n", argv[0]);
- return RTTestSkipAndDestroy(hTest, "Missing required arguments\n");
- }
-
- RTTestSubF(hTest, "Create S3");
- RTS3 hS3;
- rc = RTS3Create(&hS3, argv[1], argv[2], "object.storage.network.com", "tstS3-agent/1.0");
- if (RT_FAILURE(rc))
- {
- RTTestIFailed("RTS3Create -> %Rrc", rc);
- return RTTestSummaryAndDestroy(hTest);
- }
-
- RTTestSub(hTest, "Fetch buckets");
- fetchAllBuckets(hS3);
- RTTestSub(hTest, "Fetch keys");
- fetchAllKeys(hS3, "bla");
-
-#ifdef TSTS3_CREATEBUCKET
- RTTestSub(hTest, "Create bucket");
- createBucket(hS3, TSTS3_CREATEBUCKET_BUCKETNAME);
- fetchAllBuckets(hS3);
- deleteBucket(hS3, TSTS3_CREATEBUCKET_BUCKETNAME);
- fetchAllBuckets(hS3);
-#endif /* TSTS3_CREATEBUCKET */
-
-
-#ifdef TSTS3_PUTGETKEY
- RTTestSub(hTest, "Put key");
- createBucket(hS3, TSTS3_PUTGETKEY_BUCKETNAME);
- putKey(hS3, TSTS3_PUTGETKEY_BUCKETNAME, TSTS3_PUTGETKEY_KEYNAME, TSTS3_PUTGETKEY_PUTFILE);
- fetchAllKeys(hS3, TSTS3_PUTGETKEY_BUCKETNAME);
- getKey(hS3, TSTS3_PUTGETKEY_BUCKETNAME, TSTS3_PUTGETKEY_KEYNAME, TSTS3_PUTGETKEY_GETFILE);
- deleteKey(hS3, TSTS3_PUTGETKEY_BUCKETNAME, TSTS3_PUTGETKEY_KEYNAME);
- fetchAllKeys(hS3, TSTS3_PUTGETKEY_BUCKETNAME);
- deleteBucket(hS3, TSTS3_PUTGETKEY_BUCKETNAME);
-#endif /* TSTS3_PUTGETKEY */
-
- RTS3Destroy(hS3);
-
- /*
- * Summary
- */
- return RTTestSummaryAndDestroy(hTest);
-}
-
diff --git a/src/VBox/VMM/VMMR3/PDMDriver.cpp b/src/VBox/VMM/VMMR3/PDMDriver.cpp
index 713b8f5..3015b54 100644
--- a/src/VBox/VMM/VMMR3/PDMDriver.cpp
+++ b/src/VBox/VMM/VMMR3/PDMDriver.cpp
@@ -687,7 +687,7 @@ int pdmR3DrvInstantiate(PVM pVM, PCFGMNODE pNode, PPDMIBASE pBaseInterface, PPDM
rc = MMHyperAlloc(pVM, cb, 64, MM_TAG_PDM_DRIVER, (void **)&pNew);
else
rc = MMR3HeapAllocZEx(pVM, MM_TAG_PDM_DRIVER, cb, (void **)&pNew);
- if (pNew)
+ if (RT_SUCCESS(rc))
{
/*
* Initialize the instance structure (declaration order).
@@ -776,10 +776,7 @@ int pdmR3DrvInstantiate(PVM pVM, PCFGMNODE pNode, PPDMIBASE pBaseInterface, PPDM
}
}
else
- {
- AssertMsgFailed(("Failed to allocate %d bytes for instantiating driver '%s'\n", cb, pszName));
- rc = VERR_NO_MEMORY;
- }
+ AssertMsgFailed(("Failed to allocate %d bytes for instantiating driver '%s'! rc=%Rrc\n", cb, pszName, rc));
}
else
AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
diff --git a/src/libs/Makefile.kmk b/src/libs/Makefile.kmk
index 3e73544..eda58ab 100644
--- a/src/libs/Makefile.kmk
+++ b/src/libs/Makefile.kmk
@@ -27,22 +27,16 @@ include $(KBUILD_PATH)/subheader.kmk
# Compression libs used by IPRT and <what was it again?>.
include $(PATH_SUB_CURRENT)/liblzf-3.4/Makefile.kmk
if !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_TESTSUITE) \
- && "$(SDK_VBOX_ZLIB_INCS)" == "$(PATH_ROOT)/src/libs/zlib-1.2.6"
- include $(PATH_SUB_CURRENT)/zlib-1.2.6/Makefile.kmk
+ && "$(SDK_VBOX_ZLIB_INCS)" == "$(PATH_ROOT)/src/libs/zlib-1.2.8"
+ include $(PATH_SUB_CURRENT)/zlib-1.2.8/Makefile.kmk
endif
# PNG support (for screenshots).
if !defined(VBOX_ONLY_DOCS) && !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_TESTSUITE) \
- && "$(SDK_VBOX_LIBPNG_INCS)" == "$(PATH_ROOT)/src/libs/libpng-1.2.8"
- include $(PATH_SUB_CURRENT)/libpng-1.2.8/Makefile.kmk
+ && "$(SDK_VBOX_LIBPNG_INCS)" == "$(PATH_ROOT)/src/libs/libpng-1.2.53"
+ include $(PATH_SUB_CURRENT)/libpng-1.2.53/Makefile.kmk
endif # !VBOX_ONLY_DOCS
-# Libcurl for inet access
-if defined(VBOX_WITH_LIBCURL) && !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS) && !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_TESTSUITE) \
- && "$(SDK_VBOX_LIBCURL_INCS)" == "$(PATH_ROOT)/src/libs/curl-7.19.4/include"
- include $(PATH_SUB_CURRENT)/curl-7.19.4/Makefile.kmk
-endif
-
# The kStuff lib used by IPRT and the debugger.
if defined(IPRT_WITH_KSTUFF) #&& !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
include $(PATH_SUB_CURRENT)/kStuff/Makefile.kmk
@@ -77,8 +71,8 @@ if defined(VBOX_WITH_MAIN) \
endif
if !defined(VBOX_ONLY_TESTSUITE) && !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
- ifeq ($(SDK_VBOX_LIBXML2_INCS),$(PATH_ROOT)/src/libs/libxml2-2.6.31/include)
- include $(PATH_SUB_CURRENT)/libxml2-2.6.31/Makefile.kmk
+ ifeq ($(SDK_VBOX_LIBXML2_INCS),$(PATH_ROOT)/src/libs/libxml2-2.9.2/include)
+ include $(PATH_SUB_CURRENT)/libxml2-2.9.2/Makefile.kmk
endif
endif
diff --git a/src/libs/xpcom18a4/python/__init__.py b/src/libs/xpcom18a4/python/__init__.py
old mode 100644
new mode 100755
diff --git a/src/libs/xpcom18a4/python/components.py b/src/libs/xpcom18a4/python/components.py
old mode 100644
new mode 100755
diff --git a/src/libs/xpcom18a4/python/nsError.py b/src/libs/xpcom18a4/python/nsError.py
old mode 100644
new mode 100755
diff --git a/src/libs/xpcom18a4/python/tools/tracer_demo.py b/src/libs/xpcom18a4/python/tools/tracer_demo.py
old mode 100644
new mode 100755
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-virtualbox/virtualbox.git
More information about the Pkg-virtualbox-commits
mailing list