From patchwork Thu Jun 29 03:37:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 9815879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B91B602B1 for ; Thu, 29 Jun 2017 03:37:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43FE127F85 for ; Thu, 29 Jun 2017 03:37:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 373092858E; Thu, 29 Jun 2017 03:37:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B80C927F85 for ; Thu, 29 Jun 2017 03:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751580AbdF2DhW (ORCPT ); Wed, 28 Jun 2017 23:37:22 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35760 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751545AbdF2DhV (ORCPT ); Wed, 28 Jun 2017 23:37:21 -0400 Received: by mail-oi0-f65.google.com with SMTP id l130so7531285oib.2 for ; Wed, 28 Jun 2017 20:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=p/gdfaXPFtxOCH17tWjJelxcPPbXATs0xLY2MLz8Pic=; b=Eibzbzlzcmtcx21OTmX+mBin3vSytgohf0PFu/tSF0Diupd8noB0m4s7vtUJjXZfo9 nTS96dPgY/PI5p+aOdF356JiBsZXOyCWkK81pOP/0HiuCeghuXpY/czBxYEROZ2goNmM QzWG72N02gEM3jKTcMrMvuxxEoDU92PlifVSnDJqKc+9JguwyXa+nWKGQTc1wriLtBxk JBY2rmWlB+5+jhi0zAqho1l9IRcfkUm/+Ge2WzOMlkoRvs32NAC6DeYCr1YL8qi675CD NJ2d7jykMJJSatN8jr6uFXNfyedPXlZKcnRpGepZG1DxklkF8HvBrMN4JMmudfaZnSMG Rz8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=p/gdfaXPFtxOCH17tWjJelxcPPbXATs0xLY2MLz8Pic=; b=tlzZvVwWf1V4nu4gnkueqUtOJ9nH29g9ilk3uhWErLxtA9KTdUEhTPjkwIHlDMcw/a XmcRM7lPYAQZvpRv8zT7I7wID/EW3OiWvcyXraaDNtqncUqxpR92CPNF9xpG9rnjB45n XRDHSCJWVmtQRAA+dHQX/38hVJlfj3E+lBwaL4941w4I78SlysMewYHU5pneLGALKalQ GxW7K1RiBB+02qGyYjB1d+rS8Azf1A5uSE9xUO2lYdQ2UEccbdL7cRIUO/Zvr53eLkUA GKMKJJKVud6PYP3Ge3k8W4a8zHajB+CUtwfYc5cdsJ/C/XfXLOoIdSdFv3XyVO7PRMXK v0Ow== X-Gm-Message-State: AKS2vOzjTQbU87bgUSHHKOfngQBeJNQgBOSlxLMsYEpPrNhdwVUlMz+w kkotIPtC1kdA7w== X-Received: by 10.202.196.143 with SMTP id u137mr7777165oif.79.1498707440215; Wed, 28 Jun 2017 20:37:20 -0700 (PDT) Received: from shirish-ThinkPad-T400.attlocal.net (75-13-85-90.lightspeed.austtx.sbcglobal.net. [75.13.85.90]) by smtp.gmail.com with ESMTPSA id r73sm6739618oie.11.2017.06.28.20.37.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 20:37:18 -0700 (PDT) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH 1/2] cifs: prototype declaration and definition to set acl for smb 2 - 3 and cifsacl mount options Date: Wed, 28 Jun 2017 22:37:00 -0500 Message-Id: <1498707420-8702-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shirish Pargaonkar Modified current set info function to accommodate multiple info types and additional information. Added cifs acl specific function to invoke set info functionality. Signed-off-by: Shirish Pargaonkar Reviewed-by: Pavel Shilovsky --- fs/cifs/smb2pdu.c | 39 +++++++++++++++++++++++++++------------ fs/cifs/smb2proto.h | 3 +++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 4938e8b..c3c8eaf 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3000,8 +3000,9 @@ void smb2_reconnect_server(struct work_struct *work) static int send_set_info(const unsigned int xid, struct cifs_tcon *tcon, - u64 persistent_fid, u64 volatile_fid, u32 pid, int info_class, - unsigned int num, void **data, unsigned int *size) + u64 persistent_fid, u64 volatile_fid, u32 pid, u8 info_class, + u8 info_type, u32 additional_info, unsigned int num, + void **data, unsigned int *size) { struct smb2_set_info_req *req; struct smb2_set_info_rsp *rsp = NULL; @@ -3037,10 +3038,11 @@ void smb2_reconnect_server(struct work_struct *work) req->hdr.sync_hdr.ProcessId = cpu_to_le32(pid); - req->InfoType = SMB2_O_INFO_FILE; + req->InfoType = info_type; req->FileInfoClass = info_class; req->PersistentFileId = persistent_fid; req->VolatileFileId = volatile_fid; + req->AdditionalInformation = cpu_to_le32(additional_info); /* 4 for RFC1001 length and 1 for Buffer */ req->BufferOffset = @@ -3100,8 +3102,8 @@ void smb2_reconnect_server(struct work_struct *work) size[1] = len + 2 /* null */; rc = send_set_info(xid, tcon, persistent_fid, volatile_fid, - current->tgid, FILE_RENAME_INFORMATION, 2, data, - size); + current->tgid, FILE_RENAME_INFORMATION, SMB2_O_INFO_FILE, + 0, 2, data, size); kfree(data); return rc; } @@ -3118,8 +3120,8 @@ void smb2_reconnect_server(struct work_struct *work) size = 1; /* sizeof __u8 */ return send_set_info(xid, tcon, persistent_fid, volatile_fid, - current->tgid, FILE_DISPOSITION_INFORMATION, 1, &data, - &size); + current->tgid, FILE_DISPOSITION_INFORMATION, SMB2_O_INFO_FILE, + 0, 1, &data, &size); } int @@ -3148,7 +3150,8 @@ void smb2_reconnect_server(struct work_struct *work) size[1] = len + 2 /* null */; rc = send_set_info(xid, tcon, persistent_fid, volatile_fid, - current->tgid, FILE_LINK_INFORMATION, 2, data, size); + current->tgid, FILE_LINK_INFORMATION, SMB2_O_INFO_FILE, + 0, 2, data, size); kfree(data); return rc; } @@ -3168,10 +3171,12 @@ void smb2_reconnect_server(struct work_struct *work) if (is_falloc) return send_set_info(xid, tcon, persistent_fid, volatile_fid, - pid, FILE_ALLOCATION_INFORMATION, 1, &data, &size); + pid, FILE_ALLOCATION_INFORMATION, SMB2_O_INFO_FILE, + 0, 1, &data, &size); else return send_set_info(xid, tcon, persistent_fid, volatile_fid, - pid, FILE_END_OF_FILE_INFORMATION, 1, &data, &size); + pid, FILE_END_OF_FILE_INFORMATION, SMB2_O_INFO_FILE, + 0, 1, &data, &size); } int @@ -3181,8 +3186,18 @@ void smb2_reconnect_server(struct work_struct *work) unsigned int size; size = sizeof(FILE_BASIC_INFO); return send_set_info(xid, tcon, persistent_fid, volatile_fid, - current->tgid, FILE_BASIC_INFORMATION, 1, - (void **)&buf, &size); + current->tgid, FILE_BASIC_INFORMATION, SMB2_O_INFO_FILE, + 0, 1, (void **)&buf, &size); +} + +int +SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon, + u64 persistent_fid, u64 volatile_fid, + struct cifs_ntsd *pnntsd, int pacllen, int aclflag) +{ + return send_set_info(xid, tcon, persistent_fid, volatile_fid, + current->tgid, 0, SMB2_O_INFO_SECURITY, aclflag, + 1, (void **)&pnntsd, &pacllen); } int diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h index 3595cd7..1cadaf9 100644 --- a/fs/cifs/smb2proto.h +++ b/fs/cifs/smb2proto.h @@ -166,6 +166,9 @@ extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, extern int SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, FILE_BASIC_INFO *buf); +extern int SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon, + u64 persistent_fid, u64 volatile_fid, + struct cifs_ntsd *pnntsd, int pacllen, int aclflag); extern int SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid); extern int SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,