|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.85 2005/11/22 18:17:09 momjian Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.86 2006/01/13 18:06:45 tgl Exp $ |
12 | 12 | *
|
13 | 13 | * DESCRIPTION
|
14 | 14 | * The "DefineFoo" routines take the parse tree and pick out the
|
@@ -330,6 +330,30 @@ DefineType(List *names, List *parameters)
|
330 | 330 | if (analyzeName)
|
331 | 331 | analyzeOid = findTypeAnalyzeFunction(analyzeName, typoid);
|
332 | 332 |
|
| 333 | + /* |
| 334 | + * Check permissions on functions. We choose to require the creator/owner |
| 335 | + * of a type to also own the underlying functions. Since creating a type |
| 336 | + * is tantamount to granting public execute access on the functions, the |
| 337 | + * minimum sane check would be for execute-with-grant-option. But we don't |
| 338 | + * have a way to make the type go away if the grant option is revoked, so |
| 339 | + * ownership seems better. |
| 340 | + */ |
| 341 | + if (inputOid && !pg_proc_ownercheck(inputOid, GetUserId())) |
| 342 | + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, |
| 343 | + NameListToString(inputName)); |
| 344 | + if (outputOid && !pg_proc_ownercheck(outputOid, GetUserId())) |
| 345 | + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, |
| 346 | + NameListToString(outputName)); |
| 347 | + if (receiveOid && !pg_proc_ownercheck(receiveOid, GetUserId())) |
| 348 | + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, |
| 349 | + NameListToString(receiveName)); |
| 350 | + if (sendOid && !pg_proc_ownercheck(sendOid, GetUserId())) |
| 351 | + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, |
| 352 | + NameListToString(sendName)); |
| 353 | + if (analyzeOid && !pg_proc_ownercheck(analyzeOid, GetUserId())) |
| 354 | + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, |
| 355 | + NameListToString(analyzeName)); |
| 356 | + |
333 | 357 | /*
|
334 | 358 | * now have TypeCreate do all the real work.
|
335 | 359 | */
|
|
0 commit comments