mirror of
https://github.com/postgres/postgres.git
synced 2025-08-06 18:42:54 +03:00
to prevent possible escalation of privilege. Provide new SECURITY DEFINER functions with old behavior, but initially REVOKE ALL from public for these functions. Per list discussion and design proposed by Tom Lane.
92 lines
1.8 KiB
Plaintext
92 lines
1.8 KiB
Plaintext
==================================================================
|
|
Name
|
|
|
|
dblink_connect -- Opens a persistent connection to a remote database
|
|
|
|
Synopsis
|
|
|
|
dblink_connect(text connstr)
|
|
|
|
Inputs
|
|
|
|
connstr
|
|
|
|
standard libpq format connection string,
|
|
e.g. "hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres password=mypasswd"
|
|
|
|
Outputs
|
|
|
|
Returns status = "OK"
|
|
|
|
Notes
|
|
|
|
Only superusers may use dblink_connect to create non-password
|
|
authenticated connections. If non-superusers need this capability,
|
|
use dblink_connect_u instead.
|
|
|
|
Example usage
|
|
|
|
test=# select dblink_connect('dbname=template1');
|
|
dblink_connect
|
|
----------------
|
|
OK
|
|
(1 row)
|
|
|
|
==================================================================
|
|
Name
|
|
|
|
dblink_connect_u -- Opens a persistent connection to a remote database
|
|
|
|
Synopsis
|
|
|
|
dblink_connect_u(text connstr)
|
|
|
|
Inputs
|
|
|
|
connstr
|
|
|
|
standard libpq format connection string,
|
|
e.g. "hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres password=mypasswd"
|
|
|
|
Outputs
|
|
|
|
Returns status = "OK"
|
|
|
|
Notes
|
|
|
|
With dblink_connect_u, a non-superuser may connect to any database server
|
|
using any authentication method. If the authentication method specified
|
|
for a particular user does not require a password, impersonation and
|
|
therefore escalation of privileges may occur. For this reason,
|
|
dblink_connect_u is initially installed with all privileges revoked from
|
|
public. Privilege to these functions should be granted with care.
|
|
|
|
Example usage
|
|
|
|
|
|
==================================================================
|
|
Name
|
|
|
|
dblink_disconnect -- Closes the persistent connection to a remote database
|
|
|
|
Synopsis
|
|
|
|
dblink_disconnect()
|
|
|
|
Inputs
|
|
|
|
none
|
|
|
|
Outputs
|
|
|
|
Returns status = "OK"
|
|
|
|
Example usage
|
|
|
|
test=# select dblink_disconnect();
|
|
dblink_disconnect
|
|
-------------------
|
|
OK
|
|
(1 row)
|
|
|