VirtualBox

Changeset 77859 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Mar 24, 2019 2:36:08 AM (6 years ago)
Author:
vboxsync
Message:

linux/vboxsf: Return -EPERM when the host refuses to create symlinks. Added iocharset to /proc/mount output and skipped default dmode, fmode, dmask and fmask values as the first two couldn't be parsed by the mount helper. Fixed the mount helper so it can parse it in case someone gets smart and 'fixes' the code again. bugref:9172

Location:
trunk/src/VBox/Additions/linux/sharedfolders
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/dirops.c

    r77858 r77859  
    12971297                } else {
    12981298                    int const vrc = rc;
    1299                     rc = -RTErrConvertToErrno(rc);
     1299                    if (vrc == VERR_WRITE_PROTECT)
     1300                        rc = -EPERM; /* EPERM: Symlink creation not supported according to the linux manpage as of 2017-09-15.
     1301                                        "VBoxInternal2/SharedFoldersEnableSymlinksCreate/<share>" is not 1. */
     1302                    else
     1303                        rc = -RTErrConvertToErrno(vrc);
    13001304                    SFLOGFLOW(("vbsf_inode_symlink: VbglR0SfHostReqCreateSymlinkContig failed for '%s' -> '%s': %Rrc (-> %d)\n",
    13011305                               pPath->String.ach, pTarget->String.ach, vrc, rc));
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r77858 r77859  
    298298};
    299299
    300 
  • trunk/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c

    r77739 r77859  
    8282    long long int val = strtoll(s, &endptr, base);
    8383
    84     if (val < INT_MIN || val > INT_MAX || endptr < s + size)
     84    if (   val < INT_MIN
     85        || (   val > INT_MAX
     86            && (base != 8 || val != UINT_MAX) ) /* hack for printf("%o", -1) - 037777777777 */
     87        || endptr < s + size)
    8588    {
    8689        errno = ERANGE;
    87         panic_err("could not convert %.*s to integer, result = %d",
    88                    (int)size, s, (int) val);
     90        panic_err("could not convert %.*s to integer, result = %lld (%d)",
     91                  (int)size, s, val, (int)val);
    8992    }
    9093    return (int)val;
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r77858 r77859  
    193193        if (info->nls_name[0]) {
    194194            if (_IS_UTF8(info->nls_name)) {
     195                SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8\n"));
    195196                sf_g->nls = NULL;
    196197            } else {
     
    213214                sf_g->nls = load_nls_default();
    214215                SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: CONFIG_NLS_DEFAULT=%s -> %p\n", CONFIG_NLS_DEFAULT, sf_g->nls));
    215             } else
     216            } else {
     217                SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8 (default %s)\n", CONFIG_NLS_DEFAULT));
    216218                sf_g->nls = NULL;
     219            }
    217220#else
     221            SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8 (no default)\n"));
    218222            sf_g->nls = NULL;
    219223#endif
     
    708712    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(sb);
    709713    if (sf_g) {
    710         seq_printf(m, ",uid=%u,gid=%u,ttl=%d,dmode=0%o,fmode=0%o,dmask=0%o,fmask=0%o,maxiopages=%u",
    711                sf_g->uid, sf_g->gid, sf_g->ttl_msec, sf_g->dmode, sf_g->fmode, sf_g->dmask,
    712                sf_g->fmask, sf_g->cMaxIoPages);
     714        seq_printf(m, ",uid=%u,gid=%u,ttl=%d,maxiopages=%u,iocharset=%s",
     715                   sf_g->uid, sf_g->gid, sf_g->ttl_msec, sf_g->cMaxIoPages, sf_g->nls ? sf_g->nls->charset : "utf8");
     716        if (sf_g->dmode != ~0)
     717            seq_printf(m, ",dmode=0%o", sf_g->dmode);
     718        if (sf_g->fmode != ~0)
     719            seq_printf(m, ",fmode=0%o", sf_g->fmode);
     720        if (sf_g->dmask != 0)
     721            seq_printf(m, ",dmask=0%o", sf_g->dmask);
     722        if (sf_g->fmask != 0)
     723            seq_printf(m, ",fmask=0%o", sf_g->fmask);
    713724        if (sf_g->tag[0] != '\0') {
    714725            seq_puts(m, ",tag=");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette