From patchwork Tue Mar 8 05:00:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 617271 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 p284wGsA029316 for ; Tue, 8 Mar 2011 04:58:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756242Ab1CHE6Q (ORCPT ); Mon, 7 Mar 2011 23:58:16 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:37878 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755951Ab1CHE6P (ORCPT ); Mon, 7 Mar 2011 23:58:15 -0500 Received: by iyb26 with SMTP id 26so4532866iyb.19 for ; Mon, 07 Mar 2011 20:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=W6UyzCkYkquVMm0kcTMF5VGa7kPmakMJt8vsmoyvWoI=; b=QMDXj2zRml0lrcwBPBUgDvyAxsej97iZtgtw0hs2bcXZB8wpuoDbWSpIWuCqmsk8cO GYxxF2Spc0bB3Bl37V/TQnsB2sLQt+EuRMu57RnV0MrQYA5X7CC8ijqNiotz4czoLN1w iyWGwy0HMgV1zoRSQXaAHYOys1O4mX0LOydww= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=YG2jvorjtsmDTtfBnMrBi++jGWvuKDjnEgA7QorMPqB+i8n4qmRZPWE79A6HQC62fJ VqWADdxNvsRfBf1/j/GqersiXmX8DVZGyk+WoSJfVpXFpzAtmAJ+8HbwaCOxmwxhc4uT EzibBXJBGyNKL+CEgmpIOPx65Qc77XJGK57MU= Received: by 10.42.196.130 with SMTP id eg2mr1278467icb.495.1299560294923; Mon, 07 Mar 2011 20:58:14 -0800 (PST) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id d21sm273513ibg.21.2011.03.07.20.58.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Mar 2011 20:58:14 -0800 (PST) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH] cifs: Allow to set extended attribute cifs_acl (repost) Date: Mon, 7 Mar 2011 23:00:25 -0600 Message-Id: <1299560425-16339-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.6.0.2 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 08 Mar 2011 04:58:17 +0000 (UTC) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 555e8c5..a14e45d 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -688,7 +688,7 @@ out: } /* Set an ACL on the server */ -static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, +int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, struct inode *inode, const char *path) { struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 03b9344..095cec7 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -143,6 +143,8 @@ extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, extern int mode_to_cifs_acl(struct inode *inode, const char *path, __u64); extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *, const char *, u32 *); +extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *, + const char *); extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, const char *); diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 2ed33a2..4942994 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c @@ -112,6 +112,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, struct cifs_tcon *pTcon; struct super_block *sb; char *full_path; + struct cifs_ntsd *pacl; if (direntry == NULL) return -EIO; @@ -166,6 +167,19 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, (__u16)value_size, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, + strlen(CIFS_XATTR_CIFS_ACL)) == 0) { + pacl = kmalloc(value_size, GFP_KERNEL); + if (!pacl) { + cFYI(1, "%s: Can't allocate memory for ACL", + __func__); + rc = -ENOMEM; + } else { + memcpy(pacl, ea_value, value_size); + rc = set_cifs_acl(pacl, value_size, + direntry->d_inode, full_path); + kfree(pacl); + } } else { int temp; temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,