diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2000-09-06 14:15:31 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2000-09-06 14:15:31 +0000 |
commit | 6dc249610a87aa8b9dcc8baf4e64d2e14d02f548 (patch) | |
tree | 6ca1b864625ecf91a2887c8031a9fa91b5f9c5c5 /src/include | |
parent | daf1e3a7026e367d630be3ac34ac0a9e7cf1340f (diff) | |
download | postgresql-6dc249610a87aa8b9dcc8baf4e64d2e14d02f548.tar.gz postgresql-6dc249610a87aa8b9dcc8baf4e64d2e14d02f548.zip |
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.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/commands/rename.h | 4 | ||||
-rw-r--r-- | src/include/miscadmin.h | 12 | ||||
-rw-r--r-- | src/include/tcop/tcopprot.h | 4 | ||||
-rw-r--r-- | src/include/utils/acl.h | 10 |
4 files changed, 14 insertions, 16 deletions
diff --git a/src/include/commands/rename.h b/src/include/commands/rename.h index 230a2162d46..e5ee7db66c6 100644 --- a/src/include/commands/rename.h +++ b/src/include/commands/rename.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: rename.h,v 1.8 2000/01/26 05:58:00 momjian Exp $ + * $Id: rename.h,v 1.9 2000/09/06 14:15:25 petere Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ extern void renameatt(char *relname, char *oldattname, char *newattname, - char *userName, int recurse); + int recurse); extern void renamerel(const char *oldrelname, const char *newrelname); diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 83ad67602cc..187f6f91b7f 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -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 */ diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h index 11e3a2ca5d2..562efca25cc 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: tcopprot.h,v 1.33 2000/08/29 09:36:51 petere Exp $ + * $Id: tcopprot.h,v 1.34 2000/09/06 14:15:28 petere Exp $ * * OLD COMMENTS * This file was created so that other c files could get the two @@ -45,7 +45,7 @@ extern void handle_warn(SIGNAL_ARGS); extern void die(SIGNAL_ARGS); extern void CancelQuery(void); extern int PostgresMain(int argc, char *argv[], - int real_argc, char *real_argv[]); + int real_argc, char *real_argv[], const char *username); extern void ResetUsage(void); extern void ShowUsage(void); extern FILE * StatFp; diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index e8a8f3a111b..5e91f56bf50 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: acl.h,v 1.26 2000/07/31 22:39:02 tgl Exp $ + * $Id: acl.h,v 1.27 2000/09/06 14:15:31 petere Exp $ * * NOTES * For backward-compatibility purposes we have to allow there @@ -197,11 +197,11 @@ extern void ChangeAcl(char *relname, AclItem *mod_aip, unsigned modechg); extern AclId get_grosysid(char *groname); extern char *get_groname(AclId grosysid); -extern int32 pg_aclcheck(char *relname, char *usename, AclMode mode); -extern int32 pg_ownercheck(const char *usename, const char *value, int cacheid); -extern int32 pg_func_ownercheck(char *usename, char *funcname, +extern int32 pg_aclcheck(char *relname, Oid userid, AclMode mode); +extern int32 pg_ownercheck(Oid userid, const char *value, int cacheid); +extern int32 pg_func_ownercheck(Oid userid, char *funcname, int nargs, Oid *arglist); -extern int32 pg_aggr_ownercheck(char *usename, char *aggname, +extern int32 pg_aggr_ownercheck(Oid userid, char *aggname, Oid basetypeID); #endif /* ACL_H */ |