--- embedaddon/rsync/lib/sysacls.c 2012/02/17 15:09:30 1.1.1.1 +++ embedaddon/rsync/lib/sysacls.c 2016/11/01 09:54:32 1.1.1.2 @@ -2,7 +2,7 @@ * Unix SMB/CIFS implementation. * Based on the Samba ACL support code. * Copyright (C) Jeremy Allison 2000. - * Copyright (C) 2007-2008 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * The permission functions have been changed to get/set all bits via * one call. Some functions that rsync doesn't need were also removed. @@ -80,13 +80,37 @@ SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_AC return acl_get_file( path_p, type); } -#if 0 SMB_ACL_T sys_acl_get_fd(int fd) { return acl_get_fd(fd); } -#endif +int sys_acl_get_brand( SMB_ACL_T the_acl, int *brand_p) +{ + return acl_get_brand_np(the_acl, brand_p); +} + +int sys_acl_get_brand_file( const char *path_p, int *brand_p) +{ + int fd; + acl_t acl; + + if ((fd = open(path_p, O_RDONLY|O_NONBLOCK)) < 0) + return -1; + if ((acl = acl_get_fd(fd)) == NULL) { + close(fd); + return -1; + } + close(fd); + if (acl_get_brand_np(acl, brand_p) < 0) { + acl_free(acl); + return -1; + } + + acl_free(acl); + return 0; +} + #if defined(HAVE_ACL_GET_PERM_NP) #define acl_get_perm(p, b) acl_get_perm_np(p, b) #endif @@ -873,6 +897,10 @@ int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ #define INITIAL_ACL_SIZE 16 +#ifndef NACLENTRIES +#define NACLENTRIES 0 +#endif + SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type) { SMB_ACL_T acl_d; @@ -909,7 +937,7 @@ SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL sys_acl_free_acl(acl_d); - if ((count = acl(path_p, ACL_CNT, 0, NULL)) < 0) { + if ((count = acl(path_p, ACL_CNT, NACLENTRIES, NULL)) < 0) { return NULL; }