acl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Acl-devel] typo in acl_get_perm?


From: Corinna Vinschen
Subject: [Acl-devel] typo in acl_get_perm?
Date: Fri, 25 Dec 2015 15:36:51 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

Hi,


I was wondering about a discrepancy between the man page for
acl_get_perm and the actual implementation and I'm not sure if I just
misunderstand the docs.

The man page claims:

  The acl_get_perm() function tests if the permission specified by the
  argument perm is *contained* in the ACL permission set pointed to by
  the argument permset_d.

To me "contained" implies that all bits given in perm has to be set
in the permissions permset_d refers to, e.g.:

  permset_d:rw-  perm:r--  ==>  acl_get_perm returns 1
  permset_d:r--  perm:rw-  ==>  acl_get_perm returns 0

Howvever, the actual test performed in acl_get_perm() is this:

  return (acl_permset_obj_p->sperm & perm) != 0;

But this only tests if permset_d and perm have any commen bits.
Performed on the above the results are:

  permset_d:rw-  perm:r--  ==>  acl_get_perm returns 1
  permset_d:r--  perm:rw-  ==>  acl_get_perm returns 1 !!!

Shouldn't this test rather look like this:

  return (~acl_permset_obj_p->sperm & perm) == 0;

~a & b is only != 0 if b has a bit set which isn't set in a, so if
this expression is != 0, some bits in b are not "contained" in a.

Am I just misunderstand the man page?


Thanks,
Corinna



reply via email to

[Prev in Thread] Current Thread [Next in Thread]