X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ED9BA9DC982 for ; Mon, 13 Mar 2006 05:55:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99200-07 for ; Mon, 13 Mar 2006 05:55:30 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D901F9DC998 for ; Mon, 13 Mar 2006 05:55:26 -0400 (AST) Received: from moon.antora.ru (moon.antora.ru [83.222.21.34]) by svr4.postgresql.org (Postfix) with ESMTP id 6D3AE5AF068 for ; Mon, 13 Mar 2006 09:55:29 +0000 (GMT) Received: from [217.26.17.26] (helo=[10.0.0.72]) by moon.antora.ru with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.60 (FreeBSD)) (envelope-from ) id 1FIjll-0000tN-B9 for pgsql-sql@postgresql.org; Mon, 13 Mar 2006 12:55:26 +0300 Message-ID: <441540AA.3090202@bankir.ru> Date: Mon, 13 Mar 2006 12:51:38 +0300 From: "Eugene E." User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050517) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Permission to Select References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/181 X-Sequence-Number: 24527 Hi all the serious problem with permissions is encountered NOTE: the following example is really useful but there is no room to describe it's use. db=# CREATE USER u; db=# CREATE TABLE t (i int, a text); db=# REVOKE all ON t FROM u; db=# GRANT update,insert,delete ON t TO u; db=# \c - u db=> INSERT INTO t VALUES (1,'x'); INSERT db=> UPDATE t SET a='y' WHERE i=1; ERROR: Permission denied for relation t; db=> UPDATE t SET a='y'; UPDATE 1) The user "u" is permitted but unable to perfom the operation ! 2) A user is able to update WHOLE table but unable to update ANY part of it ! Please examine the following patch and make your judgment: --- src/backend/executor/execMain.c.orig 2005-11-22 1:23:08.000000000 +0300 +++ src/backend/executor/execMain.c 2006-02-17 13:19:29.000000000 +0300 @@ -460,6 +460,16 @@ bool do_select_into; TupleDesc tupType; + if ( operation == CMD_UPDATE || operation == CMD_DELETE ) + { + ListCell *l; + foreach(l, parseTree->rtable) + { + RangeTblEntry *rte = lfirst(l); + rte->requiredPerms ^= ACL_SELECT; + } + } + /* * Do permissions checks. It's sufficient to examine the query's top * rangetable here --- subplan RTEs will be checked during