commit 300e21b3d8d0507bb6b641bb0c68ecf47ad28259
Author: Vasiliy Glazov <v.glazov(a)javad.com>
Date: Fri Jan 18 09:34:26 2019 +0300
Added patch.
...AutoMount-Change-Linux-mount-code-to-use-.patch | 130 +++++++++++++++++++++
1 file changed, 130 insertions(+)
---
diff --git a/0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
b/0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
new file mode 100644
index 0000000..625d554
--- /dev/null
+++ b/0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
@@ -0,0 +1,130 @@
+From 369dd2ee3c82c4417fee04aeec933c74fd198e78 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede(a)redhat.com>
+Date: Tue, 23 Jan 2018 15:09:20 +0100
+Subject: [PATCH resend] VBoxServiceAutoMount: Change Linux mount code to use
+ an options string
+
+Signed-off-by: Hans de Goede <hdegoede(a)redhat.com>
+---
+ .../common/VBoxService/VBoxServiceAutoMount.cpp | 62 +++-------------------
+ 1 file changed, 8 insertions(+), 54 deletions(-)
+
+diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
b/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
+index aa15d8b1..551edd4a 100644
+--- a/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
++++ b/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
+@@ -39,6 +39,7 @@
+ #include <iprt/assert.h>
+ #include <iprt/dir.h>
+ #include <iprt/mem.h>
++#include <iprt/param.h>
+ #include <iprt/path.h>
+ #include <iprt/string.h>
+ #include <iprt/semaphore.h>
+@@ -77,6 +78,9 @@ RT_C_DECLS_END
+ # endif
+ #endif
+
++#ifndef MAX_MNTOPT_STR
++#define MAX_MNTOPT_STR PAGE_SIZE
++#endif
+
+
/*********************************************************************************************************************************
+ * Global Variables
*
+@@ -297,13 +301,13 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName,
const char *pszM
+ rc = vbsvcAutoMountPrepareMountPoint(pszMountPoint, pszShareName, pOpts);
+ if (!fSkip && RT_SUCCESS(rc))
+ {
+-#ifdef RT_OS_SOLARIS
+ char szOptBuf[MAX_MNTOPT_STR] = { '\0', };
++ RTStrPrintf(szOptBuf, sizeof(szOptBuf),
"uid=%d,gid=%d,dmode=%0o,fmode=%0o,dmask=%0o,fmask=%0o",
++ pOpts->uid, pOpts->gid, pOpts->dmode, pOpts->fmode,
pOpts->dmask, pOpts->fmask);
++#ifdef RT_OS_SOLARIS
+ int fFlags = 0;
+ if (pOpts->ronly)
+ fFlags |= MS_RDONLY;
+- RTStrPrintf(szOptBuf, sizeof(szOptBuf),
"uid=%d,gid=%d,dmode=%0o,fmode=%0o,dmask=%0o,fmask=%0o",
+- pOpts->uid, pOpts->gid, pOpts->dmode, pOpts->fmode,
pOpts->dmask, pOpts->fmask);
+ int r = mount(pszShareName,
+ pszMountPoint,
+ fFlags | MS_OPTIONSTR,
+@@ -320,32 +324,11 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName,
const char *pszM
+
+ #elif defined(RT_OS_LINUX)
+ unsigned long fFlags = MS_NODEV;
+-
+- /*const char *szOptions = { "rw" }; - ??? */
+- struct vbsf_mount_info_new mntinf;
+-
+- mntinf.nullchar = '\0';
+- mntinf.signature[0] = VBSF_MOUNT_SIGNATURE_BYTE_0;
+- mntinf.signature[1] = VBSF_MOUNT_SIGNATURE_BYTE_1;
+- mntinf.signature[2] = VBSF_MOUNT_SIGNATURE_BYTE_2;
+- mntinf.length = sizeof(mntinf);
+-
+- mntinf.uid = pOpts->uid;
+- mntinf.gid = pOpts->gid;
+- mntinf.ttl = pOpts->ttl;
+- mntinf.dmode = pOpts->dmode;
+- mntinf.fmode = pOpts->fmode;
+- mntinf.dmask = pOpts->dmask;
+- mntinf.fmask = pOpts->fmask;
+-
+- strcpy(mntinf.name, pszShareName);
+- strcpy(mntinf.nls_name, "\0");
+-
+ int r = mount(pszShareName,
+ pszMountPoint,
+ "vboxsf",
+ fFlags,
+- &mntinf);
++ szOptBuf);
+ if (r == 0)
+ {
+ VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was
mounted to '%s'\n", pszShareName, pszMountPoint);
+@@ -378,34 +361,6 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName,
const char *pszM
+ }
+ else /* r == -1, we got some error in errno. */
+ {
+- if (errno == EPROTO)
+- {
+- VGSvcVerbose(3, "vbsvcAutoMountWorker: Messed up share name,
re-trying ...\n");
+-
+- /** @todo r=bird: What on earth is going on here????? Why can't
you
+- * strcpy(mntinf.name, pszShareName) to fix it again? */
+-
+- /* Sometimes the mount utility messes up the share name. Try to
+- * un-mangle it again. */
+- char szCWD[RTPATH_MAX];
+- size_t cchCWD;
+- if (!getcwd(szCWD, sizeof(szCWD)))
+- {
+- VGSvcError("vbsvcAutoMountWorker: Failed to get the current
working directory\n");
+- szCWD[0] = '\0';
+- }
+- cchCWD = strlen(szCWD);
+- if (!strncmp(pszMountPoint, szCWD, cchCWD))
+- {
+- while (pszMountPoint[cchCWD] == '/')
+- ++cchCWD;
+- /* We checked before that we have enough space */
+- strcpy(mntinf.name, pszMountPoint + cchCWD);
+- }
+- r = mount(mntinf.name, pszMountPoint, "vboxsf", fFlags,
&mntinf);
+- }
+- if (r == -1) /* Was there some error from one of the tries above? */
+- {
+ switch (errno)
+ {
+ /* If we get EINVAL here, the system already has mounted the Shared
Folder to another
+@@ -424,7 +379,6 @@ static int vbsvcAutoMountSharedFolder(const char *pszShareName, const
char *pszM
+ rc = RTErrConvertFromErrno(errno);
+ break;
+ }
+- }
+ }
+ #else
+ # error "PORTME"
+--
+2.14.3
+