Changeset 69149 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Oct 20, 2017 2:53:19 PM (7 years ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c
r69046 r69149 504 504 err = mount(host_name, mount_point, "vboxsf", flags, &mntinf); 505 505 } 506 if (err == -1 && errno == EPROTO)507 {508 /* New mount tool with old vboxsf module? Try again using the old509 * vbsf_mount_info_old structure. */510 struct vbsf_mount_info_old mntinf_old;511 memcpy(&mntinf_old.name, &mntinf.name, MAX_HOST_NAME);512 memcpy(&mntinf_old.nls_name, mntinf.nls_name, MAX_NLS_NAME);513 mntinf_old.uid = mntinf.uid;514 mntinf_old.gid = mntinf.gid;515 mntinf_old.ttl = mntinf.ttl;516 err = mount(host_name, mount_point, "vboxsf", flags, &mntinf_old);517 }518 506 if (err) 519 507 panic_err("%s: mounting failed with the error", argv[0]); -
trunk/src/VBox/Additions/linux/sharedfolders/vbsfmount.h
r62527 r69149 18 18 #define VBFS_MOUNT_H 19 19 20 /* Linux constraints the size of data mount argument to PAGE_SIZE - 1. */ 20 21 #define MAX_HOST_NAME 256 21 22 #define MAX_NLS_NAME 32 22 23 /* Linux constraints the size of data mount argument to PAGE_SIZE - 1. */24 struct vbsf_mount_info_old25 {26 char name[MAX_HOST_NAME];27 char nls_name[MAX_NLS_NAME];28 int uid;29 int gid;30 int ttl;31 };32 23 33 24 #define VBSF_MOUNT_SIGNATURE_BYTE_0 '\377' … … 37 28 struct vbsf_mount_info_new 38 29 { 39 char nullchar; /* name cannot be '\0' -- we use this field 40 to distinguish between the old structure 41 and the new structure */ 30 /* 31 * The old version of the mount_info struct started with a 32 * char name[MAX_HOST_NAME] field, where name cannot be '\0'. 33 * So the new version of the mount_info struct starts with a 34 * nullchar field which is always 0 so that we can detect and 35 * reject the old structure being passed. 36 */ 37 char nullchar; 42 38 char signature[3]; /* signature */ 43 39 int length; /* length of the whole structure */ -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r68646 r69149 75 75 || info->signature[2] != VBSF_MOUNT_SIGNATURE_BYTE_2) 76 76 { 77 /* An old version of mount.vboxsf made the syscall. Translate the 78 * old parameters to the new structure. */ 79 struct vbsf_mount_info_old *info_old = (struct vbsf_mount_info_old *)info; 80 static struct vbsf_mount_info_new info_compat; 81 82 info = &info_compat; 83 memset(info, 0, sizeof(*info)); 84 memcpy(&info->name, &info_old->name, MAX_HOST_NAME); 85 memcpy(&info->nls_name, &info_old->nls_name, MAX_NLS_NAME); 86 info->length = offsetof(struct vbsf_mount_info_new, dmode); 87 info->uid = info_old->uid; 88 info->gid = info_old->gid; 89 info->ttl = info_old->ttl; 77 err = -EINVAL; 78 goto fail1; 90 79 } 91 80 … … 94 83 95 84 name_len = strlen(info->name); 96 if (name_len > 0xfffe)97 {98 err = -ENAMETOOLONG;99 LogFunc(("map name too big\n"));100 goto fail1;101 }102 103 85 str_len = offsetof(SHFLSTRING, String.utf8) + name_len + 1; 104 86 str_name = kmalloc(str_len, GFP_KERNEL);
Note:
See TracChangeset
for help on using the changeset viewer.