mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
Forbid REVOKE on untrusted languages, and don't dump privileges of
untrusted languages (in case they sneak in).
This commit is contained in:
parent
ed651a54fd
commit
5570c9ee14
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.91 2003/10/31 20:00:49 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.91.2.1 2003/12/19 14:21:43 petere Exp $
|
||||
*
|
||||
* NOTES
|
||||
* See acl.h.
|
||||
@ -592,7 +592,7 @@ ExecuteGrantStmt_Language(GrantStmt *stmt)
|
||||
aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_LANGUAGE,
|
||||
NameStr(pg_language_tuple->lanname));
|
||||
|
||||
if (!pg_language_tuple->lanpltrusted && stmt->is_grant)
|
||||
if (!pg_language_tuple->lanpltrusted)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("language \"%s\" is not trusted", langname)));
|
||||
|
@ -12,7 +12,7 @@
|
||||
* by PostgreSQL
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355 2003/10/28 21:05:29 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355.2.1 2003/12/19 14:21:43 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -3488,6 +3488,7 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
|
||||
int i_lanacl = -1;
|
||||
char *lanoid;
|
||||
char *lanname;
|
||||
bool lanpltrusted;
|
||||
char *lanacl;
|
||||
const char *lanplcallfoid;
|
||||
const char *lanvalidator;
|
||||
@ -3528,6 +3529,7 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
|
||||
lanoid = PQgetvalue(res, i, i_oid);
|
||||
lanplcallfoid = PQgetvalue(res, i, i_lanplcallfoid);
|
||||
lanname = PQgetvalue(res, i, i_lanname);
|
||||
lanpltrusted = (PQgetvalue(res, i, i_lanpltrusted)[0] == 't');
|
||||
if (fout->remoteVersion >= 70300)
|
||||
{
|
||||
lanvalidator = PQgetvalue(res, i, i_lanvalidator);
|
||||
@ -3580,7 +3582,7 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
|
||||
fmtId(lanname));
|
||||
|
||||
appendPQExpBuffer(defqry, "CREATE %sPROCEDURAL LANGUAGE %s",
|
||||
(PQgetvalue(res, i, i_lanpltrusted)[0] == 't') ?
|
||||
lanpltrusted ?
|
||||
"TRUSTED " : "",
|
||||
fmtId(lanname));
|
||||
appendPQExpBuffer(defqry, " HANDLER %s",
|
||||
@ -3605,7 +3607,7 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
|
||||
"PROCEDURAL LANGUAGE", deps,
|
||||
defqry->data, delqry->data, NULL, NULL, NULL);
|
||||
|
||||
if (!aclsSkip)
|
||||
if (!aclsSkip && lanpltrusted)
|
||||
{
|
||||
char *tmp = strdup(fmtId(lanname));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user