From patchwork Fri Oct 8 11:38:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 241151 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 o98BcCSL025104 for ; Fri, 8 Oct 2010 11:38:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755430Ab0JHLiJ (ORCPT ); Fri, 8 Oct 2010 07:38:09 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.121]:42138 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755102Ab0JHLiJ (ORCPT ); Fri, 8 Oct 2010 07:38:09 -0400 X-Authority-Analysis: v=1.1 cv=UAZ0ep3suvkVn+xl78ZyFqEJZfCyw4fsauT9kMdOA88= c=1 sm=0 a=AFtq5LxA1L0A:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=hQhSl1OhNAOOoA1NEpYA:9 a=f4KYPL9FbzJaKeWsaKUA:7 a=s9wPtraNNXzh29kXYQ3ddzTw0OIA: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:35514] helo=mail.poochiereds.net) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id F0/AB-03860-F920FAC4; Fri, 08 Oct 2010 11:38:07 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 357245817F; Fri, 8 Oct 2010 07:38:07 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH] cifs: on noperm mount, set ownership to current_fsuid/current_fsgid (try #6) Date: Fri, 8 Oct 2010 07:38:07 -0400 Message-Id: <1286537887-16730-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]); Fri, 08 Oct 2010 11:38:12 +0000 (UTC) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 7cf3d93..d3f9a18 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1759,7 +1759,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); @@ -1769,11 +1769,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 ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) && + + /* + * If on a noperm 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_NO_PERM) && !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(); } }