From patchwork Tue Oct 12 15:32:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 247931 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9CFWjJx009707 for ; Tue, 12 Oct 2010 15:32:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752968Ab0JLPcp (ORCPT ); Tue, 12 Oct 2010 11:32:45 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.121]:33307 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589Ab0JLPcp (ORCPT ); Tue, 12 Oct 2010 11:32:45 -0400 X-Authority-Analysis: v=1.1 cv=lu/RhtYP0ChAeUxMEPBris12a71TWT5f9yvo3GNwP9w= c=1 sm=0 a=a9Eww7WmB8UA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=1wl5LmfTxcWVSopCX4MA:9 a=l7L5yd0jXu6ayES1i6oA:7 a=p0kGtN4EOuSZk1PAaNDtsyKynbEA:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:36420] helo=mail.poochiereds.net) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id BD/1E-14228-B9F74BC4; Tue, 12 Oct 2010 15:32:43 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id D6AC25818A; Tue, 12 Oct 2010 11:32:42 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH] cifs: on multiuser mount, set ownership to current_fsuid/current_fsgid (try #7) Date: Tue, 12 Oct 2010 11:32:42 -0400 Message-Id: <1286897562-1883-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2.3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Oct 2010 15:32:46 +0000 (UTC) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 73dcbb1..cfe2339 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1761,7 +1761,7 @@ check_inval: } int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, - struct kstat *stat) + struct kstat *stat) { struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); @@ -1771,11 +1771,17 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, generic_fillattr(dentry->d_inode, stat); stat->blksize = CIFS_MAX_MSGSIZE; stat->ino = CIFS_I(dentry->d_inode)->uniqueid; + + /* + * If on a multiuser mount without unix extensions, and the + * admin hasn't overridden them, set the ownership to the + * fsuid/fsgid of the current process. + */ if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) && !tcon->unix_ext) { - if (!cifs_sb->mnt_uid) + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)) stat->uid = current_fsuid(); - if (!cifs_sb->mnt_uid) + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)) stat->gid = current_fsgid(); } }