44
44
# define MS_SYNCHRONOUS MNT_SYNCHRONOUS
45
45
# define MS_NOEXEC MNT_NOEXEC
46
46
# define MS_NOSUID MNT_NOSUID
47
# define MS_NODEV MNT_NODEV
48
* MNT_NODEV does not exist, or is set to 0, on newer versions of FreeBSD.
50
# if defined(MNT_NODEV) && MNT_NODEV
51
# define MS_NODEV MNT_NODEV
48
53
# define MS_UNION MNT_UNION
49
54
# define MS_ASYNC MNT_ASYNC
50
55
# define MS_SUIDDIR MNT_SUIDDIR
199
204
printf(" rw mount read-write (default)\n");
200
205
printf(" nosuid ignore suid/sgid bits\n");
201
206
printf(" suid allow suid/sgid bits (default)\n");
202
208
printf(" nodev prevent device node access\n");
203
209
printf(" dev allow device node access (default)\n");
204
211
printf(" noexec prevent program execution\n");
205
212
printf(" exec allow program execution (default)\n");
206
213
printf(" sync file writes are synchronous\n");
603
610
} else if (strcmp(key, "suid") == 0) {
604
611
*flags &= ~MS_NOSUID;
605
612
LOG("Setting mount option for allowing suid/sgid bits on\n");
606
614
} else if (strcmp(key, "nodev") == 0) { // allow access to device nodes?
607
615
*flags |= MS_NODEV;
608
616
LOG("Setting mount option for accessing device nodes off\n");
609
617
} else if (strcmp(key, "dev") == 0) {
610
618
*flags &= ~MS_NODEV;
611
619
LOG("Setting mount option for accessing device nodes on\n");
612
621
} else if (strcmp(key, "noexec") == 0) { // allow program execution?
613
622
*flags |= MS_NOEXEC;
614
623
LOG("Setting mount option for program execution off\n");
737
746
if (flags & MS_NOSUID) {
738
747
Str_Strcat(mountEnt.mnt_opts, ",nosuid", MOUNT_OPTS_BUFFER_SIZE);
740
750
if (flags & MS_NODEV) {
741
751
Str_Strcat(mountEnt.mnt_opts, ",nodev", MOUNT_OPTS_BUFFER_SIZE);
743
754
if (flags & MS_NOEXEC) {
744
755
Str_Strcat(mountEnt.mnt_opts, ",noexec", MOUNT_OPTS_BUFFER_SIZE);
809
820
Bool doMtab = TRUE;
812
int i, result = EXIT_FAILURE, flags = 0, mntRes = -1;
824
int result = EXIT_FAILURE;
813
827
char *optionString = NULL;
814
const char *shareNameHost, *shareNameDir;
828
const char *shareNameHost = NULL;
829
const char *shareNameDir = NULL;
815
830
struct stat statBuf;
816
831
HgfsMountInfo mountInfo;
817
832
char *canonicalizedPath = NULL;
945
960
{"target", sizeof("target")},
946
961
{shareName, strlen(shareName) + 1},
947
962
{"fspath", sizeof("fspath")},
948
{(void *)mountPoint, strlen(mountPoint) + 1}};
963
{(void *)mountPoint, strlen(mountPoint) + 1},
964
{"uidSet", sizeof("uidSet")},
965
{&mountInfo.uidSet, sizeof(mountInfo.uidSet)},
966
{"uid", sizeof("uid")},
967
{&mountInfo.uid, sizeof(mountInfo.uid)},
968
{"gidSet", sizeof("gidSet")},
969
{&mountInfo.gidSet, sizeof(mountInfo.gidSet)},
970
{"gid", sizeof("gid")},
971
{&mountInfo.gid, sizeof(mountInfo.gid)}};
950
973
mntRes = nmount(iov, ARRAYSIZE(iov), flags);
952
975
#elif defined(__APPLE__)
953
mntRes = mount(HGFS_NAME, mountPoint, flags, NULL);
976
mntRes = mount(HGFS_NAME, mountPoint, flags, &mountInfo);
956
979
perror("Error: cannot mount filesystem");