From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Aur=C3=A9lien?= Aptel Date: Tue, 22 Nov 2016 12:18:25 +0000 Subject: Re: [PATCH] SMB2: Fix share type handling Message-Id: List-Id: References: <20161121215352.3183-1-christophe.jaillet@wanadoo.fr> In-Reply-To: <20161121215352.3183-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: Christophe JAILLET , sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Christophe JAILLET writes: > Knowing that, with the current code, the SMB2_SHARE_TYPE_PRINT case can > never trigger and printer share would be interpreted as disk share. I've checked the SMB2 specs ([MS-SMB2] 3.2.5.5), I can confirm these are the 3 only options. No upper bits are supposed to be set. > So, test the ShareType value for equality instead. > > While at it, add some { } to fix a small style issue. > > Signed-off-by: Christophe JAILLET > --- > Compile-tested only. > > The proposed patch changes a bit the semantic as no masking is performed > anymore. If some upper bits in 'ShareType' are set, it would now be rejected > instead of silently accepted. The semantic change is correct. I also think a switch would be more appropriate. Beside this, Looks Good To Me. -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Aur=C3=A9lien?= Aptel Subject: Re: [PATCH] SMB2: Fix share type handling Date: Tue, 22 Nov 2016 13:18:25 +0100 Message-ID: References: <20161121215352.3183-1-christophe.jaillet@wanadoo.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Christophe JAILLET To: Christophe JAILLET , sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org Return-path: In-Reply-To: <20161121215352.3183-1-christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org> Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Christophe JAILLET writes: > Knowing that, with the current code, the SMB2_SHARE_TYPE_PRINT case can > never trigger and printer share would be interpreted as disk share. I've checked the SMB2 specs ([MS-SMB2] 3.2.5.5), I can confirm these are the 3 only options. No upper bits are supposed to be set. > So, test the ShareType value for equality instead. > > While at it, add some { } to fix a small style issue. > > Signed-off-by: Christophe JAILLET > --- > Compile-tested only. > > The proposed patch changes a bit the semantic as no masking is performed > anymore. If some upper bits in 'ShareType' are set, it would now be rejected > instead of silently accepted. The semantic change is correct. I also think a switch would be more appropriate. Beside this, Looks Good To Me. -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932906AbcKVMSv convert rfc822-to-8bit (ORCPT ); Tue, 22 Nov 2016 07:18:51 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:55578 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932816AbcKVMSu (ORCPT ); Tue, 22 Nov 2016 07:18:50 -0500 From: =?utf-8?Q?Aur=C3=A9lien?= Aptel To: Christophe JAILLET , sfrench@samba.org Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: Re: [PATCH] SMB2: Fix share type handling In-Reply-To: <20161121215352.3183-1-christophe.jaillet@wanadoo.fr> References: <20161121215352.3183-1-christophe.jaillet@wanadoo.fr> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) Date: Tue, 22 Nov 2016 13:18:25 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe JAILLET writes: > Knowing that, with the current code, the SMB2_SHARE_TYPE_PRINT case can > never trigger and printer share would be interpreted as disk share. I've checked the SMB2 specs ([MS-SMB2] 3.2.5.5), I can confirm these are the 3 only options. No upper bits are supposed to be set. > So, test the ShareType value for equality instead. > > While at it, add some { } to fix a small style issue. > > Signed-off-by: Christophe JAILLET > --- > Compile-tested only. > > The proposed patch changes a bit the semantic as no masking is performed > anymore. If some upper bits in 'ShareType' are set, it would now be rejected > instead of silently accepted. The semantic change is correct. I also think a switch would be more appropriate. Beside this, Looks Good To Me. -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)