if (shareInfo->rootDirLen == 0) {
size_t prefixLen;
+ /* Are root shares allowed? If not, we exit with an error. */
+ if (0 == (gHgfsCfgSettings.flags & HGFS_CONFIG_SHARE_ALL_HOST_DRIVES_ENABLED)) {
+ LOG(4, ("%s: Root share being used\n", __FUNCTION__));
+ nameStatus = HGFS_NAME_STATUS_ACCESS_DENIED;
+ goto error;
+ }
+
/*
* This is a "root" share. Interpret the input appropriately as
* either a drive letter or UNC name and append it to the output
{ "guest", &gGuestBackdoorOps, 0, NULL, NULL, {0} },
};
+static HgfsServerConfig gHgfsGuestCfgSettings = {
+ (HGFS_CONFIG_SHARE_ALL_HOST_DRIVES_ENABLED | HGFS_CONFIG_VOL_INFO_MIN),
+ HGFS_MAX_CACHED_FILENODES
+};
+
/* HGFS server info state. Referenced by each separate channel that uses it. */
static HgfsChannelServerData gHgfsChannelServerInfo = { NULL, {0} };
Debug("%s: Initialize Hgfs server.\n", __FUNCTION__);
/* If we have a new connection initialize the server session with default settings. */
- result = HgfsServer_InitState(&serverInfo->serverCBTable, NULL, NULL);
+ result = HgfsServer_InitState(&serverInfo->serverCBTable, &gHgfsGuestCfgSettings, NULL);
if (!result) {
Debug("%s: Could not init Hgfs server.\n", __FUNCTION__);
}
#define HGFS_MAX_CACHED_FILENODES 30
typedef uint32 HgfsConfigFlags;
-#define HGFS_CONFIG_USE_HOST_TIME (1 << 0)
-#define HGFS_CONFIG_NOTIFY_ENABLED (1 << 1)
-#define HGFS_CONFIG_VOL_INFO_MIN (1 << 2)
-#define HGFS_CONFIG_OPLOCK_ENABLED (1 << 3)
+#define HGFS_CONFIG_USE_HOST_TIME (1 << 0)
+#define HGFS_CONFIG_NOTIFY_ENABLED (1 << 1)
+#define HGFS_CONFIG_VOL_INFO_MIN (1 << 2)
+#define HGFS_CONFIG_OPLOCK_ENABLED (1 << 3)
+#define HGFS_CONFIG_SHARE_ALL_HOST_DRIVES_ENABLED (1 << 4)
typedef struct HgfsServerConfig {
HgfsConfigFlags flags;