From patchwork Sat Nov 13 20:47:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 322862 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 oADKqkFm029736 for ; Sat, 13 Nov 2010 20:52:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756731Ab0KMUw3 (ORCPT ); Sat, 13 Nov 2010 15:52:29 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:58869 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753597Ab0KMUw2 (ORCPT ); Sat, 13 Nov 2010 15:52:28 -0500 Received: by gyh4 with SMTP id 4so2443374gyh.19 for ; Sat, 13 Nov 2010 12:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=uCufvgbvJwuC59Qvri9X8x8QFb8Teu8GJ3fW94cHA24=; b=lDFIz74PCvl0jluXN+O5XthUUda16hDQkiD5GDVb56ADjJgcKVlvwCgVlgCR99/EI9 RwknL74YL+c4cGXL2d+JDkaMpzoyucAbWePcYeEiWA/l2NuMfpiRebgXqYX/vIh7sYkx ilxwK7Wa/jlTxK6s+ygWU11q0WX5Cj2Op1WpA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=u8O5wcYTOXuTkgDDqoVuMYs4ykq4CPXV+jBMVmYnS3Af5BlRBZpf8XLI4ncqFaV/IX idsJSKKteMiAeV1DGOjLqYNGH2ITclkb3jiULvtNnSS1NvS5OCeFQ2lmzQnAbcXWQS84 VG6XA+VumezO8WrxqbCK6kJLTeo58vHze3g0Y= Received: by 10.100.242.16 with SMTP id p16mr2856210anh.181.1289681547990; Sat, 13 Nov 2010 12:52:27 -0800 (PST) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id g6sm1665624anh.11.2010.11.13.12.52.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Nov 2010 12:52:27 -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 Date: Sat, 13 Nov 2010 14:47:07 -0600 Message-Id: <1289681227-20107-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.3 (demeter1.kernel.org [140.211.167.41]); Sat, 13 Nov 2010 20:52:47 +0000 (UTC) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index c6ebea0..43c1190 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -677,7 +677,8 @@ 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 db961dc..4aed3c6 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -136,6 +136,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 6667d26..137f905 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 cifsTconInfo *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,