Re: Permissions within a function - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: Permissions within a function
Date
Msg-id thhal-0tZefAvk3cS4JdA1Udl4kFuJH0Z64U0@mailblocks.com
Whole thread Raw
In response to Re: Permissions within a function  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Permissions within a function
List pgsql-hackers
Peter Eisentraut wrote:

>Thomas Hallgren wrote:
>  
>
>>Is there a way to bypass security checks that retains the SQL parser?
>>I'd like my C-code to do something like:
>>
>>impersonate pgadmin
>>SELECT image from class_table
>>revert to self
>>    
>>
>
>You can use GetUserId() and SetUserId() to flip the current user 
>identity around as you like.  For such a simple query, however, it 
>might seem better to bypass SPI altogether and do a straight table 
>lookup through lower-level functions.
>  
>
Brilliant! I had no idea it was that simple. SetUserId seems to be 
extremely lightweight and just what I need. By using it, I can let my 
ClassLoader execute with other restrictions than the function caller 
(bypassing SPI is not so good for me since the loader is fairly complex 
and will access more than one table).

Thanks for the advice,
Thomas Hallgren




pgsql-hackers by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: Permissions within a function
Next
From: ohp@pyrenet.fr
Date:
Subject: Re: Call for port reports