commit ad7bb5f61195bea3622db652bea66b5cc56c4fe3
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Sat May 5 16:33:52 2007 -0400

    permission related bugfixes

diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 21b2d91..741e32e 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -349,6 +349,8 @@ int odf_rename(struct dentry *old_dentry, struct dentry 
*new_dentry)
        struct dentry *old_dir, *new_dir;
        struct dentry *old_odfdentry, *new_odfdentry;
        int err = 0;
+       uid_t olduid = current->fsuid;
+       gid_t oldgid = current->fsgid;
 
        err = odf_lookup(old_dentry->d_parent, old_dentry, 0);
        if (err)
@@ -387,10 +389,14 @@ int odf_rename(struct dentry *old_dentry, struct dentry 
*new_dentry)
        BUG_ON(new_odfdentry->d_inode);
 
        lock_rename(old_dir, new_dir);
+       current->fsuid = 0;
+       current->fsgid = 0;
        err = vfs_rename(old_dir->d_inode,
                        old_odfdentry, new_dir->d_inode,
                        new_odfdentry);
        unlock_rename(old_dir, new_dir);
+       current->fsuid = olduid;
+       current->fsgid = oldgid;
        dput(new_odfdentry);
 
 out_unlock:
@@ -407,6 +413,8 @@ int odf_link(struct dentry *old_dentry, struct dentry 
*new_dentry)
        struct dentry *old_dir, *new_dir;
        struct dentry *old_odfdentry, *new_odfdentry;
        int err = 0;
+       uid_t olduid = current->fsuid;
+       gid_t oldgid = current->fsgid;
 
        err = odf_lookup(old_dentry->d_parent, old_dentry, 0);
        if (err)
@@ -438,7 +446,11 @@ int odf_link(struct dentry *old_dentry, struct dentry 
*new_dentry)
        /* this should never happen */
        BUG_ON(new_odfdentry->d_inode);
 
+       current->fsuid = 0;
+       current->fsgid = 0;
        err = vfs_link(old_odfdentry, old_dir->d_inode, new_odfdentry);
+       current->fsuid = olduid;
+       current->fsgid = oldgid;
 
        dput(new_odfdentry);
 out_unlock:
@@ -1246,6 +1258,8 @@ int odf_purge_dir_cache(struct dentry *dentry)
 {
        int err = 0;
        struct odf_dentry_info *odi = NULL;
+       uid_t olduid = current->fsuid;
+       gid_t oldgid = current->fsgid;
 
        odi = odf_ic_cache_dentry(dentry);
        if (IS_ERR(odi)){
@@ -1253,7 +1267,12 @@ int odf_purge_dir_cache(struct dentry *dentry)
                odi = NULL;
                goto out;
        }
+
+       current->fsuid = 0;
+       current->fsgid = 0;
        err = vfs_unlink(odi->dentry->d_parent->d_inode, odi->dentry);
+       current->fsuid = olduid;
+       current->fsgid = oldgid;
 out:
        odf_put_info(odi);
        return err;
@@ -1299,6 +1318,11 @@ int odf_remove(struct dentry *dentry, int flags)
        struct odf_dentry_info *odf_dir;
        struct odf_dentry_info *odi = NULL;
        int err = 0, rmv = 0;
+       uid_t olduid = current->fsuid;
+       gid_t oldgid = current->fsgid;
+
+       olduid = current->fsuid;
+       oldgid = current->fsgid;
 
        /* refresh odi */
        err = odf_lookup(dentry->d_parent, dentry, 0);
@@ -1327,10 +1351,14 @@ int odf_remove(struct dentry *dentry, int flags)
        odf_lock(odf_dir);
 
        /* remove */
+       current->fsuid = 0;
+       current->fsgid = 0;
        if (S_ISDIR(odi->dentry->d_inode->i_mode))
                err = odf_reclaim(dentry);
        else
                err = vfs_unlink(odi->dentry->d_parent->d_inode, odi->dentry);
+       current->fsuid = olduid;
+       current->fsgid = oldgid;
        if (err)
                goto out_unlock;
 
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to