Hello,
I'm implementing support for symlinks in shared folders in Solaris
guests, and ran across the following problem (this is based on svn
rev 35386).
vboxCallSymlink() in VBoxGuestR0LibSharedFolders.c is defined as
taking a PSHFLFSOBJINFO parameter; but the corresponding vbsfSymlink()
in vbsf.cpp (and the associated calling code in service.cpp) expect a
PRTFSOBJINFO instead. This results in any attempt to create a symlink
by a guest failing at the size check on line 1192 in service.cpp .
It appears the breakage was introduced in r33994 (public svn repo) due
to an imcomplete set of changes. I think the attached patch should fix
things, but it is untested (so maybe view it as a guide rather than a
definitive fix).
If anybody can confirm the issue and the proposed fix then I can
finalize my Solaris-guest patches and submit them.
TIA.
Cheers,
Ronald
diff --git a/src/VBox/HostServices/SharedFolders/service.cpp
b/src/VBox/HostServices/SharedFolders/service.cpp
index a96380d..00b22de 100644
--- a/src/VBox/HostServices/SharedFolders/service.cpp
+++ b/src/VBox/HostServices/SharedFolders/service.cpp
@@ -1183,13 +1183,13 @@ static DECLCALLBACK(void) svcCall (void *,
VBOXHGCMCALLHANDLE callHandle, uint32
SHFLROOT root = (SHFLROOT)paParms[0].u.uint32;
SHFLSTRING *pNewPath = (SHFLSTRING
*)paParms[1].u.pointer.addr;
SHFLSTRING *pOldPath = (SHFLSTRING
*)paParms[2].u.pointer.addr;
- RTFSOBJINFO *pInfo = (RTFSOBJINFO
*)paParms[3].u.pointer.addr;
+ SHFLFSOBJINFO *pInfo = (SHFLFSOBJINFO
*)paParms[3].u.pointer.addr;
uint32_t cbInfo = paParms[3].u.pointer.size;
/* Verify parameters values. */
if ( !ShflStringIsValid(pNewPath, paParms[1].u.pointer.size)
|| !ShflStringIsValid(pOldPath, paParms[2].u.pointer.size)
- || (cbInfo != sizeof(RTFSOBJINFO))
+ || (cbInfo != sizeof(SHFLFSOBJINFO))
)
{
rc = VERR_INVALID_PARAMETER;
diff --git a/src/VBox/HostServices/SharedFolders/vbsf.cpp
b/src/VBox/HostServices/SharedFolders/vbsf.cpp
index b549739..53d970b 100644
--- a/src/VBox/HostServices/SharedFolders/vbsf.cpp
+++ b/src/VBox/HostServices/SharedFolders/vbsf.cpp
@@ -2146,10 +2146,12 @@ int vbsfRename(SHFLCLIENTDATA *pClient, SHFLROOT root,
SHFLSTRING *pSrc, SHFLSTR
return rc;
}
-int vbsfSymlink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pNewPath,
SHFLSTRING *pOldPath, RTFSOBJINFO *pInfo)
+int vbsfSymlink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pNewPath,
SHFLSTRING *pOldPath, SHFLFSOBJINFO *pInfo)
{
int rc = VINF_SUCCESS;
+ RTFSOBJINFO linkinfo;
+
char *pszFullNewPath = NULL;
char *pszOldPath = NULL;
@@ -2163,7 +2165,10 @@ int vbsfSymlink(SHFLCLIENTDATA *pClient, SHFLROOT root,
SHFLSTRING *pNewPath, SH
rc = RTSymlinkCreate(pszFullNewPath, (const char *)pOldPath->String.utf8,
RTSYMLINKTYPE_UNKNOWN);
if (RT_SUCCESS (rc))
- rc = RTPathQueryInfoEx(pszFullNewPath, pInfo, RTFSOBJATTRADD_NOTHING,
SHFL_RT_LINK(pClient));
+ rc = RTPathQueryInfoEx(pszFullNewPath, &linkinfo,
RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
+
+ if (RT_SUCCESS (rc))
+ vbfsCopyFsObjInfoFromIprt(pInfo, &linkinfo);
vbsfFreeFullPath(pszFullNewPath);
diff --git a/src/VBox/HostServices/SharedFolders/vbsf.h
b/src/VBox/HostServices/SharedFolders/vbsf.h
index 7827bca..7697968 100644
--- a/src/VBox/HostServices/SharedFolders/vbsf.h
+++ b/src/VBox/HostServices/SharedFolders/vbsf.h
@@ -38,6 +38,6 @@ int vbsfFlush(SHFLCLIENTDATA *pClient, SHFLROOT root,
SHFLHANDLE Handle);
int vbsfDisconnect(SHFLCLIENTDATA *pClient);
int vbsfQueryFileInfo(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE
Handle, uint32_t flags, uint32_t *pcbBuffer, uint8_t *pBuffer);
int vbsfReadLink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pPath,
uint32_t cbPath, uint8_t *pBuffer, uint32_t cbBuffer);
-int vbsfSymlink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pNewPath,
SHFLSTRING *pOldPath, RTFSOBJINFO *pInfo);
+int vbsfSymlink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pNewPath,
SHFLSTRING *pOldPath, SHFLFSOBJINFO *pInfo);
#endif /* __VBSF__H */
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev