mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Code cleanup of user name and user id handling in the backend. The current
user is now defined in terms of the user id, the user name is only computed upon request (for display purposes). This is kind of the opposite of the previous state, which would maintain the user name and compute the user id for permission checks. Besides perhaps saving a few cycles (integer vs string), this now creates a single point of attack for changing the user id during a connection, for purposes of "setuid" functions, etc.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.46 2000/06/20 06:41:13 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.47 2000/09/06 14:15:16 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -53,7 +53,6 @@ void
|
||||
renameatt(char *relname,
|
||||
char *oldattname,
|
||||
char *newattname,
|
||||
char *userName,
|
||||
int recurse)
|
||||
{
|
||||
Relation targetrelation;
|
||||
@ -74,7 +73,7 @@ renameatt(char *relname,
|
||||
relname);
|
||||
#ifndef NO_SECURITY
|
||||
if (!IsBootstrapProcessingMode() &&
|
||||
!pg_ownercheck(userName, relname, RELNAME))
|
||||
!pg_ownercheck(GetUserId(), relname, RELNAME))
|
||||
elog(ERROR, "renameatt: you do not own class \"%s\"",
|
||||
relname);
|
||||
#endif
|
||||
@ -129,7 +128,7 @@ renameatt(char *relname,
|
||||
NameStr(((Form_pg_class) GETSTRUCT(reltup))->relname),
|
||||
NAMEDATALEN);
|
||||
/* note we need not recurse again! */
|
||||
renameatt(childname, oldattname, newattname, userName, 0);
|
||||
renameatt(childname, oldattname, newattname, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user