[PATCHES] s3-sysacls - modify SMB_ACL_PERMSET_T to be a mode_t (possible HPUX fix)

Uri Simchoni uri at samba.org
Tue Nov 28 19:44:30 UTC 2017


On 11/28/2017 12:35 PM, Volker Lendecke via samba-technical wrote:
> On Tue, Nov 28, 2017 at 07:39:43AM +0200, Uri Simchoni via samba-technical wrote:
>> Hi,
>>
>> This patch set fixes clang picky-developer errors on FreeBSD around
>> POSIX acls. It possibly also fixes an hpux issue reported in
>> https://bugzilla.samba.org/show_bug.cgi?id=11490#c4
> 
> Would
> 
> --- a/source3/include/smb_acls.h
> +++ b/source3/include/smb_acls.h
> @@ -27,8 +27,8 @@ struct files_struct;
>  struct smb_filename;
> 
>  typedef int                    SMB_ACL_TYPE_T;
> -typedef mode_t                 *SMB_ACL_PERMSET_T;
> -typedef mode_t                 SMB_ACL_PERM_T;
> +typedef uint32_t                       *SMB_ACL_PERMSET_T;
> +typedef uint32_t                       SMB_ACL_PERM_T;
> 
>  typedef enum smb_acl_tag_t SMB_ACL_TAG_T;
>  typedef struct smb_acl_t *SMB_ACL_T;
> 
> possibly also solve the problem? It's not that I particularly like the
> posix acl API, but it's there...
> 
> Volker
> 

:)

(tl;dr, bike-shedding alert)

It almost solves the problem (missing is a fix to make_simple_acl() in
source3/smbd/pysmbd.c, which uses the API in an incorrect way that
happens to work).

IMHO the changes I proposed make the interface simpler, harder to use
wrongly, and more idiomatic to C.

The existing interface offers two ways to look at SMB_ACL_PERMSET_T -
either as an opaque handle (a-la POSIX ACL API), or as a pointer to an
actual bitmask. Parts of the code already use the bitmask
interpretation. Parts of the code that use the "handle" interpretation
needlessly pass a pointer to the "handle".

The proposed change make it a bitmask-only, and it's clearer when one
should use SMB_ACL_PERMSET_T and when one should use a pointer to it.

The fact that the current interface resembles that of POSIX ACL API is
of little consequence IMO because actual interface with OS APIs is
hidden behind the walls of the VFS anyway.

If want to keep the interface the way it is, we can do that too.

Thanks,
Uri.



More information about the samba-technical mailing list