1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-26 12:21:12 +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:
Peter Eisentraut
2000-09-06 14:15:31 +00:00
parent daf1e3a702
commit 6dc249610a
28 changed files with 220 additions and 281 deletions

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.64 2000/08/03 16:34:43 tgl Exp $
* $Id: miscadmin.h,v 1.65 2000/09/06 14:15:24 petere Exp $
*
* NOTES
* some of the information in this file will be moved to
@ -51,8 +51,6 @@ extern long MyCancelKey;
extern char OutputFileName[];
extern char *UserName;
/*
* done in storage/backendid.h for now.
*
@ -130,9 +128,9 @@ extern void SetDatabaseName(const char *name);
extern void SetDatabasePath(const char *path);
extern char *GetPgUserName(void);
extern void SetPgUserName(void);
extern int GetUserId(void);
extern void SetUserId(void);
extern Oid GetUserId(void);
extern void SetUserId(Oid userid);
extern void SetUserIdFromUserName(const char *username);
extern int FindExec(char *full_path, const char *argv0, const char *binary_name);
extern int CheckPathAccess(char *path, char *name, int open_mode);
@ -186,7 +184,7 @@ typedef int16 ExitStatus;
extern int lockingOff;
extern void InitPostgres(const char *dbname);
extern void InitPostgres(const char *dbname, const char *username);
extern void BaseInit(void);
/* one of the ways to get out of here */