Skip to content

Commit c0f0699

Browse files
committed
Make aclcontains() do something that's at least vaguely reasonable:
it now returns true if the aclitem argument exactly matches any one of the elements of the aclitem[] argument. Per complaint from Wolff 1/10/01.
1 parent 36839c1 commit c0f0699

File tree

1 file changed

+10
-4
lines changed
  • src/backend/utils/adt

1 file changed

+10
-4
lines changed

src/backend/utils/adt/acl.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.55 2000/12/03 20:45:35 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.56 2001/01/14 19:23:27 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -333,8 +333,10 @@ aclitemout(PG_FUNCTION_ARGS)
333333
* aclitemeq
334334
* aclitemgt
335335
* AclItem equality and greater-than comparison routines.
336-
* Two AclItems are equal iff they have the
337-
* same identifier (and identifier type).
336+
* Two AclItems are considered equal iff they have the
337+
* same identifier (and identifier type); the mode is ignored.
338+
* Note that these routines are really only useful for sorting
339+
* AclItems into identifier order.
338340
*
339341
* RETURNS:
340342
* a boolean value indicating = or >
@@ -581,8 +583,12 @@ aclcontains(PG_FUNCTION_ARGS)
581583
num = ACL_NUM(acl);
582584
aidat = ACL_DAT(acl);
583585
for (i = 0; i < num; ++i)
584-
if (aclitemeq(aip, aidat + i))
586+
{
587+
/* Note that aclitemeq only considers id, not mode */
588+
if (aclitemeq(aip, aidat + i) &&
589+
aip->ai_mode == aidat[i].ai_mode)
585590
PG_RETURN_BOOL(true);
591+
}
586592
PG_RETURN_BOOL(false);
587593
}
588594

0 commit comments

Comments
 (0)