comparison lib/acl-internal.c @ 17963:d4fc0c72ed64

qacl: Simplify HP-UX acl_nontrivial check * lib/acl-internal.c: Remove struct stat parameter from HP-UX's version of acl_nontrivial. Check if the acl has at most three entries instead (it must have exactly three entries according to the HP-UX documentation). Ignore uids and gids as long as an entry is either for a user (i.e., the owner), a group (i.e., the owning group), or others. * lib/acl-internal.h: Change HP-UX's acl_nontrivial prototype. * lib/qcopy-acl.c (qcopy_acl): With that, we no longer need to stat the source file.
author Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
date Sun, 12 Apr 2015 16:36:38 +0200
parents 19e7a05866b5
children 8c5ab0558473
comparison
equal deleted inserted replaced
17962:58658f2c2c44 17963:d4fc0c72ed64
334 #elif USE_ACL && HAVE_GETACL /* HP-UX */ 334 #elif USE_ACL && HAVE_GETACL /* HP-UX */
335 335
336 /* Return 1 if the given ACL is non-trivial. 336 /* Return 1 if the given ACL is non-trivial.
337 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */ 337 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
338 int 338 int
339 acl_nontrivial (int count, struct acl_entry *entries, struct stat *sb) 339 acl_nontrivial (int count, struct acl_entry *entries)
340 { 340 {
341 int i; 341 int i;
342
343 if (count > 3)
344 return 1;
342 345
343 for (i = 0; i < count; i++) 346 for (i = 0; i < count; i++)
344 { 347 {
345 struct acl_entry *ace = &entries[i]; 348 struct acl_entry *ace = &entries[i];
346 349
347 if (!((ace->uid == sb->st_uid && ace->gid == ACL_NSGROUP) 350 if (ace->uid != ACL_NSUSER && ace->gid != ACL_NSGROUP)
348 || (ace->uid == ACL_NSUSER && ace->gid == sb->st_gid) 351 return 1;
349 || (ace->uid == ACL_NSUSER && ace->gid == ACL_NSGROUP)))
350 return 1;
351 } 352 }
352 return 0; 353 return 0;
353 } 354 }
354 355
355 # if HAVE_ACLV_H /* HP-UX >= 11.11 */ 356 # if HAVE_ACLV_H /* HP-UX >= 11.11 */