fix
authorMiklos Szeredi <miklos@szeredi.hu>
Thu, 10 Feb 2005 07:35:05 +0000 (07:35 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Thu, 10 Feb 2005 07:35:05 +0000 (07:35 +0000)
ChangeLog
util/fusermount.c

index dff2600c3f5d010f65031209de67d62632d82037..b17a3b28a00e8badfa48f3fa2c8e6f88b3afd602 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-02-10  Miklos Szeredi <miklos@szeredi.hu>
+
+       * fusermount: set umask, otherwise /etc/mtab will have
+       unpredictable permission.  Spotted by Jindrich Kolorenc
+
+       * fusermount: set owner and group of /etc/mtab to original values
+       on unmount
+       
 2005-02-07  Miklos Szeredi <miklos@szeredi.hu>
 
        * Cleaned up directory reading (temporary file is not used)
index 4f9ed2fdc12d1807d4c3e6da1e87c743afae1c47..1b79446eb43741869186bad4bf004b5adfdb3e3a 100644 (file)
@@ -240,6 +240,7 @@ static int unmount_rename(const char *mnt, int quiet, int lazy,
                           const char *mtab, const char *mtab_new)
 {
     int res;
+    struct stat sbuf;
 
     if (getuid() != 0) {
         res = drop_privs();
@@ -253,6 +254,9 @@ static int unmount_rename(const char *mnt, int quiet, int lazy,
     if (getuid() != 0)
         restore_privs();
 
+    if (stat(mtab, &sbuf) == 0)
+        chown(mtab_new, sbuf.st_uid, sbuf.st_gid);
+
     res = rename(mtab_new, mtab);
     if (res == -1) {
         fprintf(stderr, "%s: failed to rename %s to %s: %s\n", progname,
@@ -1046,6 +1050,7 @@ int main(int argc, char *argv[])
     if (getuid() != 0)
         restore_privs();
 
+    umask(033);
     if (unmount) {
         if (geteuid() == 0) {
             int mtablock = lock_mtab();