Re: [PATCH] cifs: Allow to set extended attribute cifs_acl (repost)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't have any objections to this - but will wait a few days for any
other feedback.   Seems like this addresses the kernel part of the
requirement that some backup applications have (for setting the actual
exact cifs remotely).  Obviously user space tools to setup the cifs
acl blob would make this easier.

On Mon, Mar 7, 2011 at 11:00 PM,  <shirishpargaonkar@xxxxxxxxx> wrote:
> From: Shirish Pargaonkar <shirishpargaonkar@xxxxxxxxx>
>
>
> Allow setting cifs_acl on the server.
> Pass on to the server the ACL blob generated by an application.
> cifs is just a pass-through, server decides whether to enforce/apply
> the ACL blob composed by an application.
>
>
> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@xxxxxxxxx>
> ---
>  fs/cifs/cifsacl.c   |    2 +-
>  fs/cifs/cifsproto.h |    2 ++
>  fs/cifs/xattr.c     |   14 ++++++++++++++
>  3 files changed, 17 insertions(+), 1 deletions(-)
>
> 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,
> --
> 1.6.0.2
>
>



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux