fusermount, libfuse: send value as unsigned in "user_id=" and "group_id="
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 15 Jul 2014 14:03:12 +0000 (16:03 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Tue, 15 Jul 2014 14:03:12 +0000 (16:03 +0200)
...options.  Uids/gids larger than 2147483647 would result in EINVAL when
mounting the filesystem.  This also needs a fix in the kernel.

ChangeLog
lib/mount.c
util/fusermount.c

index 4e7da1daae04a2e6c5720dfdefef1d176f1fe3a8..fd3acd5980e0823066c3f09ee9d8b478df7ce2ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
        * libfuse: document deadlock avoidance for
        fuse_notify_inval_entry() and fuse_notify_delete()
 
+       * fusermount, libfuse: send value as unsigned in "user_id=" and
+       "group_id=" options.  Uids/gids larger than 2147483647 would
+       result in EINVAL when mounting the filesystem.  This also needs a
+       fix in the kernel.
+
 2014-03-26  Miklos Szeredi <miklos@szeredi.hu>
 
        * Initilaize stat buffer passed to ->getattr() and ->fgetattr() to
index fb9231adfc4ab40ad8bc59ce586babeb38c8ac7b..111b32b509807185ce2a2adbb9795c647207c306 100644 (file)
@@ -462,7 +462,7 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
        if (!O_CLOEXEC)
                fcntl(fd, F_SETFD, FD_CLOEXEC);
 
-       snprintf(tmp, sizeof(tmp),  "fd=%i,rootmode=%o,user_id=%i,group_id=%i",
+       snprintf(tmp, sizeof(tmp),  "fd=%i,rootmode=%o,user_id=%u,group_id=%u",
                 fd, stbuf.st_mode & S_IFMT, getuid(), getgid());
 
        res = fuse_opt_add_opt(&mo->kernel_opts, tmp);
index e7dbca6cede5b58a2a968be79637a3e6ea12dc1d..b226fbddb815b0eb0f2972db24d40aedb1b43328 100644 (file)
@@ -810,7 +810,7 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode,
        if (res == -1)
                goto err;
 
-       sprintf(d, "fd=%i,rootmode=%o,user_id=%i,group_id=%i",
+       sprintf(d, "fd=%i,rootmode=%o,user_id=%u,group_id=%u",
                fd, rootmode, getuid(), getgid());
 
        if (check_empty &&
@@ -851,7 +851,7 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode,
        }
        if (res == -1 && errno == EINVAL) {
                /* It could be an old version not supporting group_id */
-               sprintf(d, "fd=%i,rootmode=%o,user_id=%i",
+               sprintf(d, "fd=%i,rootmode=%o,user_id=%u",
                        fd, rootmode, getuid());
                res = mount(source, mnt, type, flags, optbuf);
        }