]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/nfsd/vfs.c
CRED: Pass credentials through dentry_open()
[mirror_ubuntu-artful-kernel.git] / fs / nfsd / vfs.c
index 0bc56f6d9276b96878edd55837354d6c5ea87d02..b59ec5a6ed246fc994adc27e2749a986c0a96edd 100644 (file)
@@ -671,6 +671,7 @@ __be32
 nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
                        int access, struct file **filp)
 {
+       const struct cred *cred = current_cred();
        struct dentry   *dentry;
        struct inode    *inode;
        int             flags = O_RDONLY|O_LARGEFILE;
@@ -725,7 +726,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
                DQUOT_INIT(inode);
        }
        *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt),
-                               flags);
+                           flags, cred);
        if (IS_ERR(*filp))
                host_err = PTR_ERR(*filp);
 out_nfserr:
@@ -1169,7 +1170,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp,
         * send along the gid on create when it tries to implement
         * setgid directories via NFS:
         */
-       if (current->fsuid != 0)
+       if (current_fsuid() != 0)
                iap->ia_valid &= ~(ATTR_UID|ATTR_GID);
        if (iap->ia_valid)
                return nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
@@ -1912,6 +1913,7 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func,
                        de = (struct buffered_dirent *)((char *)de + reclen);
                }
                offset = vfs_llseek(file, 0, SEEK_CUR);
+               cdp->err = nfserr_eof;
                if (!buf.full)
                        break;
        }
@@ -2003,7 +2005,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
                IS_APPEND(inode)?       " append" : "",
                __mnt_is_readonly(exp->ex_path.mnt)?    " ro" : "");
        dprintk("      owner %d/%d user %d/%d\n",
-               inode->i_uid, inode->i_gid, current->fsuid, current->fsgid);
+               inode->i_uid, inode->i_gid, current_fsuid(), current_fsgid());
 #endif
 
        /* Normally we reject any write/sattr etc access on a read-only file
@@ -2046,7 +2048,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
         * with NFSv3.
         */
        if ((acc & NFSD_MAY_OWNER_OVERRIDE) &&
-           inode->i_uid == current->fsuid)
+           inode->i_uid == current_fsuid())
                return 0;
 
        /* This assumes  NFSD_MAY_{READ,WRITE,EXEC} == MAY_{READ,WRITE,EXEC} */