Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 765026350B2 for ; Thu, 1 Oct 2009 00:12:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 89000-01-4 for ; Thu, 1 Oct 2009 03:12:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by mail.postgresql.org (Postfix) with ESMTP id 578B2635069 for ; Thu, 1 Oct 2009 00:12:08 -0300 (ADT) Received: from mailgate3.nec.co.jp ([10.7.69.160]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id n913C4Pk011851; Thu, 1 Oct 2009 12:12:04 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id n913C4N03060; Thu, 1 Oct 2009 12:12:04 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id n913C3gc021669; Thu, 1 Oct 2009 12:12:03 +0900 (JST) Received: from kaishu.jp.nec.com ([10.26.220.5] [10.26.220.5]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-2288082; Thu, 1 Oct 2009 12:10:48 +0900 Received: from [10.19.71.82] ([10.19.71.82] [10.19.71.82]) by mail.jp.nec.com with ESMTP; Thu, 1 Oct 2009 12:10:48 +0900 Message-ID: <4AC41DB7.5070706@ak.jp.nec.com> Date: Thu, 01 Oct 2009 12:10:47 +0900 From: KaiGai Kohei User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Stephen Frost CC: KaiGai Kohei , Robert Haas , pgsql-hackers@postgresql.org Subject: Re: [PATCH] Reworks for Access Control facilities (r2311) References: <20090929105431.GO17756@tamriel.snowman.net> <4AC1EA9E.3080907@kaigai.gr.jp> <20090929173049.GP17756@tamriel.snowman.net> <4AC2BDD0.7050906@ak.jp.nec.com> <4AC2ED74.2030409@ak.jp.nec.com> <20090930122347.GT17756@tamriel.snowman.net> In-Reply-To: <20090930122347.GT17756@tamriel.snowman.net> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.516 tagged_above=-10 required=5 tests=BAYES_00=-2.599, URIBL_RHS_DOB=1.083 X-Spam-Level: X-Archive-Number: 200910/3 X-Sequence-Number: 146815 Stephen Frost wrote: > KaiGai, > > * KaiGai Kohei (kaigai@ak.jp.nec.com) wrote: >> The attached patch eliminates permission checks in FindConversion() >> and EnableDisableRule(), because these are nonsense or redundant. >> >> It is an separated issue from the ac_*() routines. >> For now, we decided not to touch these stuffs in the access control >> reworks patch. So, we can discuss about these fixes as a different >> topic. >> >> See the corresponding messages: >> http://archives.postgresql.org/message-id/26499.1250706473@sss.pgh.pa.us >> http://archives.postgresql.org/message-id/4ABC136A.90903@ak.jp.nec.com > > Thanks. To make sure it gets picked up, you might respond to Tom's > message above with this same email. Just a thought. The following message was my reply. http://archives.postgresql.org/pgsql-hackers/2009-08/msg01420.php Now I'm removing something with behavior change such as above patch, and eliminating comments to be discussed in other thread. I would like to quote them not to forget them away. * ACL_CREATE checks on renaming type When we rename an existing type, it checks ownership of the target type, but ACL_CREATE on the namespace in which the type is stored, although it is checked on renaming any other database objects stored within a certain namespace, such as tables, functions and so on. Is it an intended behavior? * Ownership checks on REASSIGN OWNED BY statement When we use the REASSIGN OWNER BY statement, it tries to change ownership of the database objects which are owned by the target role. It internally calls routine to change the ownership such as AlterFunctionOwner_oid(). The routine depends on the class of objects, and they have a code to check privilege to change ownership when it is actually changed as follows: But the code path corresponding to relations and types does not have such kind of checks. IMO, similar check should be deployed. -- at the AlterFunctionOwner_internal() if (procForm->proowner != newOwnerId) { Datum repl_val[Natts_pg_proc]; bool repl_null[Natts_pg_proc]; bool repl_repl[Natts_pg_proc]; Acl *newAcl; Datum aclDatum; bool isNull; HeapTuple newtuple; /* Superusers can always do it */ if (!superuser()) { /* Otherwise, must be owner of the existing object */ if (!pg_proc_ownercheck(procOid, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, NameStr(procForm->proname)); /* Must be able to become new owner */ check_is_member_of_role(GetUserId(), newOwnerId); /* New owner must have CREATE privilege on namespace */ aclresult = pg_namespace_aclcheck(procForm->pronamespace, newOwnerId, ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(procForm->pronamespace)); } : -- OSS Platform Development Division, NEC KaiGai Kohei