Date:

Thu Sep 7 16:43:23 PDT 1995

Description

Database users who are not super-users (i.e. could not create other users) could not insert into tables even if they owned the tables.

Thanks to Liakakis Kostas (kostas@astro.auth.gr) for finding the problem and providing valuable support in tracking down the bug.

Fix

Apply this patch.

===================================================================
RCS file: /usr/local/devel/pglite/cvs/src/backend/tcop/aclchk.c,v
retrieving revision 1.8
diff -c -r1.8 aclchk.c
*** 1.8	1995/08/01 20:25:52
--- src/backend/tcop/aclchk.c	1995/09/07 23:43:03
***************
*** 403,408 ****
--- 403,418 ----
  	acl = makeacl(ACL_NUM(tmp));
  	memmove((char *) acl, (char *) tmp, ACL_SIZE(tmp));
  	heap_close(relation);
+     } else {
+ 	/* if the acl is null, by default the owner can do whatever
+ 	   he wants to with it */
+ 	Oid ownerId;
+ 	relation = heap_openr(Name_pg_class);
+ 	ownerId = (Oid)heap_getattr(htp, InvalidBuffer,
+ 				    Anum_pg_class_relowner,
+ 				    RelationGetTupleDescriptor(relation),
+ 				    (bool*) NULL);
+ 	acl = aclownerdefault(ownerId);
      }
  #else
      {				/* This is why the syscache is great... */
===================================================================
RCS file: /usr/local/devel/pglite/cvs/src/backend/utils/adt/acl.c,v
retrieving revision 1.6
diff -c -r1.6 acl.c
*** 1.6	1995/08/01 20:26:48
--- src/backend/utils/adt/acl.c	1995/09/07 23:42:17
***************
*** 313,323 ****
      Acl *acl;
      AclItem *aip;
      
!     acl = makeacl(1);
      aip = ACL_DAT(acl);
!     aip[0].ai_idtype = ACL_IDTYPE_UID;
!     aip[0].ai_id = ownerid;
!     aip[0].ai_mode = ACL_OWNER_DEFAULT;
      return(acl);
  }
  
--- 313,326 ----
      Acl *acl;
      AclItem *aip;
      
!     acl = makeacl(2);
      aip = ACL_DAT(acl);
!     aip[0].ai_idtype = ACL_IDTYPE_WORLD;
!     aip[0].ai_id = ACL_ID_WORLD;
!     aip[0].ai_mode = ACL_WORLD_DEFAULT;
!     aip[1].ai_idtype = ACL_IDTYPE_UID;
!     aip[1].ai_id = ownerid;
!     aip[1].ai_mode = ACL_OWNER_DEFAULT;
      return(acl);
  }